Skip to main content

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, 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 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 runtime behavior 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, and tool_call blocks
  • session continuation and session query extensions
  • interrupt lifecycle mapping and callback validation
  • bearer-token auth, payload logging controls, and secret-handling guardrails
  • released-CLI startup and source-based runtime 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 runtime use:

  • 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
  • released-CLI self-start and source-based runtime paths are both documented
  • security baseline now includes SECURITY.md, secret scanning, and safer runtime defaults

Security Model

This project improves the service boundary around Codex, but it is not a hard multi-tenant isolation layer.

One running 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
  • local runtime setup still needs a controlled environment

Read before use:

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 main after human review
  • create a v* tag only from a commit already contained in main
  • 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>"

Before starting the runtime:

  • Install and verify the local codex CLI itself.
  • Configure Codex with a working provider/model setup and any required credentials.
  • codex-a2a-server does not provision Codex providers, login state, or API keys for you.
  • Startup fails fast if the local codex runtime is missing or cannot initialize.

Self-start the released CLI against a workspace root:

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_WORKSPACE_ROOT=/abs/path/to/workspace \
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.

Development From Source

Use the repository checkout directly only for development, local debugging, or validation against unreleased changes on main.

  1. Install dependencies:
uv sync --all-extras
  1. Make sure local Codex is already usable:
  • verify codex is installed and available on PATH (or set CODEX_CLI_BIN)
  • verify Codex provider/auth configuration already works outside this repository
  1. Generate a local bearer token:
export A2A_BEARER_TOKEN="$(python -c 'import secrets; print(secrets.token_hex(24))')"
  1. Start this service from the source tree:
CODEX_WORKSPACE_ROOT=/abs/path/to/workspace uv run codex-a2a-server
  1. 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.
  • 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.

Metadata

Release files for codex-a2a-server 0.2.1

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for codex-a2a-server 0.2.1
File Size Uploaded Provenance
codex_a2a_server-0.2.1.tar.gz 153.8 kB With provenance Details

Built distribution (wheel)

Table of built distributions (wheels) for codex-a2a-server 0.2.1
File Interpreter ABI Platform
codex_a2a_server-0.2.1-py3-none-any.whl Python 3 none any Details

Total release size: 220.4 kB

Release files / codex_a2a_server-0.2.1.tar.gz

Download URL codex_a2a_server-0.2.1.tar.gz
Size 153.8 kB
Tags Source
SHA-256 checksum
How to use checksums
e0056fc7de83ab69440a43c3e938fcab1ef9f637b26b02291b3941b707c8e811
BLAKE2b-256 checksum
How to use checksums
a0f1b0032b7767c9a8822d915fb3ef8f41272eb92ada87eef0cb596dc24b1305
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.13.7

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Mar 19, 2026.

Transparency log

Release files / codex_a2a_server-0.2.1-py3-none-any.whl

Download URL codex_a2a_server-0.2.1-py3-none-any.whl
Size 66.6 kB
Tags Python 3
SHA-256 checksum
How to use checksums
2a0b23ffdf50024150bd999f26ab757ad880dee36bc608a1a7c8d5813964de4e
BLAKE2b-256 checksum
How to use checksums
b240c6a9c6f613dc975d4bf4047a2979aeae94cfa115f2f919e26d3243d8645b
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.13.7

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Mar 19, 2026.

Transparency log

Security for codex-a2a-server 0.2.1

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

Full provenance

All 2 files in this release have been uploaded with provenance metadata.

Select from 2 files

Attestation for codex_a2a_server-0.2.1.tar.gz

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Mar 19, 2026.

Transparency log

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page