macp-sdk-python 0.4.0__tar.gz → 0.5.0__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (39) hide show
  1. {macp_sdk_python-0.4.0/src/macp_sdk_python.egg-info → macp_sdk_python-0.5.0}/PKG-INFO +17 -5
  2. {macp_sdk_python-0.4.0 → macp_sdk_python-0.5.0}/README.md +6 -0
  3. {macp_sdk_python-0.4.0 → macp_sdk_python-0.5.0}/pyproject.toml +28 -14
  4. {macp_sdk_python-0.4.0 → macp_sdk_python-0.5.0}/src/macp_sdk/__init__.py +2 -0
  5. {macp_sdk_python-0.4.0 → macp_sdk_python-0.5.0}/src/macp_sdk/agent/participant.py +11 -1
  6. {macp_sdk_python-0.4.0 → macp_sdk_python-0.5.0}/src/macp_sdk/agent/runner.py +5 -0
  7. {macp_sdk_python-0.4.0 → macp_sdk_python-0.5.0}/src/macp_sdk/base_session.py +19 -2
  8. {macp_sdk_python-0.4.0 → macp_sdk_python-0.5.0}/src/macp_sdk/client.py +262 -50
  9. {macp_sdk_python-0.4.0 → macp_sdk_python-0.5.0}/src/macp_sdk/envelope.py +35 -1
  10. {macp_sdk_python-0.4.0 → macp_sdk_python-0.5.0}/src/macp_sdk/errors.py +13 -1
  11. {macp_sdk_python-0.4.0 → macp_sdk_python-0.5.0}/src/macp_sdk/handoff.py +29 -0
  12. {macp_sdk_python-0.4.0 → macp_sdk_python-0.5.0}/src/macp_sdk/policy.py +59 -5
  13. {macp_sdk_python-0.4.0 → macp_sdk_python-0.5.0}/src/macp_sdk/proto_registry.py +27 -1
  14. {macp_sdk_python-0.4.0 → macp_sdk_python-0.5.0}/src/macp_sdk/validation.py +34 -6
  15. {macp_sdk_python-0.4.0 → macp_sdk_python-0.5.0}/src/macp_sdk/watchers.py +9 -5
  16. {macp_sdk_python-0.4.0 → macp_sdk_python-0.5.0/src/macp_sdk_python.egg-info}/PKG-INFO +17 -5
  17. {macp_sdk_python-0.4.0 → macp_sdk_python-0.5.0}/src/macp_sdk_python.egg-info/requires.txt +4 -3
  18. {macp_sdk_python-0.4.0 → macp_sdk_python-0.5.0}/LICENSE +0 -0
  19. {macp_sdk_python-0.4.0 → macp_sdk_python-0.5.0}/setup.cfg +0 -0
  20. {macp_sdk_python-0.4.0 → macp_sdk_python-0.5.0}/src/macp_sdk/_logging.py +0 -0
  21. {macp_sdk_python-0.4.0 → macp_sdk_python-0.5.0}/src/macp_sdk/agent/__init__.py +0 -0
  22. {macp_sdk_python-0.4.0 → macp_sdk_python-0.5.0}/src/macp_sdk/agent/cancel_callback.py +0 -0
  23. {macp_sdk_python-0.4.0 → macp_sdk_python-0.5.0}/src/macp_sdk/agent/dispatcher.py +0 -0
  24. {macp_sdk_python-0.4.0 → macp_sdk_python-0.5.0}/src/macp_sdk/agent/strategies.py +0 -0
  25. {macp_sdk_python-0.4.0 → macp_sdk_python-0.5.0}/src/macp_sdk/agent/transports.py +0 -0
  26. {macp_sdk_python-0.4.0 → macp_sdk_python-0.5.0}/src/macp_sdk/agent/types.py +0 -0
  27. {macp_sdk_python-0.4.0 → macp_sdk_python-0.5.0}/src/macp_sdk/auth.py +0 -0
  28. {macp_sdk_python-0.4.0 → macp_sdk_python-0.5.0}/src/macp_sdk/base_projection.py +0 -0
  29. {macp_sdk_python-0.4.0 → macp_sdk_python-0.5.0}/src/macp_sdk/constants.py +0 -0
  30. {macp_sdk_python-0.4.0 → macp_sdk_python-0.5.0}/src/macp_sdk/decision.py +0 -0
  31. {macp_sdk_python-0.4.0 → macp_sdk_python-0.5.0}/src/macp_sdk/projections.py +0 -0
  32. {macp_sdk_python-0.4.0 → macp_sdk_python-0.5.0}/src/macp_sdk/proposal.py +0 -0
  33. {macp_sdk_python-0.4.0 → macp_sdk_python-0.5.0}/src/macp_sdk/py.typed +0 -0
  34. {macp_sdk_python-0.4.0 → macp_sdk_python-0.5.0}/src/macp_sdk/quorum.py +0 -0
  35. {macp_sdk_python-0.4.0 → macp_sdk_python-0.5.0}/src/macp_sdk/retry.py +0 -0
  36. {macp_sdk_python-0.4.0 → macp_sdk_python-0.5.0}/src/macp_sdk/task.py +0 -0
  37. {macp_sdk_python-0.4.0 → macp_sdk_python-0.5.0}/src/macp_sdk_python.egg-info/SOURCES.txt +0 -0
  38. {macp_sdk_python-0.4.0 → macp_sdk_python-0.5.0}/src/macp_sdk_python.egg-info/dependency_links.txt +0 -0
  39. {macp_sdk_python-0.4.0 → macp_sdk_python-0.5.0}/src/macp_sdk_python.egg-info/top_level.txt +0 -0
@@ -1,9 +1,14 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: macp-sdk-python
3
- Version: 0.4.0
3
+ Version: 0.5.0
4
4
  Summary: Python SDK for the MACP Rust runtime
5
- Author-email: OpenAI <support@openai.com>
5
+ Author-email: Multi-Agent Coordination Protocol <macp@multiagentcoordinationprotocol.org>
6
6
  License: Apache-2.0
7
+ Project-URL: Homepage, https://github.com/multiagentcoordinationprotocol/macp-sdk-python
8
+ Project-URL: Repository, https://github.com/multiagentcoordinationprotocol/macp-sdk-python
9
+ Project-URL: Documentation, https://github.com/multiagentcoordinationprotocol/macp-sdk-python/tree/main/docs
10
+ Project-URL: Changelog, https://github.com/multiagentcoordinationprotocol/macp-sdk-python/blob/main/CHANGELOG.md
11
+ Project-URL: Bug Tracker, https://github.com/multiagentcoordinationprotocol/macp-sdk-python/issues
7
12
  Classifier: Development Status :: 3 - Alpha
8
13
  Classifier: Intended Audience :: Developers
9
14
  Classifier: License :: OSI Approved :: Apache Software License
@@ -15,9 +20,9 @@ Classifier: Topic :: Software Development :: Libraries
15
20
  Requires-Python: >=3.11
16
21
  Description-Content-Type: text/markdown
17
22
  License-File: LICENSE
18
- Requires-Dist: grpcio>=1.81.1
19
- Requires-Dist: protobuf>=5.27.0
20
- Requires-Dist: macp-proto<0.2.0,>=0.1.3
23
+ Requires-Dist: grpcio>=1.82.0
24
+ Requires-Dist: protobuf>=7.35.0
25
+ Requires-Dist: macp-proto<0.2.0,>=0.1.6
21
26
  Provides-Extra: dev
22
27
  Requires-Dist: grpcio-tools>=1.74.0; extra == "dev"
23
28
  Requires-Dist: pytest>=8.0; extra == "dev"
@@ -27,6 +32,7 @@ Requires-Dist: mypy>=1.10; extra == "dev"
27
32
  Requires-Dist: ruff>=0.5; extra == "dev"
28
33
  Requires-Dist: grpc-stubs>=1.53; extra == "dev"
29
34
  Requires-Dist: build>=1.0; extra == "dev"
35
+ Requires-Dist: jsonschema>=4.0; extra == "dev"
30
36
  Provides-Extra: docs
31
37
  Requires-Dist: mkdocs-material>=9.5; extra == "docs"
32
38
  Requires-Dist: mkdocstrings[python]>=0.25; extra == "docs"
@@ -144,6 +150,12 @@ export MACP_ALLOW_INSECURE=1
144
150
  cargo run # in the runtime repo
145
151
  ```
146
152
 
153
+ Since runtime **v0.5.0**, a runtime with no authentication configured
154
+ (`MACP_AUTH_TOKENS_*` / `MACP_AUTH_ISSUER` unset) **refuses to start** unless
155
+ `MACP_ALLOW_INSECURE=1` is set, and the published Docker image **no longer
156
+ bakes that env in** — pass it explicitly for local dev (as above and in the
157
+ `docker run` command in `CLAUDE.md`).
158
+
147
159
  Dev-agent auth rides the standard `Authorization: Bearer` header — the
148
160
  runtime's `dev_authenticate` fallback binds the token value verbatim
149
161
  as the sender.
@@ -110,6 +110,12 @@ export MACP_ALLOW_INSECURE=1
110
110
  cargo run # in the runtime repo
111
111
  ```
112
112
 
113
+ Since runtime **v0.5.0**, a runtime with no authentication configured
114
+ (`MACP_AUTH_TOKENS_*` / `MACP_AUTH_ISSUER` unset) **refuses to start** unless
115
+ `MACP_ALLOW_INSECURE=1` is set, and the published Docker image **no longer
116
+ bakes that env in** — pass it explicitly for local dev (as above and in the
117
+ `docker run` command in `CLAUDE.md`).
118
+
113
119
  Dev-agent auth rides the standard `Authorization: Bearer` header — the
114
120
  runtime's `dev_authenticate` fallback binds the token value verbatim
115
121
  as the sender.
@@ -4,13 +4,13 @@ build-backend = "setuptools.build_meta"
4
4
 
5
5
  [project]
6
6
  name = "macp-sdk-python"
7
- version = "0.4.0"
7
+ version = "0.5.0"
8
8
  description = "Python SDK for the MACP Rust runtime"
9
9
  readme = "README.md"
10
10
  requires-python = ">=3.11"
11
11
  license = {text = "Apache-2.0"}
12
12
  authors = [
13
- {name = "OpenAI", email = "support@openai.com"}
13
+ {name = "Multi-Agent Coordination Protocol", email = "macp@multiagentcoordinationprotocol.org"}
14
14
  ]
15
15
  classifiers = [
16
16
  "Development Status :: 3 - Alpha",
@@ -23,20 +23,33 @@ classifiers = [
23
23
  "Topic :: Software Development :: Libraries",
24
24
  ]
25
25
  dependencies = [
26
- # macp-proto 0.1.3's generated gRPC stubs require grpcio>=1.81.1.
27
- "grpcio>=1.81.1",
28
- "protobuf>=5.27.0",
29
- # Requires 0.1.3+ for the suspend/cancel/supersede surface: SuspendSession
30
- # /ResumeSession RPCs, SESSION_STATE_SUSPENDED/CANCELLED, the SUSPENDED/
31
- # RESUMED/CANCELLED lifecycle events, and CommitmentPayload.supersedes
32
- # (CommitmentRef). 0.1.2 added the RFC-MACP-0006-A1 subscribe_session_id /
33
- # after_sequence fields on StreamSessionRequest (used by MacpStream
34
- # .send_subscribe and the gRPC agent transport adapter); 0.1.1 is the
35
- # earlier baseline for context_id / extensions on SessionStartPayload.
36
- # See docs/contributing.md "Bumping macp-proto".
37
- "macp-proto>=0.1.3,<0.2.0",
26
+ # macp-proto 0.1.6's gencode was produced by protobuf 7.35.0 / grpc 1.82.0.
27
+ # protobuf enforces this at import time: importing macp.v1.core_pb2 under an
28
+ # older protobuf raises google.protobuf.runtime_version.VersionError
29
+ # ("runtime version cannot be older than the linked gencode version"), so
30
+ # these floors are hard requirements derived from the gencode, not from
31
+ # macp-proto's own (looser) METADATA. This is the consumer-visible bump in
32
+ # SDK 0.5.0 deployments pinned to protobuf 6.x / grpcio < 1.82 cannot
33
+ # straddle it.
34
+ "grpcio>=1.82.0",
35
+ "protobuf>=7.35.0",
36
+ # Requires 0.1.6+ for the runtime v0.5.0 wire surface referenced by the SDK:
37
+ # SessionStartPayload.max_suspend_ms (0.1.5), HandoffAcceptPayload.implicit
38
+ # and ListSessionsRequest.page_size/page_token (0.1.6), and the canonical
39
+ # macp.modes.multi_round.v1.ContributePayload proto encoding (0.1.4).
40
+ # Retains the 0.1.3 surface (suspend/cancel/supersede, subscribe_session_id/
41
+ # after_sequence, context_id/extensions). See docs/contributing.md
42
+ # "Bumping macp-proto".
43
+ "macp-proto>=0.1.6,<0.2.0",
38
44
  ]
39
45
 
46
+ [project.urls]
47
+ Homepage = "https://github.com/multiagentcoordinationprotocol/macp-sdk-python"
48
+ Repository = "https://github.com/multiagentcoordinationprotocol/macp-sdk-python"
49
+ Documentation = "https://github.com/multiagentcoordinationprotocol/macp-sdk-python/tree/main/docs"
50
+ Changelog = "https://github.com/multiagentcoordinationprotocol/macp-sdk-python/blob/main/CHANGELOG.md"
51
+ "Bug Tracker" = "https://github.com/multiagentcoordinationprotocol/macp-sdk-python/issues"
52
+
40
53
  [project.optional-dependencies]
41
54
  dev = [
42
55
  "grpcio-tools>=1.74.0", # only needed for proto-python package publishing
@@ -47,6 +60,7 @@ dev = [
47
60
  "ruff>=0.5",
48
61
  "grpc-stubs>=1.53",
49
62
  "build>=1.0",
63
+ "jsonschema>=4.0", # validate vendored conformance fixtures against schema.json
50
64
  ]
51
65
  docs = [
52
66
  "mkdocs-material>=9.5",
@@ -20,6 +20,7 @@ from .decision import DecisionSession
20
20
  from .envelope import (
21
21
  build_commitment_payload,
22
22
  build_commitment_ref,
23
+ build_contribute_payload,
23
24
  build_envelope,
24
25
  build_progress_payload,
25
26
  build_root,
@@ -183,6 +184,7 @@ __all__ = [
183
184
  "VotingRules",
184
185
  "build_commitment_payload",
185
186
  "build_commitment_ref",
187
+ "build_contribute_payload",
186
188
  "build_decision_policy",
187
189
  "build_envelope",
188
190
  "build_handoff_policy",
@@ -69,6 +69,9 @@ class InitiatorConfig:
69
69
  mode_version: str | None = None
70
70
  configuration_version: str | None = None
71
71
  policy_version: str | None = None
72
+ # Runtime v0.5.0 per-session maximum-suspension cap (ms); 0 = runtime
73
+ # default (currently 7 days). Negative values are rejected at build time.
74
+ max_suspend_ms: int = 0
72
75
  kickoff_message_type: str | None = None
73
76
  kickoff_payload: dict[str, Any] = field(default_factory=dict)
74
77
 
@@ -113,8 +116,13 @@ class ParticipantActions:
113
116
  mode_version: str | None = None,
114
117
  configuration_version: str | None = None,
115
118
  policy_version: str | None = None,
119
+ max_suspend_ms: int = 0,
116
120
  ) -> Any:
117
- """Send a SessionStart envelope to open the session."""
121
+ """Send a SessionStart envelope to open the session.
122
+
123
+ ``max_suspend_ms`` (runtime v0.5.0) binds a per-session maximum
124
+ suspension cap; ``0`` selects the runtime default.
125
+ """
118
126
  from ..constants import (
119
127
  DEFAULT_CONFIGURATION_VERSION,
120
128
  DEFAULT_MODE_VERSION,
@@ -135,6 +143,7 @@ class ParticipantActions:
135
143
  mode_version=mode_version or DEFAULT_MODE_VERSION,
136
144
  configuration_version=configuration_version or DEFAULT_CONFIGURATION_VERSION,
137
145
  policy_version=policy_version or DEFAULT_POLICY_VERSION,
146
+ max_suspend_ms=max_suspend_ms,
138
147
  )
139
148
  envelope = build_envelope(
140
149
  mode=self._mode,
@@ -522,6 +531,7 @@ class Participant:
522
531
  mode_version=cfg.mode_version,
523
532
  configuration_version=cfg.configuration_version,
524
533
  policy_version=cfg.policy_version,
534
+ max_suspend_ms=cfg.max_suspend_ms,
525
535
  )
526
536
  logger.info("SessionStart emitted (session=%s)", self._session_id)
527
537
 
@@ -123,6 +123,11 @@ def from_bootstrap(bootstrap_path: str | None = None) -> Participant:
123
123
  intent=str(ss.get("intent", "")),
124
124
  participants=[str(p) for p in ss.get("participants", participants)],
125
125
  ttl_ms=int(ss.get("ttl_ms", 300000)),
126
+ # Runtime v0.5.0 per-session suspension cap; absent → 0 (runtime
127
+ # default). The TypeScript bootstrap schema does not yet map this
128
+ # key, so it is Python-only for now; a bootstrap that omits it
129
+ # behaves identically in both SDKs.
130
+ max_suspend_ms=int(ss.get("max_suspend_ms", 0)),
126
131
  context_id=str(ss.get("context_id", "")),
127
132
  extensions=_decode_extensions(ss.get("extensions")),
128
133
  roots=ss.get("roots"),
@@ -102,10 +102,17 @@ class BaseSession(ABC):
102
102
  context_id: str = "",
103
103
  extensions: Mapping[str, bytes] | None = None,
104
104
  roots: Iterable[Any] | None = None,
105
+ max_suspend_ms: int = 0,
105
106
  sender: str | None = None,
106
107
  auth: AuthConfig | None = None,
107
108
  ) -> envelope_pb2.Ack:
108
- """Send SessionStart and begin tracking via the projection."""
109
+ """Send SessionStart and begin tracking via the projection.
110
+
111
+ ``max_suspend_ms`` (runtime v0.5.0) binds a per-session maximum
112
+ suspension cap; ``0`` selects the runtime default (currently 7 days).
113
+ A suspension outlasting this cap expires the session
114
+ (``SUSPENDED`` → ``EXPIRED``). Negative values are rejected.
115
+ """
109
116
  validate_participant_count(len(participants))
110
117
  payload = build_session_start_payload(
111
118
  intent=intent,
@@ -117,6 +124,7 @@ class BaseSession(ABC):
117
124
  context_id=context_id,
118
125
  extensions=extensions,
119
126
  roots=roots,
127
+ max_suspend_ms=max_suspend_ms,
120
128
  )
121
129
  envelope = build_envelope(
122
130
  mode=self.MODE,
@@ -138,7 +146,16 @@ class BaseSession(ABC):
138
146
  sender: str | None = None,
139
147
  auth: AuthConfig | None = None,
140
148
  ) -> envelope_pb2.Ack:
141
- """Send Commitment to resolve the session."""
149
+ """Send Commitment to resolve the session.
150
+
151
+ The commitment echoes ``self.policy_version``. Runtime v0.5.0 relaxed
152
+ the match rule (RFC-MACP-0012, change review A3): an **empty**
153
+ ``policy_version`` matches whatever policy the session is bound to, so
154
+ a session started with an empty policy_version no longer has to echo
155
+ ``policy.default``. A **non-empty** value must still equal the
156
+ resolved policy id (e.g. ``policy.default``) or the commitment is
157
+ rejected with ``UNKNOWN_POLICY_VERSION``.
158
+ """
142
159
  payload = build_commitment_payload(
143
160
  action=action,
144
161
  authority_scope=authority_scope,