Skip to main content

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, 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
  • systemd multi-instance deployment and lightweight local deployment

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 scripts cover both long-running systemd instances and lightweight current-user startup
  • 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.

  • 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 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>"

Start the released CLI:

export A2A_BEARER_TOKEN="$(python -c 'import secrets; print(secrets.token_hex(24))')"
codex-a2a-server

Default address: http://127.0.0.1:8000

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. 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:
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.
  • Deployment Guide systemd deployment, lightweight deployment, runtime secret strategy, and operations guidance.
  • Script Guide Entry points for init, deploy, local start, and uninstall scripts.
  • 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


Download files

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

Source Distribution

codex_a2a_server-0.1.0.tar.gz (150.6 kB view details)

Uploaded Source

Built Distribution

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

codex_a2a_server-0.1.0-py3-none-any.whl (52.4 kB view details)

Uploaded Python 3

File details

Details for the file codex_a2a_server-0.1.0.tar.gz.

File metadata

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

File hashes

Hashes for codex_a2a_server-0.1.0.tar.gz
Algorithm Hash digest
SHA256 48e0a7a6d6fc67ff976adea38c57d330d1c3af3b79893d70331d658ff181cba8
MD5 172319af2a4e962ea101bc9f06c4aeab
BLAKE2b-256 9d37bf94b8056f746eacea8d9ad6aabf5baae5b75f992dfb54fbd6a2302ac549

See more details on using hashes here.

Provenance

The following attestation bundles were made for codex_a2a_server-0.1.0.tar.gz:

Publisher: publish.yml on liujuanjuan1984/codex-a2a-server

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

File details

Details for the file codex_a2a_server-0.1.0-py3-none-any.whl.

File metadata

File hashes

Hashes for codex_a2a_server-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 fde18991d89cf28028d3a112db844bab20b9f83162f5222e24fbab2b5842c59c
MD5 dee518c867f26e0df13dcf1086825f3f
BLAKE2b-256 ded89f4745cb71050cd8d29f13b04ccfa93fce444024383b66bbb06ed89df924

See more details on using hashes here.

Provenance

The following attestation bundles were made for codex_a2a_server-0.1.0-py3-none-any.whl:

Publisher: publish.yml on liujuanjuan1984/codex-a2a-server

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