Sign inSign up

opsmaster/a2a-opencode

By opsmaster

Updated 19 days ago

It wraps the opencode serve engine with a standard FastAPI-based A2A interface.

Image
Integration & delivery
Machine learning & AI
Operating systems
0

90

opsmaster/a2a-opencode repository overview

A2A-Opencode

Docker Pulls Docker Image Size A2A Protocol

A2A-Opencode is a production-ready Agent-to-Agent (A2A) protocol gateway container for the opencode autonomous coding agent.

It wraps the headless opencode serve engine with a standard FastAPI-based A2A interface (JSON-RPC 2.0 and Agent Card discovery), enabling seamless collaboration in multi-agent workforce environments.


✨ Key Features

  • 🌐 A2A Protocol v1.0.0 Compliant: Built-in /.well-known/agent-card.json metadata discovery and JSON-RPC 2.0 endpoints (sendMessage, ping).
  • 🤖 Seamless Headless Integration: Direct asynchronous communication with the internal opencode serve engine (127.0.0.1:4096).
  • 🔐 Two-Layer Security:
    • Inbound Access Control: Optional Bearer token authentication (A2A_TOKEN) for incoming client/agent requests.
    • Internal Backend Security: Basic Auth integration (OPENCODE_SERVER_PASSWORD) to protect the headless engine.
  • 📦 All-in-One Dual Process Container: Manages both opencode serve and the FastAPI A2A gateway with an automated orchestration lifecycle and healthcheck.
  • Optimized Build: Built with modern uv dependency caching on top of Ubuntu 24.04 LTS (Noble) base.

🏗️ Architecture

                       +--------------------------------------------------------+
                       |              Docker Container (Port 8000)              |
                       |                                                        |
[ A2A Client / Agent ] ---> [ FastAPI A2A Gateway ] (0.0.0.0:8000)             |
   (JSON-RPC 2.0)      |        |                                               |
                       |        | (Internal async HTTP / Basic Auth)            |
                       |        v                                               |
                       |   [ opencode serve Backend ] (127.0.0.1:4096)          |
                       +--------------------------------------------------------+

🚀 Quick Start

1. Run with Docker CLI
docker run -d \
  --name a2a-opencode \
  -p 8000:8000 \
  -e OPENCODE_SERVER_PASSWORD=your_secure_password \
  -e A2A_TOKEN=your_optional_bearer_token \
  opsmaster/a2a-opencode:v1.0
2. Run with Docker Compose

Create a docker-compose.yml file:

version: '3.8'

services:
  a2a-opencode:
    image: opsmaster/a2a-opencode:v1.0
    container_name: a2a-opencode
    ports:
      - "8000:8000"
    environment:
      - OPENCODE_SERVER_PASSWORD=your_secure_password
      - A2A_TOKEN=your_optional_bearer_token
    restart: unless-stopped

Start the container:

docker compose up -d

⚙️ Environment Variables

VariableRequiredDefaultDescription
OPENCODE_SERVER_PASSWORDYes-Password used for authenticating with the internal opencode serve instance.
A2A_TOKENNo-Bearer token for authenticating inbound A2A requests from external clients/agents.
A2A_PORTNo8000Gateway listening port.
A2A_HOSTNo0.0.0.0Gateway bind host.

📡 API Endpoints & Usage

1. Agent Discovery (Agent Card)

Retrieve agent capabilities, supported protocols, and metadata:

curl -X GET http://localhost:8000/.well-known/agent-card.json
2. Healthcheck
curl -X GET http://localhost:8000/health
3. Send Task / Message (JSON-RPC 2.0)
curl -X POST http://localhost:8000/ \
  -H "Content-Type: application/json" \
  -H "Authorization: Bearer your_optional_bearer_token" \
  -d '{
    "jsonrpc": "2.0",
    "method": "sendMessage",
    "params": {
      "message": "Analyze and refactor the user authentication module in src/auth.py"
    },
    "id": 1
  }'

📄 License

This project is licensed under the MIT License.

Tag summary

Content type

Image

Digest

sha256:52d25b30a

Size

502.7 MB

Last updated

19 days ago

docker pull opsmaster/a2a-opencode:v1.0