A2A wrapper service for codex
Project description
codex-a2a-server
Turn Codex into a stateful, production-oriented A2A agent service.
codex-a2a-server exposes Codex through standard A2A interfaces and adds the
operational pieces that raw agent runtimes usually do not provide by default:
authentication, session continuity, streaming contracts, interrupt handling,
deployment tooling, and documentation for running it as a service.
Why This Project Exists
Most coding agents are built first as interactive tools, not as reusable service endpoints. This project turns Codex into an agent service that can be embedded into applications, gateways, and orchestration systems without forcing each consumer to re-implement transport bridging, auth, or runtime operations.
In practice, codex-a2a-server acts as:
- a protocol bridge from A2A to Codex
- a security and deployment boundary around the Codex runtime
- a stable contract layer for session, streaming, and interrupt behaviors
Vision
Build a reusable adapter layer that lets coding agents behave like service infrastructure rather than local-only tools:
- standard transport contracts instead of provider-specific glue
- explicit runtime boundaries instead of ad-hoc shell wrappers
- production-friendly deployment and observability instead of demo-only setups
What It Already Provides
- A2A HTTP+JSON and JSON-RPC entrypoints for Codex
- SSE streaming with normalized
text,reasoning, andtool_callblocks - session continuation and session query extensions
- interrupt lifecycle mapping and callback validation
- bearer-token auth, payload logging controls, and secret-handling guardrails
- systemd multi-instance deployment and released-CLI startup paths
Logical Components
flowchart TD
A["A2A client"] --> B["FastAPI transport layer"]
B --> C["A2A task/message mapping"]
C --> D["Codex client adapter"]
D --> E["Codex app-server / CLI"]
B --> F["Auth and request logging"]
C --> G["Shared contract normalization"]
G --> H["Streaming blocks"]
G --> I["Session continuity"]
G --> J["Interrupt lifecycle"]
This repository does not change what Codex fundamentally is. It wraps Codex in a service layer that makes the runtime consumable through stable agent-facing contracts.
More detail: Architecture Guide
Current Progress
The project already has a usable service baseline for internal or controlled deployments:
- core A2A send/stream flows are implemented
- streaming contracts are normalized around shared metadata
- interrupt ask/resolve lifecycle is surfaced explicitly
- session continuity is available through shared metadata and JSON-RPC queries
- deployment guidance now separates source development, released-CLI self-start, and long-running systemd instances
- security baseline now includes
SECURITY.md, secret scanning, and safer deployment defaults
Security Model
This project improves the service boundary around Codex, but it is not a hard multi-tenant isolation layer.
One deployed instance should be treated as a single-tenant trust boundary with a shared workspace/environment.
- the underlying Codex runtime may still need provider credentials
- one instance is not tenant-isolated by default
- deploy scripts default to not persisting secrets unless explicitly opted in
Read before deployment:
Recommended Client Side
If you want a client-side integration layer to consume this service, prefer a2a-client-hub.
It is a better place for client concerns such as A2A consumption, upstream
adapter normalization, and application-facing integration, while
codex-a2a-server stays focused on the server/runtime boundary around Codex.
Install Released CLI
Released versions are published to PyPI and mapped to Git tags / GitHub Releases. This is the recommended entry point for users.
Release gate:
- create a PR from the working branch
- merge into
mainafter human review - create a
v*tag only from a commit already contained inmain - let the tag trigger PyPI and GitHub Release publication
This repository does not publish directly from an unmerged feature branch.
Install the latest release:
uv tool install codex-a2a-server
Upgrade an existing installation:
uv tool upgrade codex-a2a-server
Install an exact release:
uv tool install "codex-a2a-server==<version>"
Self-start the released CLI against an existing project:
export A2A_BEARER_TOKEN="$(python -c 'import secrets; print(secrets.token_hex(24))')"
A2A_HOST=127.0.0.1 \
A2A_PORT=8000 \
A2A_PUBLIC_URL=http://127.0.0.1:8000 \
CODEX_DIRECTORY=/abs/path/to/project \
codex-a2a-server
Default address: http://127.0.0.1:8000
For a longer self-start example with model and timeout overrides, use the Usage Guide.
For a managed long-running deployment, use the published-package systemd flow in the Deployment Guide. That path no longer relies on a source checkout or a repository-local virtualenv.
Development From Source
Use the repository checkout directly only for development, local debugging, or
validation against unreleased changes on main.
- Install dependencies:
uv sync --all-extras
- Generate a local bearer token:
export A2A_BEARER_TOKEN="$(python -c 'import secrets; print(secrets.token_hex(24))')"
- Start this service from the source tree:
uv run codex-a2a-server
- Open the Agent Card:
http://127.0.0.1:8000/.well-known/agent-card.json
For configuration, transport examples, and protocol details, use the dedicated docs instead of the root README.
Documentation Map
- Architecture Guide System structure, boundaries, and request flow.
- Usage Guide Configuration, API contracts, client examples, streaming/session/interrupt details.
- Compatibility Guide Supported Python/runtime surface, extension stability, and ecosystem-facing compatibility expectations.
- Deployment Guide systemd deployment from the published package, runtime secret strategy, and operations guidance.
- Script Guide Entry points for bootstrap, managed deploy, uninstall, and release smoke test scripts.
- Contributing Guide Contributor workflow, validation baseline, and change expectations.
- Security Policy Threat model, deployment caveats, and vulnerability disclosure guidance.
Development
Baseline validation:
uv run pre-commit run --all-files
uv run pytest
License
Apache License 2.0. See LICENSE.
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 codex_a2a_server-0.2.0.tar.gz.
File metadata
- Download URL: codex_a2a_server-0.2.0.tar.gz
- Upload date:
- Size: 170.3 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
62dc026de201fa56860ec82bdd7b55b2d10ab780e476d790c38b10a03b32ebfc
|
|
| MD5 |
75c8ff0199918307b142d86105d32221
|
|
| BLAKE2b-256 |
16262db4f37b070f40c069ea0db39fb0bc4b78f827d5a4c2c9f62ae9c5acbedf
|
Provenance
The following attestation bundles were made for codex_a2a_server-0.2.0.tar.gz:
Publisher:
publish.yml on liujuanjuan1984/codex-a2a-server
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
codex_a2a_server-0.2.0.tar.gz -
Subject digest:
62dc026de201fa56860ec82bdd7b55b2d10ab780e476d790c38b10a03b32ebfc - Sigstore transparency entry: 1129767579
- Sigstore integration time:
-
Permalink:
liujuanjuan1984/codex-a2a-server@92126d37261ab5ff7d7be5d9ce5f6db8446327a6 -
Branch / Tag:
refs/tags/v0.2.0 - Owner: https://github.com/liujuanjuan1984
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@92126d37261ab5ff7d7be5d9ce5f6db8446327a6 -
Trigger Event:
push
-
Statement type:
File details
Details for the file codex_a2a_server-0.2.0-py3-none-any.whl.
File metadata
- Download URL: codex_a2a_server-0.2.0-py3-none-any.whl
- Upload date:
- Size: 65.5 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 |
1ec5766c72db4bc450d17e71177d6981008315d9477749978bfdaacc21cb2535
|
|
| MD5 |
8283025f845122c61ee840001c090675
|
|
| BLAKE2b-256 |
6de18e777f901e1be14b97f0c4e4b531c3390bc1d21a03dc177448577011497f
|
Provenance
The following attestation bundles were made for codex_a2a_server-0.2.0-py3-none-any.whl:
Publisher:
publish.yml on liujuanjuan1984/codex-a2a-server
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
codex_a2a_server-0.2.0-py3-none-any.whl -
Subject digest:
1ec5766c72db4bc450d17e71177d6981008315d9477749978bfdaacc21cb2535 - Sigstore transparency entry: 1129767697
- Sigstore integration time:
-
Permalink:
liujuanjuan1984/codex-a2a-server@92126d37261ab5ff7d7be5d9ce5f6db8446327a6 -
Branch / Tag:
refs/tags/v0.2.0 - Owner: https://github.com/liujuanjuan1984
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@92126d37261ab5ff7d7be5d9ce5f6db8446327a6 -
Trigger Event:
push
-
Statement type: