Skip to main content

Async Simple Agent Protocol - A streamlined protocol for agent-to-agent communication

Project description

ASAP: Async Simple Agent Protocol

ASAP Protocol Banner

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.3.0 | Apache 2.0 | Python 3.13+ | Documentation | PyPI | Changelog

⚠️ Alpha Release: ASAP Protocol is currently in alpha (v0.3.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:

  1. $N^2$ Connection Complexity: Most protocols assume static point-to-point HTTP connections that don't scale.
  2. State Drift: Lack of native persistence makes it impossible to reliably resume long-running agentic workflows.
  3. 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.

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) and pydantic-core (Rust) for ultra-low latency validation and I/O.
  • Observable Chains: First-class support for trace_id and correlation_id to 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 asyncio and httpx. Supports both sync and async handlers with automatic event loop management.
  • 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 uv or pip
  • 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.3.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,
    ),
    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(),
    )
    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 metadata
  • TaskRequest, TaskResponse, TaskUpdate, TaskCancel: task lifecycle payloads
  • MessageSend, ArtifactNotify: messaging and artifacts
  • StateQuery, StateRestore: snapshot state operations
  • McpToolCall, McpToolResult, McpResourceFetch, McpResourceData: MCP integration

Transport:

  • create_app: FastAPI application factory
  • HandlerRegistry: 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


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

asap_protocol-0.3.0.tar.gz (435.1 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

asap_protocol-0.3.0-py3-none-any.whl (75.3 kB view details)

Uploaded Python 3

File details

Details for the file asap_protocol-0.3.0.tar.gz.

File metadata

  • Download URL: asap_protocol-0.3.0.tar.gz
  • Upload date:
  • Size: 435.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for asap_protocol-0.3.0.tar.gz
Algorithm Hash digest
SHA256 b97772be2607d8dadbf199909ad430ab4d987f9b50fe1d85bdb68ac07d68455a
MD5 dd2900fba10da74077e5a86d93307aae
BLAKE2b-256 192f69b8f75faadbab858bcfbef39d7fb35060d0f05f2fefa2e68dd2720aecc7

See more details on using hashes here.

Provenance

The following attestation bundles were made for asap_protocol-0.3.0.tar.gz:

Publisher: release.yml on adriannoes/asap-protocol

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file asap_protocol-0.3.0-py3-none-any.whl.

File metadata

  • Download URL: asap_protocol-0.3.0-py3-none-any.whl
  • Upload date:
  • Size: 75.3 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for asap_protocol-0.3.0-py3-none-any.whl
Algorithm Hash digest
SHA256 0e36daacf0b75b4c68c4369ff313799aca8b3f1bc84bbe294b06e1a6a72ff485
MD5 e3808ffa9e0ba3506ed7d67611ad452d
BLAKE2b-256 13c1e6b99778da151136d5cbac26d81b79b048ecfedcd2ce51bf82f7cb3e4454

See more details on using hashes here.

Provenance

The following attestation bundles were made for asap_protocol-0.3.0-py3-none-any.whl:

Publisher: release.yml on adriannoes/asap-protocol

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page