Skip to main content

opencode-a2a-server

Expose OpenCode through A2A.

opencode-a2a-server adds an A2A service layer to opencode serve, with auth, streaming, session continuity, interrupt handling, and a clear deployment boundary.

What This Is

  • An A2A adapter service for opencode serve.
  • Use it when you need a stable A2A endpoint for apps, gateways, or A2A clients.
flowchart TD
    Client["a2a-client-hub / any A2A client"]

    subgraph ServerSide["Server-side"]
        Adapter["opencode-a2a-server\nA2A adapter service"]
        Runtime["opencode serve\nOpenCode runtime"]

        Adapter <--> Runtime
    end

    Client <--> Adapter

Quick Start

Install the released CLI with uv tool:

uv tool install opencode-a2a-server

Upgrade later with:

uv tool upgrade opencode-a2a-server

Make sure provider credentials and a default model are configured on the OpenCode side, then start OpenCode:

opencode auth login
opencode models
opencode serve --hostname 127.0.0.1 --port 4096

Then start opencode-a2a-server against that upstream:

A2A_BEARER_TOKEN=dev-token \
OPENCODE_BASE_URL=http://127.0.0.1:4096 \
A2A_HOST=127.0.0.1 \
A2A_PORT=8000 \
A2A_PUBLIC_URL=http://127.0.0.1:8000 \
A2A_STREAM_SSE_PING_SECONDS=15 \
OPENCODE_WORKSPACE_ROOT=/abs/path/to/workspace \
opencode-a2a-server serve

Verify that the service is up:

curl http://127.0.0.1:8000/.well-known/agent-card.json

Default local address: http://127.0.0.1:8000

What You Get

  • A2A HTTP+JSON endpoints such as /v1/message:send and /v1/message:stream
  • A2A JSON-RPC support on POST /
  • SSE streaming with normalized text, reasoning, and tool_call blocks
  • Explicit REST SSE keepalive configurable through A2A_STREAM_SSE_PING_SECONDS
  • Session continuity through metadata.shared.session.id
  • Request-scoped model selection through metadata.shared.model
  • OpenCode-oriented JSON-RPC extensions for session and model/provider queries

Detailed protocol contracts, examples, and extension docs live in docs/guide.md.

When To Use It

Use this project when:

  • you want to keep OpenCode as the runtime
  • you need A2A transports and Agent Card discovery
  • you want a thin service boundary instead of building your own adapter

Look elsewhere if:

  • you need hard multi-tenant isolation inside one shared runtime
  • you want this project to manage your process supervisor or host bootstrap
  • you want a general client integration layer rather than a server wrapper

For client-side integration, prefer a2a-client-hub.

Deployment Boundary

This repository improves the service boundary around OpenCode, but it does not turn OpenCode into a hardened multi-tenant platform.

  • A2A_BEARER_TOKEN protects the A2A surface.
  • Provider auth and default model configuration remain on the OpenCode side.
  • Deployment supervision is intentionally BYO. Use systemd, Docker, Kubernetes, or another supervisor if you need long-running operation.
  • For mutually untrusted tenants, run separate instance pairs with isolated users, containers, workspaces, credentials, and ports.

Read before deployment:

Further Reading

  • docs/guide.md Usage guide, transport details, streaming behavior, extensions, and examples.
  • SECURITY.md Threat model, deployment caveats, and vulnerability disclosure guidance.

Development

For contributor workflow, local validation, and helper scripts, see CONTRIBUTING.md and scripts/README.md.

License

Apache-2.0. See LICENSE.

Metadata

Release files for opencode-a2a-server 0.3.0

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

Source distribution (sdist)

Source distribution for opencode-a2a-server 0.3.0
File Size Uploaded Provenance
opencode_a2a_server-0.3.0.tar.gz 204.4 kB With provenance Details

Built distribution (wheel)

Table of built distributions (wheels) for opencode-a2a-server 0.3.0
File Interpreter ABI Platform
opencode_a2a_server-0.3.0-py3-none-any.whl Python 3 none any Details

Total release size: 275.0 kB

Release files / opencode_a2a_server-0.3.0.tar.gz

Download URL opencode_a2a_server-0.3.0.tar.gz
Size 204.4 kB
Tags Source
SHA-256 checksum
How to use checksums
e9666a0c33b62425f568d77faec6af281727f6965950fe5c8ddaa0491b5b53b3
BLAKE2b-256 checksum
How to use checksums
dc358d20e4803728fec9c7a7175d8e78b2b8a7cf2d996e9c9d02de4efa54e810
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 21, 2026.

Transparency log

Release files / opencode_a2a_server-0.3.0-py3-none-any.whl

Download URL opencode_a2a_server-0.3.0-py3-none-any.whl
Size 70.6 kB
Tags Python 3
SHA-256 checksum
How to use checksums
2b4cbc9cd3af1afbf9f5299f35283e7ac816b631bacfe308385f814b5dfb1349
BLAKE2b-256 checksum
How to use checksums
4e8f3e698769a902ae8767e2994cfe10c6b91f45257360bdafc8cd72b0102da3
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 21, 2026.

Transparency log

Security for opencode-a2a-server 0.3.0

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 opencode_a2a_server-0.3.0.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 21, 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