Sandbox
@hybroai/a2a-adapter

A2A Protocol adapter SDK for agent CLIs

A2A Adapter wraps agent CLIs, local agents, workflow engines, and Python frameworks behind the A2A Protocol. You can run it as a CLI or embed it in Python, and it serves the adapter with the right protocol plumbing while your code handles the underlying agent. It supports multiple agent entry points and framework adapters, so you can expose an existing tool without rewriting it. The package includes examples, a quickstart, and tests that show how the server, client, and executor pieces fit together.

96 stars13 forksPythonUpdated 24d ago
Who it's for

Builders who want to publish an existing agent or framework behind an A2A endpoint.

What it delivers

You can turn an existing agent or workflow into a reachable A2A server without rebuilding its core logic.

What it does

CLI wrappers for local agents

Runs agents like Claude Code, Codex, Pi, and OpenClaw from the terminal with A2A server flags.

Python adapter SDK

Provides `CallableAdapter`, `BaseA2AAdapter`, and framework-specific adapters for embedding A2A support in code.

Automatic AgentCard and protocol handling

Generates the AgentCard and manages JSON-RPC, task lifecycle, and streaming through the A2A SDK.

Multiple framework integrations

Includes adapters for LangGraph, LangChain, CrewAI, n8n, Ollama, Hermes Agent, and custom Python functions.

Runnable examples and tests

Ships example scripts for each supported adapter and a test suite covering the adapter, executor, and server behavior.

How to get it

  1. 1Run
    pip install a2a-adapter

README

A2A Adapter

PyPI version License: Apache-2.0 Python 3.11+

Expose your AI agent as an A2A Protocol server in a few lines of Python.

a2a-adapter wraps agent CLIs, local agents, workflow engines, and Python agent frameworks behind the A2A (Agent-to-Agent) Protocol. It handles AgentCard generation, JSON-RPC, task lifecycle, and streaming through the official A2A SDK, so your adapter only needs to invoke the underlying agent.

Works with Claude Code, Codex, Pi, OpenClaw, n8n, LangGraph, LangChain, CrewAI, Ollama, Hermes Agent, and custom Python functions.

Install

pip install a2a-adapter

CLI Use Case

Use the CLI when you want to expose an already installed local agent from the current terminal directory without writing Python:

a2a-adapter pi --port 9012
a2a-adapter codex --port 9011
a2a-adapter claude --port 9010
a2a-adapter openclaw --port 9008

Options before -- configure the A2A server. Options after -- are passed to the underlying agent CLI:

a2a-adapter pi --port 9012 -- --model <model> --thinking high
a2a-adapter codex --port 9011 -- --model <model> --sandbox workspace-write
a2a-adapter claude --port 9010 -- --model <model>
a2a-adapter openclaw --port 9008 --agent-id main --thinking high

Use --cwd /path/to/project to choose another working directory and --host 0.0.0.0 when the server must be reachable outside the local machine. Pi source commands can be selected without a shell wrapper:

A2A_PI_COMMAND='npx tsx /path/to/pi/packages/coding-agent/src/cli.ts' \
  a2a-adapter pi --port 9012

Run a2a-adapter -help for the supported agents, or a2a-adapter <agent> -help for agent-specific usage. The adapter owns protocol and session flags such as Pi's --mode rpc and Codex's --json; those flags cannot be overridden after --.

Python SDK Use Case

Use the Python SDK when embedding A2A support in an application, wrapping a Python framework, or providing custom adapter configuration:

from a2a_adapter import CallableAdapter, serve_agent

adapter = CallableAdapter(func=lambda inputs: f"Echo: {inputs['message']}", name="Echo")
serve_agent(adapter, port=9000)

The SDK produces the same A2A server and auto-generated AgentCard:

http://localhost:9000/.well-known/agent-card.json

Supported Python SDK Adapters

Framework or agentAdapterStreamingExample
Claude CodeClaudeCodeAdapterYesclaude_code_agent.py
CodexCodexAdapterNocodex_agent.py
PiPiAdapterYespi_agent.py
OpenClawOpenClawAdapterNoopenclaw_agent.py
n8nN8nAdapterNon8n_agent.py
LangGraphLangGraphAdapterYeslanggraph_server.py
LangChainLangChainAdapterYeslangchain_agent.py
CrewAICrewAIAdapterNocrewai_agent.py
OllamaOllamaAdapterYesollama_agent.py
Hermes AgentHermesAdapterYeshermes_agent.py
Python callableCallableAdapterOptionalquickstart.py
Custom classBaseA2AAdapterOptionalcustom_adapter.py

Documentation

Star History

Star History Chart

License

Apache-2.0 - see LICENSE.

Built by HYBRO AI. Powered by the A2A Protocol.

Files in the repo

Repository payload15 top-level entries
  • .claude
  • .github
  • a2a_adapter
  • docs
  • examples
  • tests
  • .gitignore
  • ARCHITECTURE.md
  • CHANGELOG.md
  • CONTRIBUTING.md
  • LICENSE
  • pyproject.toml
  • QUICKSTART.md
  • README.md
  • uv.lock

Discussion (0)

Ask about usage, or say what you built with it

Sign in to join the discussion.

No comments yet. Be the first to say what this is good for.

More connectors

High-performance code intelligence MCP server. Indexes codebases into a persistent knowledge graph — average repo in milliseconds. 158 languages, sub-ms queries, 99% fewer tokens. Single static binary, zero dependencies.

43k

Universal provider proxy for OpenAI Codex & Claude Code — use any LLM (Claude, Gemini, Grok, DeepSeek, Ollama…) with Codex CLI, App, SDK, and Claude Code

14k
okf-memory/
okf-agent-memory

Git-native persistent memory for AI coding agents. Implements Google OKF v0.2 with sub-300µs in-memory BM25 search, embedded MCP server, and progressive disclosure. Slashes token bloat by 80% with zero external databases or dependencies. Built in pure Go.

547
tirth8205/
code-review-graph

Local-first code intelligence graph for MCP and CLI. Builds a persistent map of your codebase so AI coding tools read only what matters, with benchmarked context reductions on reviews and large-repo workflows.

31k
2akouwu/
reverify

Stop your AI from making things up — it proposes, deterministic tools decide, every claim checked against ground truth with evidence. Grounded facts and context survive resets. Reverse engineering is the proving ground. MCP server + CLI.

1.1k
t8y2/dbxConnectors

20 MB lightweight cross-platform database client for 90+ databases, including MySQL, PostgreSQL, SQLite, Redis, MongoDB, DuckDB, SQL Server, and Dameng. Built-in AI, MCP Server, CLI, desktop and Docker. | 轻量级跨平台数据库管理工具,支持 MySQL、PostgreSQL、SQLite、Redis、MongoDB、达梦等 90+ 数据库,提供桌面端、Docker、CLI、内置 AI 助手和 MCP Server。

19k