asap-protocol 0.5.0__py3-none-any.whl → 1.0.0__py3-none-any.whl

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 (59) hide show
  1. asap/__init__.py +1 -1
  2. asap/cli.py +137 -2
  3. asap/examples/README.md +81 -13
  4. asap/examples/auth_patterns.py +212 -0
  5. asap/examples/error_recovery.py +248 -0
  6. asap/examples/long_running.py +287 -0
  7. asap/examples/mcp_integration.py +240 -0
  8. asap/examples/multi_step_workflow.py +134 -0
  9. asap/examples/orchestration.py +293 -0
  10. asap/examples/rate_limiting.py +137 -0
  11. asap/examples/run_demo.py +0 -2
  12. asap/examples/secure_handler.py +84 -0
  13. asap/examples/state_migration.py +240 -0
  14. asap/examples/streaming_response.py +108 -0
  15. asap/examples/websocket_concept.py +129 -0
  16. asap/mcp/__init__.py +43 -0
  17. asap/mcp/client.py +224 -0
  18. asap/mcp/protocol.py +179 -0
  19. asap/mcp/server.py +333 -0
  20. asap/mcp/server_runner.py +40 -0
  21. asap/models/base.py +0 -3
  22. asap/models/constants.py +3 -1
  23. asap/models/entities.py +21 -6
  24. asap/models/envelope.py +7 -0
  25. asap/models/ids.py +8 -4
  26. asap/models/parts.py +33 -3
  27. asap/models/validators.py +16 -0
  28. asap/observability/__init__.py +6 -0
  29. asap/observability/dashboards/README.md +24 -0
  30. asap/observability/dashboards/asap-detailed.json +131 -0
  31. asap/observability/dashboards/asap-red.json +129 -0
  32. asap/observability/logging.py +81 -1
  33. asap/observability/metrics.py +15 -1
  34. asap/observability/trace_parser.py +238 -0
  35. asap/observability/trace_ui.py +218 -0
  36. asap/observability/tracing.py +293 -0
  37. asap/state/machine.py +15 -2
  38. asap/state/snapshot.py +0 -9
  39. asap/testing/__init__.py +31 -0
  40. asap/testing/assertions.py +108 -0
  41. asap/testing/fixtures.py +113 -0
  42. asap/testing/mocks.py +152 -0
  43. asap/transport/__init__.py +28 -0
  44. asap/transport/cache.py +180 -0
  45. asap/transport/circuit_breaker.py +9 -8
  46. asap/transport/client.py +418 -36
  47. asap/transport/compression.py +389 -0
  48. asap/transport/handlers.py +106 -53
  49. asap/transport/middleware.py +58 -34
  50. asap/transport/server.py +429 -139
  51. asap/transport/validators.py +0 -4
  52. asap/utils/sanitization.py +0 -5
  53. asap_protocol-1.0.0.dist-info/METADATA +264 -0
  54. asap_protocol-1.0.0.dist-info/RECORD +70 -0
  55. asap_protocol-0.5.0.dist-info/METADATA +0 -244
  56. asap_protocol-0.5.0.dist-info/RECORD +0 -41
  57. {asap_protocol-0.5.0.dist-info → asap_protocol-1.0.0.dist-info}/WHEEL +0 -0
  58. {asap_protocol-0.5.0.dist-info → asap_protocol-1.0.0.dist-info}/entry_points.txt +0 -0
  59. {asap_protocol-0.5.0.dist-info → asap_protocol-1.0.0.dist-info}/licenses/LICENSE +0 -0
@@ -68,7 +68,6 @@ def validate_envelope_timestamp(envelope: Envelope) -> None:
68
68
  now = datetime.now(timezone.utc)
69
69
  timestamp = envelope.timestamp
70
70
 
71
- # Ensure timestamp is timezone-aware (should be UTC)
72
71
  if timestamp.tzinfo is None:
73
72
  timestamp = timestamp.replace(tzinfo=timezone.utc)
74
73
  else:
@@ -78,7 +77,6 @@ def validate_envelope_timestamp(envelope: Envelope) -> None:
78
77
  # Calculate age in seconds
79
78
  age_seconds = (now - timestamp).total_seconds()
80
79
 
81
- # Check if envelope is too old
82
80
  if age_seconds > MAX_ENVELOPE_AGE_SECONDS:
83
81
  raise InvalidTimestampError(
84
82
  timestamp=timestamp.isoformat(),
@@ -93,7 +91,6 @@ def validate_envelope_timestamp(envelope: Envelope) -> None:
93
91
  },
94
92
  )
95
93
 
96
- # Check if envelope timestamp is too far in the future
97
94
  future_offset_seconds = (timestamp - now).total_seconds()
98
95
  if future_offset_seconds > MAX_FUTURE_TOLERANCE_SECONDS:
99
96
  raise InvalidTimestampError(
@@ -296,7 +293,6 @@ def validate_envelope_nonce(envelope: Envelope, nonce_store: NonceStore | None)
296
293
 
297
294
  nonce = envelope.extensions["nonce"]
298
295
 
299
- # Validate nonce is a non-empty string
300
296
  if not isinstance(nonce, str) or not nonce:
301
297
  raise InvalidNonceError(
302
298
  nonce=str(nonce),
@@ -109,12 +109,9 @@ def sanitize_url(url: str) -> str:
109
109
  try:
110
110
  parsed = urlparse(url)
111
111
  if (parsed.username or parsed.password) and parsed.password:
112
- # Mask password if present
113
- # Reconstruct netloc with masked password
114
112
  netloc = f"{parsed.username}:***@{parsed.hostname}"
115
113
  if parsed.port:
116
114
  netloc = f"{netloc}:{parsed.port}"
117
- # Reconstruct URL with sanitized netloc
118
115
  return urlunparse(
119
116
  (
120
117
  parsed.scheme,
@@ -127,8 +124,6 @@ def sanitize_url(url: str) -> str:
127
124
  )
128
125
  return url
129
126
  except Exception:
130
- # If URL parsing fails, return a safe fallback
131
- # Remove any obvious credential patterns
132
127
  return re.sub(r"://[^:]+:[^@]+@", r"://***:***@", url)
133
128
 
134
129
 
@@ -0,0 +1,264 @@
1
+ Metadata-Version: 2.4
2
+ Name: asap-protocol
3
+ Version: 1.0.0
4
+ Summary: Async Simple Agent Protocol - A streamlined protocol for agent-to-agent communication
5
+ Project-URL: Homepage, https://github.com/adriannoes/asap-protocol
6
+ Project-URL: Documentation, https://adriannoes.github.io/asap-protocol
7
+ Project-URL: Repository, https://github.com/adriannoes/asap-protocol
8
+ Project-URL: Issues, https://github.com/adriannoes/asap-protocol/issues
9
+ Project-URL: PyPI, https://pypi.org/project/asap-protocol/
10
+ Author: ASAP Protocol Contributors
11
+ License: Apache-2.0
12
+ License-File: LICENSE
13
+ Keywords: a2a,agent,async,communication,mcp,protocol
14
+ Classifier: Development Status :: 5 - Production/Stable
15
+ Classifier: Intended Audience :: Developers
16
+ Classifier: License :: OSI Approved :: Apache Software License
17
+ Classifier: Programming Language :: Python :: 3
18
+ Classifier: Programming Language :: Python :: 3.13
19
+ Classifier: Topic :: Software Development :: Libraries :: Python Modules
20
+ Classifier: Topic :: System :: Distributed Computing
21
+ Classifier: Typing :: Typed
22
+ Requires-Python: >=3.13
23
+ Requires-Dist: brotli>=1.2.0
24
+ Requires-Dist: fastapi>=0.128.0
25
+ Requires-Dist: httpx[http2]>=0.28.1
26
+ Requires-Dist: jsonschema>=4.23.0
27
+ Requires-Dist: opentelemetry-api>=1.20
28
+ Requires-Dist: opentelemetry-exporter-otlp-proto-grpc>=1.20
29
+ Requires-Dist: opentelemetry-instrumentation-fastapi>=0.41
30
+ Requires-Dist: opentelemetry-instrumentation-httpx>=0.41
31
+ Requires-Dist: opentelemetry-sdk>=1.20
32
+ Requires-Dist: packaging>=25.0
33
+ Requires-Dist: pydantic>=2.12.5
34
+ Requires-Dist: python-ulid>=3.0
35
+ Requires-Dist: slowapi>=0.1.9
36
+ Requires-Dist: structlog>=24.1
37
+ Requires-Dist: typer>=0.21.1
38
+ Requires-Dist: uvicorn>=0.34
39
+ Requires-Dist: watchfiles>=0.21.0
40
+ Provides-Extra: dev
41
+ Requires-Dist: brotli>=1.1.0; extra == 'dev'
42
+ Requires-Dist: mypy>=1.19.1; extra == 'dev'
43
+ Requires-Dist: pip-audit>=2.7; extra == 'dev'
44
+ Requires-Dist: pytest-asyncio>=0.24; extra == 'dev'
45
+ Requires-Dist: pytest-benchmark>=5.1; extra == 'dev'
46
+ Requires-Dist: pytest-cov>=6.0; extra == 'dev'
47
+ Requires-Dist: pytest-xdist>=3.5.0; extra == 'dev'
48
+ Requires-Dist: pytest>=8.0; extra == 'dev'
49
+ Requires-Dist: ruff>=0.14.14; extra == 'dev'
50
+ Requires-Dist: types-jsonschema>=4.0.0; extra == 'dev'
51
+ Provides-Extra: docs
52
+ Requires-Dist: mkdocs-material>=9.5; extra == 'docs'
53
+ Requires-Dist: mkdocstrings[python]>=0.27; extra == 'docs'
54
+ Description-Content-Type: text/markdown
55
+
56
+ # ASAP: Async Simple Agent Protocol
57
+
58
+ ![ASAP Protocol Banner](https://raw.githubusercontent.com/adriannoes/asap-protocol/main/.github/assets/asap-protocol-banner.png)
59
+
60
+
61
+ > A streamlined, scalable, asynchronous protocol for agent-to-agent communication and task coordination. Built as a simpler, more powerful alternative to A2A with native MCP integration and stateful orchestration.
62
+
63
+ **Quick Info**: `v1.0.0` | `Apache 2.0` | `Python 3.13+` | [Documentation](https://github.com/adriannoes/asap-protocol/blob/main/docs/index.md) | [PyPI](https://pypi.org/project/asap-protocol/1.0.0/) | [Changelog](https://github.com/adriannoes/asap-protocol/blob/main/CHANGELOG.md)
64
+
65
+ **Stable** — ASAP Protocol v1.0.0 is production-ready. We welcome feedback and contributions. See our [Contributing](https://github.com/adriannoes/asap-protocol#contributing) section to get involved!
66
+
67
+ ## Why ASAP?
68
+
69
+ Building multi-agent systems today suffers from three core technical challenges that existing protocols like A2A don't fully address:
70
+ 1. **$N^2$ Connection Complexity**: Most protocols assume static point-to-point HTTP connections that don't scale.
71
+ 2. **State Drift**: Lack of native persistence makes it impossible to reliably resume long-running agentic workflows.
72
+ 3. **Fragmentation**: No unified way to handle task delegation, artifact exchange, and tool execution (MCP) in a single envelope.
73
+
74
+ **ASAP** provides a production-ready communication layer that simplifies these complexities. It introduces a standardized, stateful orchestration framework that ensures your agents can coordinate reliably across distributed environments. → [Spec](https://github.com/adriannoes/asap-protocol/blob/main/.cursor/product-specs/v0-original-specs.md)
75
+
76
+ ### Key Features
77
+
78
+ - **Stateful orchestration** — Task state machine with snapshotting for resumable workflows.
79
+ - **Schema-first** — Pydantic v2 + JSON Schema for cross-agent interoperability.
80
+ - **Async-native** — `asyncio` + `httpx`; sync and async handlers supported.
81
+ - **MCP integration** — Tool execution and coordination in a single envelope.
82
+ - **Observable** — `trace_id` and `correlation_id` for debugging.
83
+ - **Security (v1.0.0)** — Bearer auth, replay prevention, HTTPS, rate limiting (100 req/min). Opt-in.
84
+
85
+ ## Installation
86
+
87
+ We recommend using [uv](https://github.com/astral-sh/uv) for dependency management:
88
+
89
+ ```bash
90
+ uv add asap-protocol
91
+ ```
92
+
93
+ Or with pip:
94
+
95
+ ```bash
96
+ pip install asap-protocol
97
+ ```
98
+
99
+ 📦 **Available on [PyPI](https://pypi.org/project/asap-protocol/1.0.0/)**
100
+
101
+ For reproducible environments, prefer `uv` when possible.
102
+
103
+ ## Requirements
104
+
105
+ - **Python**: 3.13 or higher
106
+ - **Dependencies**: Automatically installed via `uv` or `pip`
107
+ - **Optional**: For development, see [Contributing](https://github.com/adriannoes/asap-protocol/blob/main/CONTRIBUTING.md).
108
+
109
+ ## Quick Start
110
+
111
+ ### 1. Create an Agent (Server)
112
+
113
+ ```python
114
+ from asap.models.entities import Capability, Endpoint, Manifest, Skill
115
+ from asap.transport.handlers import HandlerRegistry, create_echo_handler
116
+ from asap.transport.server import create_app
117
+
118
+ manifest = Manifest(
119
+ id="urn:asap:agent:echo-agent",
120
+ name="Echo Agent",
121
+ version="1.0.0",
122
+ description="Echoes task input as output",
123
+ capabilities=Capability(
124
+ asap_version="0.1",
125
+ skills=[Skill(id="echo", description="Echo back the input")],
126
+ state_persistence=False,
127
+ ),
128
+ # Development: HTTP localhost is allowed
129
+ # Production: Always use HTTPS (e.g., "https://api.example.com/asap")
130
+ endpoints=Endpoint(asap="http://127.0.0.1:8001/asap"),
131
+ )
132
+
133
+ registry = HandlerRegistry()
134
+ registry.register("task.request", create_echo_handler())
135
+
136
+ app = create_app(manifest, registry)
137
+ ```
138
+
139
+ ### 2. Send a Task (Client)
140
+
141
+ ```python
142
+ import asyncio
143
+ from asap.models.envelope import Envelope
144
+ from asap.models.payloads import TaskRequest
145
+ from asap.transport.client import ASAPClient
146
+
147
+ async def main():
148
+ request = TaskRequest(
149
+ conversation_id="conv_01HX5K3MQVN8",
150
+ skill_id="echo",
151
+ input={"message": "hello from client"},
152
+ )
153
+ envelope = Envelope(
154
+ asap_version="0.1",
155
+ sender="urn:asap:agent:client",
156
+ recipient="urn:asap:agent:echo-agent",
157
+ payload_type="task.request",
158
+ payload=request.model_dump(),
159
+ )
160
+ # Development: HTTP localhost is allowed (with warning)
161
+ # Production: Always use HTTPS (e.g., "https://api.example.com")
162
+ async with ASAPClient("http://127.0.0.1:8001") as client:
163
+ response = await client.send(envelope)
164
+ print(response.payload)
165
+
166
+ if __name__ == "__main__":
167
+ asyncio.run(main())
168
+ ```
169
+
170
+ ## Try it
171
+
172
+ **Run the multi-agent demo** (echo agent + coordinator, one round-trip):
173
+
174
+ ```bash
175
+ uv run python -m asap.examples.run_demo
176
+ ```
177
+
178
+ **Run any of 14+ examples** (auth, MCP, state migration, etc.):
179
+
180
+ ```bash
181
+ uv run python -m asap.examples.<module_name> [options]
182
+ ```
183
+
184
+ → Full list: [Examples README](https://github.com/adriannoes/asap-protocol/blob/main/src/asap/examples/README.md)
185
+
186
+ | Category | Examples |
187
+ |----------|----------|
188
+ | **Core** | `run_demo`, `echo_agent`, `coordinator`, `secure_handler` |
189
+ | **Orchestration** | `orchestration` (multi-agent, task coordination, state tracking) |
190
+ | **State** | `long_running` (checkpoints, resume after crash), `state_migration` (move state between agents) |
191
+ | **Resilience** | `error_recovery` (retry, circuit breaker, fallback) |
192
+ | **Integration** | `mcp_integration` (MCP tools via envelopes) |
193
+ | **Auth & limits** | `auth_patterns` (Bearer, validators, OAuth2 concept), `rate_limiting` (per-sender, per-endpoint) |
194
+ | **Concepts** | `websocket_concept` (WebSocket design), `streaming_response` (TaskUpdate streaming), `multi_step_workflow` (pipeline) |
195
+
196
+ ## Testing
197
+
198
+ ```bash
199
+ uv run pytest -n auto --tb=short
200
+ ```
201
+
202
+ With coverage:
203
+
204
+ ```bash
205
+ uv run pytest --cov=src --cov-report=term-missing
206
+ ```
207
+
208
+ → [Testing Guide](https://github.com/adriannoes/asap-protocol/blob/main/docs/testing.md) — structure, fixtures, property/load/chaos tests
209
+ → [Contributing](https://github.com/adriannoes/asap-protocol/blob/main/CONTRIBUTING.md) — dev setup, CI
210
+
211
+ ## Benchmarks
212
+
213
+ → [Benchmark Results](https://github.com/adriannoes/asap-protocol/blob/main/benchmarks/RESULTS.md) — Load (1,500+ RPS), stress, memory
214
+
215
+ ## API Overview
216
+
217
+ Core models: `Envelope`, `TaskRequest`/`TaskResponse`/`TaskUpdate`/`TaskCancel`, `MessageSend`, `ArtifactNotify`, `StateQuery`/`StateRestore`, `McpToolCall`/`McpToolResult`/`McpResourceFetch`/`McpResourceData`. → [API Reference](https://github.com/adriannoes/asap-protocol/blob/main/docs/api-reference.md)
218
+
219
+ Transport: `create_app`, `HandlerRegistry`, `ASAPClient`. → [Transport](https://github.com/adriannoes/asap-protocol/blob/main/docs/transport.md)
220
+
221
+ ## When to Use ASAP?
222
+
223
+ ASAP is ideal for:
224
+ - **Multi-agent orchestration**: Coordinate tasks across multiple AI agents
225
+ - **Stateful workflows**: Long-running tasks that need persistence and resumability
226
+ - **MCP integration**: Agents that need to execute tools via Model Context Protocol
227
+ - **Production systems**: High-performance, type-safe agent communication
228
+
229
+ If you're building simple point-to-point agent communication, a basic HTTP API might suffice. ASAP shines when you need orchestration, state management and multi-agent coordination.
230
+
231
+ ## Documentation
232
+
233
+ **Learn**
234
+ - [Docs](https://github.com/adriannoes/asap-protocol/blob/main/docs/index.md) | [API Reference](https://github.com/adriannoes/asap-protocol/blob/main/docs/api-reference.md)
235
+ - [Tutorials](https://github.com/adriannoes/asap-protocol/tree/main/docs/tutorials) — First agent → production checklist
236
+ - [Migration from A2A/MCP](https://github.com/adriannoes/asap-protocol/blob/main/docs/migration.md)
237
+
238
+ **Deep dive**
239
+ - [State Management](https://github.com/adriannoes/asap-protocol/blob/main/docs/state-management.md) | [Error Handling](https://github.com/adriannoes/asap-protocol/blob/main/docs/error-handling.md)
240
+ - [Transport](https://github.com/adriannoes/asap-protocol/blob/main/docs/transport.md) | [Security](https://github.com/adriannoes/asap-protocol/blob/main/docs/security.md)
241
+ - [Observability](https://github.com/adriannoes/asap-protocol/blob/main/docs/observability.md) | [Testing](https://github.com/adriannoes/asap-protocol/blob/main/docs/testing.md)
242
+
243
+ **Decisions & ops**
244
+ - [ADRs](https://github.com/adriannoes/asap-protocol/tree/main/docs/adr) — 17 Architecture Decision Records
245
+ - [Deployment](https://github.com/adriannoes/asap-protocol/blob/main/docs/deployment/kubernetes.md) | [Troubleshooting](https://github.com/adriannoes/asap-protocol/blob/main/docs/troubleshooting.md)
246
+
247
+ **Release**
248
+ - [Changelog](https://github.com/adriannoes/asap-protocol/blob/main/CHANGELOG.md) | [PyPI](https://pypi.org/project/asap-protocol/1.0.0/)
249
+
250
+ ## CLI
251
+
252
+ `asap --version` | `asap export-schemas` | `asap list-schemas` | `asap show-schema` — [CLI docs](https://github.com/adriannoes/asap-protocol/blob/main/docs/index.md#cli) or `asap --help`
253
+
254
+ ## Contributing
255
+
256
+ We love contributions! Whether it's fixing a bug, improving documentation or proposing a new feature.. your help is welcome.
257
+
258
+ **Community feedback and contributions are essential** for ASAP Protocol's evolution. We're actively working on improvements and your input helps shape the future of the protocol. Every contribution, from bug reports to feature suggestions, documentation improvements and code contributions, makes a real difference.
259
+
260
+ Check out our [Contributing Guidelines](https://github.com/adriannoes/asap-protocol/blob/main/CONTRIBUTING.md) to get started. It's easier than you think! 🚀
261
+
262
+ ## License
263
+
264
+ This project is licensed under the Apache 2.0 License - see the [LICENSE](https://github.com/adriannoes/asap-protocol/blob/main/LICENSE) file for details.
@@ -0,0 +1,70 @@
1
+ asap/__init__.py,sha256=K2PhO3EHYthoYxUJgjZEPt_E1c8Uh0Kt2YO3fNa5_fI,169
2
+ asap/cli.py,sha256=1mpk6BdApazJCWY_w5OJQOdcmvmBD9V-ztBVhmAf--I,11280
3
+ asap/errors.py,sha256=pc4QQfseteEujGp3bDH-IiPpr-xh1N6DvDL5faiFY9M,11917
4
+ asap/schemas.py,sha256=c9MttEoI4mgXFHDFzphSRAJhw7cpy2rcnXH31jlo1sQ,6135
5
+ asap/examples/README.md,sha256=ydk02C1tjzSZU3W5yfTgT89tuC5S6BjmzIMu4uiMDMg,4460
6
+ asap/examples/__init__.py,sha256=LaEkmPQ4tpYrkLFjBE_aodjW3_XUcKWoFLGVFD5kuvo,56
7
+ asap/examples/auth_patterns.py,sha256=OC-NOfX3q8-TbJn5Zk-SfbGw52h3hAKwELbMScyXcFw,7171
8
+ asap/examples/coordinator.py,sha256=C5Ugi47PGwtbRao8eD29v2l_9tww2_sL-kXK5jQaWGw,5370
9
+ asap/examples/echo_agent.py,sha256=cmNjEx28jCNcU4waYFOZ8ZcHxth1znMOhmaGXIquJzA,2947
10
+ asap/examples/error_recovery.py,sha256=LI-8ediOqSfoddjgUgvycs28Hk9K-d6uxZq9nRJO2Rk,7822
11
+ asap/examples/long_running.py,sha256=0DGLHsjbOoYU_aUetjPiV3PUzo6Xn-DybmHbI45ajJQ,8841
12
+ asap/examples/mcp_integration.py,sha256=rkKja6kAFnGje2lQMStLybfDi7M3s-0yDId-llhz7aU,7943
13
+ asap/examples/multi_step_workflow.py,sha256=XsVAaqhFCfOktahV1Qcyp7pyr4JusKAjH48V9QrYaYk,4070
14
+ asap/examples/orchestration.py,sha256=idTIDsgoO0WqFCysi58z3NnfQJa5gMhDLTRMGDZcVSo,9904
15
+ asap/examples/rate_limiting.py,sha256=WfETgDsPCB82TxDrFutfDShKlCm_WXrW9P5TWlQogic,4452
16
+ asap/examples/run_demo.py,sha256=kxCsCrX3i34bqc_nsy_QtnBG8FxgC4Hwkyz5JNP8cmo,3953
17
+ asap/examples/secure_handler.py,sha256=SmrgRc0Ntw3FGaip18OwzJIKtrjCvGChNSjMG7tJeZA,3138
18
+ asap/examples/state_migration.py,sha256=IS7P5gbnpuBLJ4OAb__IHLtA3OgkBmGaUPPWI8JI2fk,7915
19
+ asap/examples/streaming_response.py,sha256=Jh-8F6QsEal-xbsk3mSJs_LwacLsegp7sXikqCAe9mY,3254
20
+ asap/examples/websocket_concept.py,sha256=l96gvdEVxZ5yyDZn4fQR3M-a_-zUX4e60eOhljkRRRU,5159
21
+ asap/mcp/__init__.py,sha256=u_F-o9ZlleraUbOo05zkRpZrW06mpuxnO_uFVA22Dr8,1121
22
+ asap/mcp/client.py,sha256=qt71Q1eEkRWrymlz4LKZ3GfMYe8r5Ho2n3TigfGMobk,7958
23
+ asap/mcp/protocol.py,sha256=EwStOJP0Tf7ga6iWGeejD7kNBdV7lbPB4mZnREVEGQ4,5438
24
+ asap/mcp/server.py,sha256=8LnjcloGTp3sH_HsKgeylgo1r97TpU33WZqgc0G_0sc,12458
25
+ asap/mcp/server_runner.py,sha256=cGH3AyiQ3v7SzizwPNMOUSV-TCrI2Az4sudUzFOwKNU,1011
26
+ asap/models/__init__.py,sha256=c9TDscYv-_2U8OlEt7G-Il02flISgGbckZu4RtDwgDk,2643
27
+ asap/models/base.py,sha256=BVydcmBLDU2hD7SzjfROcm1njeqTG82OARMUH5y4wlY,1863
28
+ asap/models/constants.py,sha256=nDlUALrkWM3bKv-MUzqbvJZyJhRXp1bF3vvGa8IDKG8,3271
29
+ asap/models/entities.py,sha256=bePFLqCR7Ikg-cfVqt6U94xOvDAvhriw4lnQiBEYOWU,18342
30
+ asap/models/enums.py,sha256=q8tnW10AT94hxDFoH1Psg1a1x4tzs47x12N7RTGLNRQ,1644
31
+ asap/models/envelope.py,sha256=qVBVQh7nnFURlSz1LbXPXn2EmL4kRcJ28-MkHURhlZA,4297
32
+ asap/models/ids.py,sha256=w8A3SNUkEB_U80C6F4kL30yB9-THh-okVD-wTqCkQZQ,1807
33
+ asap/models/parts.py,sha256=0QxwQJndIPpjOkJ5BCvj6SCRX6hyIxVAIdc4DXGfEu0,7978
34
+ asap/models/payloads.py,sha256=l0taURdWy09BASSJkiCrR6VixbqzD3HrFdVrFad7YqQ,14867
35
+ asap/models/types.py,sha256=ldWyz6gThlK_cxywxfcIiMLD74_BRV0lbfyussvSURg,978
36
+ asap/models/validators.py,sha256=xbLMzP_vao64m-SpM00nBFhWnI7aPUdlOYiSfRZd7Ps,563
37
+ asap/observability/__init__.py,sha256=jJZ3-9OCFjtmb_erz54Gh1bZRGQAeBh8vT71ZnamffQ,1287
38
+ asap/observability/logging.py,sha256=j8pGL_KISvflyYE3koEISu6afp-9khl5HOgVDnR_Y-U,9603
39
+ asap/observability/metrics.py,sha256=YgDJaEF8wsTxEphuBTMP5sNgIH0XtTQOyTd1OVxuK9U,15952
40
+ asap/observability/trace_parser.py,sha256=U4bGYEGA9Z-oNr2Uk94eXztXKDmBeGtY-7w1zl9QQBM,7874
41
+ asap/observability/trace_ui.py,sha256=4gHR2rdo8qEKW4dSBF78bgcIhyfEX3fTVeuXsjf8YS4,7621
42
+ asap/observability/tracing.py,sha256=2adDzwYLbOoitBLUJcXlwCrkoIjduR9b7Jjmiv9a52c,9945
43
+ asap/observability/dashboards/README.md,sha256=lyZ_jyuDKvmiGdLYmWQ_iJzV-bjIdfTpzXDJKmNVQOI,1208
44
+ asap/observability/dashboards/asap-detailed.json,sha256=W6h9BKK3Ss9WHIJXcpQw5U5t2KMcaXl1-_Ghe0jCFyA,5354
45
+ asap/observability/dashboards/asap-red.json,sha256=5nPUkm9ZI88val6cWlsCsNT1ni0qz140DFRn8FMqfpM,5231
46
+ asap/state/__init__.py,sha256=bV1oO86TReF48C5IaglNr8WHczzAWTpw3n7SyDw04nk,565
47
+ asap/state/machine.py,sha256=p5qdA_z3VhiLU448O5WOoBiUsSPPc42JYYAjHHO6fWI,3246
48
+ asap/state/snapshot.py,sha256=INbjRtfsLLXFkbgIySvgG3nKsKAdjPIeCB6gaT6DqtY,8318
49
+ asap/testing/__init__.py,sha256=EQV8-cYvM__NT_0rA3nPvz4_RlRTpIYKzqhGEtpdQhM,1009
50
+ asap/testing/assertions.py,sha256=4KumraQSBolb9db3J4P3rZOT_1JRyS9dLqI4hhbBHDc,4149
51
+ asap/testing/fixtures.py,sha256=OVfsfrgs1P1I2GjsNByKOssOXENwf-nDm2lPV6vZY-A,3114
52
+ asap/testing/mocks.py,sha256=AcCcI3fKKXwpf1nvGR2NZt2RBkCxIhBhJ1dO6ZxzEWc,5045
53
+ asap/transport/__init__.py,sha256=g-A04M9BsDeVF5TCBNcFgFIpJOlRmljs67M8RV8yGK0,3289
54
+ asap/transport/cache.py,sha256=2ccVU9Ki2xn6Yl-mVQ9fqOnWCCqD9VEHtkAAi2OsdxU,5583
55
+ asap/transport/circuit_breaker.py,sha256=8MdEpJqbhpIFdXorpycQIbtnGrTeOdORwfBgT4M9MrU,6302
56
+ asap/transport/client.py,sha256=XX-EZvanEKzfrUHnTjF5_TYVyE3k1gNg5Ki6wKpg_C0,59163
57
+ asap/transport/compression.py,sha256=XGeO1rNURMDqYHDFOI5z3KOrRc06v4LnCtnveZu_eN8,11746
58
+ asap/transport/executors.py,sha256=0UH2cd5fVPGPGtnzmnFq1W8IF9BLjp5grCz3Oucj7CQ,5737
59
+ asap/transport/handlers.py,sha256=AZOTQppMiDHqnPqaz8fenq0SmEc3130gXLP-zspEufY,17794
60
+ asap/transport/jsonrpc.py,sha256=Cnh6ahoXr4Dkmt2KqoXESDKKs_9MwfsgIjn-TDjpkEQ,5800
61
+ asap/transport/middleware.py,sha256=s9PXq4pnTC6fwiME7Tc1h89r-7qJ61luhxyxZJnE6nw,24435
62
+ asap/transport/server.py,sha256=eZDPjbO7axJVKzfvIOCdsAlwyJtNAjIAUl3X-uY0s0s,58103
63
+ asap/transport/validators.py,sha256=UgP13IaLBraRAy4yCqJOymh9EUnXT3OVWBLHDjrefGM,10847
64
+ asap/utils/__init__.py,sha256=aWEjhGOgrzvBjvMVW1Dg5yJH_xixaOqrsilNdU7zz4A,206
65
+ asap/utils/sanitization.py,sha256=Quv9TxVimiD7Ho1RV2RC-LukQgjORNHcbIqXBVQe2cQ,4056
66
+ asap_protocol-1.0.0.dist-info/METADATA,sha256=5-raewZ-1lFgJc5h_Re2GE-R9PevPTlJs4MQ3C59e-4,12087
67
+ asap_protocol-1.0.0.dist-info/WHEEL,sha256=WLgqFyCfm_KASv4WHyYy0P3pM_m7J5L9k2skdKLirC8,87
68
+ asap_protocol-1.0.0.dist-info/entry_points.txt,sha256=H_u_JamRG5mGQTXwnCFljBFep6lZPuln9NPLfgq1naM,39
69
+ asap_protocol-1.0.0.dist-info/licenses/LICENSE,sha256=JmjzvAfg8BUP_0y_hu4SQSUgnSniWe2eBS7x2WPTo2A,10771
70
+ asap_protocol-1.0.0.dist-info/RECORD,,
@@ -1,244 +0,0 @@
1
- Metadata-Version: 2.4
2
- Name: asap-protocol
3
- Version: 0.5.0
4
- Summary: Async Simple Agent Protocol - A streamlined protocol for agent-to-agent communication
5
- Project-URL: Homepage, https://github.com/adriannoes/asap-protocol
6
- Project-URL: Documentation, https://adriannoes.github.io/asap-protocol
7
- Project-URL: Repository, https://github.com/adriannoes/asap-protocol
8
- Project-URL: Issues, https://github.com/adriannoes/asap-protocol/issues
9
- Project-URL: PyPI, https://pypi.org/project/asap-protocol/
10
- Author: ASAP Protocol Contributors
11
- License: Apache-2.0
12
- License-File: LICENSE
13
- Keywords: a2a,agent,async,communication,mcp,protocol
14
- Classifier: Development Status :: 3 - Alpha
15
- Classifier: Intended Audience :: Developers
16
- Classifier: License :: OSI Approved :: Apache Software License
17
- Classifier: Programming Language :: Python :: 3
18
- Classifier: Programming Language :: Python :: 3.13
19
- Classifier: Topic :: Software Development :: Libraries :: Python Modules
20
- Classifier: Topic :: System :: Distributed Computing
21
- Classifier: Typing :: Typed
22
- Requires-Python: >=3.13
23
- Requires-Dist: fastapi>=0.128.0
24
- Requires-Dist: httpx>=0.28.1
25
- Requires-Dist: packaging>=25.0
26
- Requires-Dist: pydantic>=2.12.5
27
- Requires-Dist: python-ulid>=3.0
28
- Requires-Dist: slowapi>=0.1.9
29
- Requires-Dist: structlog>=24.1
30
- Requires-Dist: typer>=0.21.1
31
- Requires-Dist: uvicorn>=0.34
32
- Provides-Extra: dev
33
- Requires-Dist: mypy>=1.19.1; extra == 'dev'
34
- Requires-Dist: pip-audit>=2.7; extra == 'dev'
35
- Requires-Dist: pytest-asyncio>=0.24; extra == 'dev'
36
- Requires-Dist: pytest-benchmark>=5.1; extra == 'dev'
37
- Requires-Dist: pytest-cov>=6.0; extra == 'dev'
38
- Requires-Dist: pytest-xdist>=3.5.0; extra == 'dev'
39
- Requires-Dist: pytest>=8.0; extra == 'dev'
40
- Requires-Dist: ruff>=0.14.14; extra == 'dev'
41
- Provides-Extra: docs
42
- Requires-Dist: mkdocs-material>=9.5; extra == 'docs'
43
- Requires-Dist: mkdocstrings[python]>=0.27; extra == 'docs'
44
- Description-Content-Type: text/markdown
45
-
46
- # ASAP: Async Simple Agent Protocol
47
-
48
- ![ASAP Protocol Banner](.cursor/docs/asap-protocol-banner.png)
49
-
50
- > A streamlined, scalable, asynchronous protocol for agent-to-agent communication and task coordination. Built as a simpler, more powerful alternative to A2A with native MCP integration and stateful orchestration.
51
-
52
- **Quick Info**: `v0.5.0` | `Apache 2.0` | `Python 3.13+` | [Documentation](docs/index.md) | [PyPI](https://pypi.org/project/asap-protocol/) | [Changelog](CHANGELOG.md)
53
-
54
- ⚠️ **Alpha Release**: ASAP Protocol is currently in **alpha** (v0.5.0). We're actively developing and improving the protocol based on real-world usage. Your feedback, contributions, and suggestions are essential to help us evolve and make ASAP better for the entire community. See our [Contributing](#contributing) section to get involved!
55
-
56
- ## Why ASAP?
57
-
58
- Building multi-agent systems today suffers from three core technical challenges that existing protocols like A2A don't fully address:
59
- 1. **$N^2$ Connection Complexity**: Most protocols assume static point-to-point HTTP connections that don't scale.
60
- 2. **State Drift**: Lack of native persistence makes it impossible to reliably resume long-running agentic workflows.
61
- 3. **Fragmentation**: No unified way to handle task delegation, artifact exchange, and tool execution (MCP) in a single envelope.
62
-
63
- **ASAP** provides a production-ready communication layer that simplifies these complexities. It introduces a standardized, stateful orchestration framework that ensures your agents can coordinate reliably across distributed environments.
64
-
65
- ### Security-First Design
66
-
67
- v0.5.0 introduces comprehensive security hardening:
68
- - **Authentication**: Bearer token authentication with configurable token validators
69
- - **Replay Attack Prevention**: Timestamp validation (5-minute window) and optional nonce tracking
70
- - **DoS Protection**: Built-in rate limiting (100 req/min), request size limits (10MB), and thread pool bounds
71
- - **HTTPS Enforcement**: Client-side HTTPS validation in production mode
72
- - **Secure Logging**: Automatic sanitization of sensitive data (tokens, credentials, nonces) in logs
73
- - **Input Validation**: Strict schema validation with Pydantic v2 for all incoming requests
74
-
75
- All security features are **opt-in** to maintain backward compatibility with existing deployments.
76
-
77
- ### Key Features
78
-
79
- - **Stateful Orchestration**: Native task state machine with built-in snapshotting for durable, resumable agent workflows.
80
- - **Schema-First Design**: Strict Pydantic v2 models providing automatic JSON Schema generation for guaranteed cross-agent interoperability.
81
- - **High-Performance Core**: Built on Python 3.13+, leveraging `uvloop` (C) and `pydantic-core` (Rust) for ultra-low latency validation and I/O.
82
- - **Observable Chains**: First-class support for `trace_id` and `correlation_id` to debug complex multi-agent delegation.
83
- - **MCP Integration**: Uses the Model Context Protocol (MCP) as a tool-execution substrate, wrapped in a high-level coordination envelope.
84
- - **Async-Native**: Engineered from the ground up for high-concurrency environments using `asyncio` and `httpx`. Supports both sync and async handlers with automatic event loop management.
85
- - **Security-Hardened (v0.5.0)**: Authentication (Bearer tokens), replay attack prevention (timestamp + nonce validation), HTTPS enforcement, secure logging, and comprehensive input validation. All security features are opt-in for backward compatibility.
86
- - **DoS Protection**: Built-in rate limiting (100 req/min), request size limits (10MB), and thread pool bounds to prevent resource exhaustion attacks.
87
-
88
- 💡 **Performance Note**: Pure Python codebase leveraging Rust-accelerated dependencies (`pydantic-core`, `orjson`, `python-ulid`) for native-level performance without build complexity.
89
-
90
- ## Installation
91
-
92
- We recommend using [uv](https://github.com/astral-sh/uv) for dependency management:
93
-
94
- ```bash
95
- uv add asap-protocol
96
- ```
97
-
98
- Or with pip:
99
-
100
- ```bash
101
- pip install asap-protocol
102
- ```
103
-
104
- 📦 **Available on [PyPI](https://pypi.org/project/asap-protocol/)**
105
-
106
- For reproducible environments, prefer `uv` when possible.
107
-
108
- ## Requirements
109
-
110
- - **Python**: 3.13 or higher
111
- - **Dependencies**: Automatically installed via `uv` or `pip`
112
- - **Optional**: For development, see [Contributing](CONTRIBUTING.md)
113
-
114
- ## Quick Start
115
-
116
- ### 1. Create an Agent (Server)
117
-
118
- ```python
119
- from asap.models.entities import Capability, Endpoint, Manifest, Skill
120
- from asap.transport.handlers import HandlerRegistry, create_echo_handler
121
- from asap.transport.server import create_app
122
-
123
- manifest = Manifest(
124
- id="urn:asap:agent:echo-agent",
125
- name="Echo Agent",
126
- version="0.5.0",
127
- description="Echoes task input as output",
128
- capabilities=Capability(
129
- asap_version="0.1",
130
- skills=[Skill(id="echo", description="Echo back the input")],
131
- state_persistence=False,
132
- ),
133
- # Development: HTTP localhost is allowed
134
- # Production: Always use HTTPS (e.g., "https://api.example.com/asap")
135
- endpoints=Endpoint(asap="http://127.0.0.1:8001/asap"),
136
- )
137
-
138
- registry = HandlerRegistry()
139
- registry.register("task.request", create_echo_handler())
140
-
141
- app = create_app(manifest, registry)
142
- ```
143
-
144
- ### 2. Send a Task (Client)
145
-
146
- ```python
147
- import asyncio
148
- from asap.models.envelope import Envelope
149
- from asap.models.payloads import TaskRequest
150
- from asap.transport.client import ASAPClient
151
-
152
- async def main():
153
- request = TaskRequest(
154
- conversation_id="conv_01HX5K3MQVN8",
155
- skill_id="echo",
156
- input={"message": "hello from client"},
157
- )
158
- envelope = Envelope(
159
- asap_version="0.1",
160
- sender="urn:asap:agent:client",
161
- recipient="urn:asap:agent:echo-agent",
162
- payload_type="task.request",
163
- payload=request.model_dump(),
164
- )
165
- # Development: HTTP localhost is allowed (with warning)
166
- # Production: Always use HTTPS (e.g., "https://api.example.com")
167
- async with ASAPClient("http://127.0.0.1:8001") as client:
168
- response = await client.send(envelope)
169
- print(response.payload)
170
-
171
- if __name__ == "__main__":
172
- asyncio.run(main())
173
- ```
174
-
175
- ## API Overview
176
-
177
- Core models:
178
-
179
- - `Envelope`: protocol wrapper with routing and tracing metadata
180
- - `TaskRequest`, `TaskResponse`, `TaskUpdate`, `TaskCancel`: task lifecycle payloads
181
- - `MessageSend`, `ArtifactNotify`: messaging and artifacts
182
- - `StateQuery`, `StateRestore`: snapshot state operations
183
- - `McpToolCall`, `McpToolResult`, `McpResourceFetch`, `McpResourceData`: MCP integration
184
-
185
- Transport:
186
-
187
- - `create_app`: FastAPI application factory
188
- - `HandlerRegistry`: payload dispatch registry (supports both sync and async handlers)
189
- - `ASAPClient`: async HTTP client with automatic retry for server errors (5xx)
190
-
191
- ## Documentation
192
-
193
- - [Spec](.cursor/docs/general-specs.md)
194
- - [Docs](docs/index.md)
195
- - [API Reference](docs/api-reference.md)
196
- - [Changelog](CHANGELOG.md)
197
- - [PyPI Package](https://pypi.org/project/asap-protocol/)
198
-
199
- ## When to Use ASAP?
200
-
201
- ASAP is ideal for:
202
- - **Multi-agent orchestration**: Coordinate tasks across multiple AI agents
203
- - **Stateful workflows**: Long-running tasks that need persistence and resumability
204
- - **MCP integration**: Agents that need to execute tools via Model Context Protocol
205
- - **Production systems**: High-performance, type-safe agent communication
206
-
207
- If you're building simple point-to-point agent communication, a basic HTTP API might suffice. ASAP shines when you need orchestration, state management and multi-agent coordination.
208
-
209
- ## Advanced Topics
210
-
211
- Explore these guides for detailed information on specific features:
212
-
213
- - **[State Management](docs/state-management.md)**: Task lifecycle, state machine, and snapshot persistence for resumable workflows.
214
- - **[Error Handling](docs/error-handling.md)**: Structured error taxonomy and recovery patterns for robust agent communication.
215
- - **[Transport Layer](docs/transport.md)**: HTTP/JSON-RPC binding details, async handlers, and server configuration.
216
- - **[Security](docs/security.md)**: Production security practices, rate limiting, DoS protection, and authentication.
217
- - **[Observability](docs/observability.md)**: Tracing, metrics, and logging for debugging multi-agent systems.
218
- - **[Testing](docs/testing.md)**: Testing strategies and utilities for ASAP-based agents.
219
-
220
- ### Examples & Demos
221
-
222
- Run the built-in multi-agent demo to see ASAP in action:
223
-
224
- ```bash
225
- uv run python -m asap.examples.run_demo
226
- ```
227
-
228
- See [`src/asap/examples/`](src/asap/examples/) for complete example implementations.
229
-
230
- ### CLI Tools
231
-
232
- The ASAP CLI provides utilities for schema management. See [CLI documentation](docs/index.md#cli) or run `asap --help` for available commands.
233
-
234
- ## Contributing
235
-
236
- We love contributions! Whether it's fixing a bug, improving documentation or proposing a new feature.. your help is welcome.
237
-
238
- **As an alpha release, community feedback and contributions are essential** for ASAP Protocol's evolution. We're actively working on improvements and your input helps shape the future of the protocol. Every contribution, from bug reports to feature suggestions, documentation improvements and code contributions, makes a real difference.
239
-
240
- Check out our [Contributing Guidelines](CONTRIBUTING.md) to get started. It's easier than you think! 🚀
241
-
242
- ## License
243
-
244
- This project is licensed under the Apache 2.0 License - see the [LICENSE](LICENSE) file for details.