Skip to content

Expose OpenCode capabilities through Agent2Agent (A2A) Protocol#1

Draft
Copilot wants to merge 7 commits intodevfrom
copilot/expose-opencode-capabilities-a2a
Draft

Expose OpenCode capabilities through Agent2Agent (A2A) Protocol#1
Copilot wants to merge 7 commits intodevfrom
copilot/expose-opencode-capabilities-a2a

Conversation

Copy link

Copilot AI commented Feb 5, 2026

What does this PR do?

Implements A2A Protocol v0.3.0 to expose all OpenCode capabilities for agent-to-agent communication. OpenCode now operates as an A2A-compliant server, allowing discovery and task delegation from other agents.

Core Implementation (packages/opencode/src/a2a/)

  • executor.ts - Executes A2A tasks through OpenCode sessions, handling message conversion and response streaming
  • card.ts - Generates agent card from ToolRegistry, advertising all available tools as A2A skills
  • Protocol types defined inline (no external dependencies)

HTTP Endpoints (packages/opencode/src/server/routes/a2a.ts)

  • GET /a2a/.well-known/agent.json - Agent discovery card
  • POST /a2a/jsonrpc - JSON-RPC 2.0 interface for standard agent communication
  • POST /a2a/rest/execute - HTTP+JSON alternative

Key Design Decisions

  • Protocol-compatible implementation without @a2a-js/sdk dependency (avoiding Express requirement, using Hono)
  • Automatic tool exposure: all ToolRegistry entries map to A2A skills
  • Instance.directory for execution context (contextId is conversation identifier only)
  • Full TypeScript types for JSON-RPC requests/responses

Example usage:

# Discover capabilities
curl http://localhost:4096/a2a/.well-known/agent.json

# Execute via JSON-RPC
curl -X POST http://localhost:4096/a2a/jsonrpc -H "Content-Type: application/json" -d '{
  "jsonrpc": "2.0",
  "method": "agent/execute",
  "params": {
    "messages": [{
      "kind": "message",
      "messageId": "msg-001",
      "role": "user",
      "parts": [{"kind": "text", "text": "List TypeScript files"}]
    }]
  },
  "id": 1
}'

How did you verify your code works?

  • Unit tests for agent card generation and tool exposure (test/a2a/card.test.ts)
  • Manual verification of endpoint responses (agent card returns valid JSON with all tools)
  • Verified URL path manipulation handles edge cases (split/join vs regex)
  • Type checking passes (proper JsonRpcRequest/Response types throughout)

Warning

Firewall rules blocked me from connecting to one or more addresses (expand for details)

I tried to connect to the following addresses, but was blocked by firewall rules:

  • modelcontextprotocol.io
    • Triggering command: /usr/bin/curl curl -s REDACTED (dns block)
  • unpkg.com
    • Triggering command: /usr/bin/curl curl -s REDACTED (dns block)

If you need me to access, download, or install something from one of these locations, you can either:

Original prompt

I want to expose all opencode capabilities throught Agent2Agent (A2A) Protocol


💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.

Copilot AI and others added 6 commits February 5, 2026 09:40
Co-authored-by: jgranesa <47306065+jgranesa@users.noreply.github.com>
Co-authored-by: jgranesa <47306065+jgranesa@users.noreply.github.com>
Co-authored-by: jgranesa <47306065+jgranesa@users.noreply.github.com>
Co-authored-by: jgranesa <47306065+jgranesa@users.noreply.github.com>
Co-authored-by: jgranesa <47306065+jgranesa@users.noreply.github.com>
Co-authored-by: jgranesa <47306065+jgranesa@users.noreply.github.com>
Copilot AI changed the title [WIP] Expose all opencode capabilities through A2A Protocol Expose OpenCode capabilities through Agent2Agent (A2A) Protocol Feb 5, 2026
Copilot AI requested a review from jgranesa February 5, 2026 09:48
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants