Async Simple Agent Protocol - A streamlined protocol for agent-to-agent communication
Project description
ASAP: Async Simple Agent Protocol
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.
Quick Info: v0.5.0 | Apache 2.0 | Python 3.13+ | Documentation | PyPI | Changelog
⚠️ 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 section to get involved!
Why ASAP?
Building multi-agent systems today suffers from three core technical challenges that existing protocols like A2A don't fully address:
- $N^2$ Connection Complexity: Most protocols assume static point-to-point HTTP connections that don't scale.
- State Drift: Lack of native persistence makes it impossible to reliably resume long-running agentic workflows.
- Fragmentation: No unified way to handle task delegation, artifact exchange, and tool execution (MCP) in a single envelope.
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.
Security-First Design
v0.5.0 introduces comprehensive security hardening:
- Authentication: Bearer token authentication with configurable token validators
- Replay Attack Prevention: Timestamp validation (5-minute window) and optional nonce tracking
- DoS Protection: Built-in rate limiting (100 req/min), request size limits (10MB), and thread pool bounds
- HTTPS Enforcement: Client-side HTTPS validation in production mode
- Secure Logging: Automatic sanitization of sensitive data (tokens, credentials, nonces) in logs
- Input Validation: Strict schema validation with Pydantic v2 for all incoming requests
All security features are opt-in to maintain backward compatibility with existing deployments.
Key Features
- Stateful Orchestration: Native task state machine with built-in snapshotting for durable, resumable agent workflows.
- Schema-First Design: Strict Pydantic v2 models providing automatic JSON Schema generation for guaranteed cross-agent interoperability.
- High-Performance Core: Built on Python 3.13+, leveraging
uvloop(C) andpydantic-core(Rust) for ultra-low latency validation and I/O. - Observable Chains: First-class support for
trace_idandcorrelation_idto debug complex multi-agent delegation. - MCP Integration: Uses the Model Context Protocol (MCP) as a tool-execution substrate, wrapped in a high-level coordination envelope.
- Async-Native: Engineered from the ground up for high-concurrency environments using
asyncioandhttpx. Supports both sync and async handlers with automatic event loop management. - 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.
- DoS Protection: Built-in rate limiting (100 req/min), request size limits (10MB), and thread pool bounds to prevent resource exhaustion attacks.
💡 Performance Note: Pure Python codebase leveraging Rust-accelerated dependencies (pydantic-core, orjson, python-ulid) for native-level performance without build complexity.
Installation
We recommend using uv for dependency management:
uv add asap-protocol
Or with pip:
pip install asap-protocol
📦 Available on PyPI
For reproducible environments, prefer uv when possible.
Requirements
- Python: 3.13 or higher
- Dependencies: Automatically installed via
uvorpip - Optional: For development, see Contributing
Quick Start
1. Create an Agent (Server)
from asap.models.entities import Capability, Endpoint, Manifest, Skill
from asap.transport.handlers import HandlerRegistry, create_echo_handler
from asap.transport.server import create_app
manifest = Manifest(
id="urn:asap:agent:echo-agent",
name="Echo Agent",
version="0.5.0",
description="Echoes task input as output",
capabilities=Capability(
asap_version="0.1",
skills=[Skill(id="echo", description="Echo back the input")],
state_persistence=False,
),
# Development: HTTP localhost is allowed
# Production: Always use HTTPS (e.g., "https://api.example.com/asap")
endpoints=Endpoint(asap="http://127.0.0.1:8001/asap"),
)
registry = HandlerRegistry()
registry.register("task.request", create_echo_handler())
app = create_app(manifest, registry)
2. Send a Task (Client)
import asyncio
from asap.models.envelope import Envelope
from asap.models.payloads import TaskRequest
from asap.transport.client import ASAPClient
async def main():
request = TaskRequest(
conversation_id="conv_01HX5K3MQVN8",
skill_id="echo",
input={"message": "hello from client"},
)
envelope = Envelope(
asap_version="0.1",
sender="urn:asap:agent:client",
recipient="urn:asap:agent:echo-agent",
payload_type="task.request",
payload=request.model_dump(),
)
# Development: HTTP localhost is allowed (with warning)
# Production: Always use HTTPS (e.g., "https://api.example.com")
async with ASAPClient("http://127.0.0.1:8001") as client:
response = await client.send(envelope)
print(response.payload)
if __name__ == "__main__":
asyncio.run(main())
API Overview
Core models:
Envelope: protocol wrapper with routing and tracing metadataTaskRequest,TaskResponse,TaskUpdate,TaskCancel: task lifecycle payloadsMessageSend,ArtifactNotify: messaging and artifactsStateQuery,StateRestore: snapshot state operationsMcpToolCall,McpToolResult,McpResourceFetch,McpResourceData: MCP integration
Transport:
create_app: FastAPI application factoryHandlerRegistry: payload dispatch registry (supports both sync and async handlers)ASAPClient: async HTTP client with automatic retry for server errors (5xx)
Documentation
When to Use ASAP?
ASAP is ideal for:
- Multi-agent orchestration: Coordinate tasks across multiple AI agents
- Stateful workflows: Long-running tasks that need persistence and resumability
- MCP integration: Agents that need to execute tools via Model Context Protocol
- Production systems: High-performance, type-safe agent communication
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.
Advanced Topics
Explore these guides for detailed information on specific features:
- State Management: Task lifecycle, state machine, and snapshot persistence for resumable workflows.
- Error Handling: Structured error taxonomy and recovery patterns for robust agent communication.
- Transport Layer: HTTP/JSON-RPC binding details, async handlers, and server configuration.
- Security: Production security practices, rate limiting, DoS protection, and authentication.
- Observability: Tracing, metrics, and logging for debugging multi-agent systems.
- Testing: Testing strategies and utilities for ASAP-based agents.
Examples & Demos
Run the built-in multi-agent demo to see ASAP in action:
uv run python -m asap.examples.run_demo
See src/asap/examples/ for complete example implementations.
CLI Tools
The ASAP CLI provides utilities for schema management. See CLI documentation or run asap --help for available commands.
Contributing
We love contributions! Whether it's fixing a bug, improving documentation or proposing a new feature.. your help is welcome.
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.
Check out our Contributing Guidelines to get started. It's easier than you think! 🚀
License
This project is licensed under the Apache 2.0 License - see the LICENSE file for details.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file asap_protocol-0.5.0.tar.gz.
File metadata
- Download URL: asap_protocol-0.5.0.tar.gz
- Upload date:
- Size: 498.1 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
563a5677e65b7490773a7d01b1107da3884ab13710f0e9a1f4f33cfa2e7a7812
|
|
| MD5 |
40471e38d81812215ad4920a66f2ff12
|
|
| BLAKE2b-256 |
2d9dbede7bd10d779339382f54eee357b84d868dd9ca85b5f29291aae6c7401c
|
Provenance
The following attestation bundles were made for asap_protocol-0.5.0.tar.gz:
Publisher:
release.yml on adriannoes/asap-protocol
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
asap_protocol-0.5.0.tar.gz -
Subject digest:
563a5677e65b7490773a7d01b1107da3884ab13710f0e9a1f4f33cfa2e7a7812 - Sigstore transparency entry: 869200166
- Sigstore integration time:
-
Permalink:
adriannoes/asap-protocol@b26de0c19557df8925b023fb2a7185f7e2b49a74 -
Branch / Tag:
refs/tags/v0.5.0 - Owner: https://github.com/adriannoes
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release.yml@b26de0c19557df8925b023fb2a7185f7e2b49a74 -
Trigger Event:
push
-
Statement type:
File details
Details for the file asap_protocol-0.5.0-py3-none-any.whl.
File metadata
- Download URL: asap_protocol-0.5.0-py3-none-any.whl
- Upload date:
- Size: 90.4 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
a05e15ea526b81e31b59e8e902e4e13f815a65e15b287a83c2293842e029ae3f
|
|
| MD5 |
2ac34c4802e4016ea157f7a115cd8b40
|
|
| BLAKE2b-256 |
129c2856dcf06a7588b9060764db57fa9c88e4db7859197ee9fd53dab0a59771
|
Provenance
The following attestation bundles were made for asap_protocol-0.5.0-py3-none-any.whl:
Publisher:
release.yml on adriannoes/asap-protocol
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
asap_protocol-0.5.0-py3-none-any.whl -
Subject digest:
a05e15ea526b81e31b59e8e902e4e13f815a65e15b287a83c2293842e029ae3f - Sigstore transparency entry: 869200168
- Sigstore integration time:
-
Permalink:
adriannoes/asap-protocol@b26de0c19557df8925b023fb2a7185f7e2b49a74 -
Branch / Tag:
refs/tags/v0.5.0 - Owner: https://github.com/adriannoes
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release.yml@b26de0c19557df8925b023fb2a7185f7e2b49a74 -
Trigger Event:
push
-
Statement type: