Skip to content

feat: A2A (Agent-to-Agent) protocol support - Phase 1#12008

Draft
roomote-v0[bot] wants to merge 1 commit intomainfrom
feature/a2a-protocol-support
Draft

feat: A2A (Agent-to-Agent) protocol support - Phase 1#12008
roomote-v0[bot] wants to merge 1 commit intomainfrom
feature/a2a-protocol-support

Conversation

@roomote-v0
Copy link
Copy Markdown
Contributor

@roomote-v0 roomote-v0 bot commented Mar 26, 2026

Summary

This PR attempts to address Issue #12007 by implementing Phase 1 of A2A (Agent-to-Agent) protocol support, following the guidance from @farazoman.

What's Included (Phase 1)

New A2A Types (packages/types/src/a2a.ts)

  • Agent configuration schema (URL, headers, timeout, disabled state)
  • A2A protocol types: Task, Message, Part (text/file/data), Artifact, TaskStatus
  • JSON-RPC request/response types per the A2A spec
  • Agent Card type for optional capability discovery
  • Runtime agent state for UI display

A2aHub Service (src/services/a2a/A2aHub.ts)

  • Manages A2A agent connections (mirrors MCP Hub pattern)
  • Settings file management: a2a_settings.json (global) and .roo/a2a.json (project-level)
  • File watching for auto-reload on config changes
  • JSON-RPC 2.0 over HTTP communication (tasks/send, tasks/get, tasks/cancel)
  • Configurable headers for authentication (JSON key-value pairs)
  • Optional Agent Card fetching from /.well-known/agent.json

delegate_to_agent Tool (src/core/tools/DelegateToAgentTool.ts)

  • New tool for delegating tasks to external A2A agents
  • Parameters: agent_name (required), message (required)
  • Validates agent existence, gets user approval, formats results
  • Handles task states including input-required for continued conversation

Integration

  • New a2a tool group added to tool system and code mode
  • System prompt capabilities section lists available A2A agents
  • Native tool definition registered for model consumption
  • NativeToolCallParser handles delegate_to_agent args
  • ClineProvider initializes and manages A2aHub lifecycle

Design Decisions per Issue Discussion

  1. Latest A2A spec - JSON-RPC 2.0 over HTTP
  2. Phased approach - Phase 1 (client delegation) only; Phase 3 out of scope
  3. Manual configuration only - No auto-discovery
  4. Background sub-tasks - Prompts aware of A2A capabilities
  5. Simple auth - Configurable headers as JSON key-value pairs
  6. Custom agent use case - Seamless alternative to wrapping agents in MCP

Configuration Example

{
  "a2aAgents": {
    "my-agent": {
      "url": "https://my-agent.example.com/a2a",
      "headers": {
        "Authorization": "Bearer sk-..."
      },
      "description": "My specialized agent",
      "timeout": 300
    }
  }
}

Tests

  • A2aHub service tests (10 tests passing)
  • All existing tests continue to pass (validateToolUse, mcp_server, sections)
  • Full lint and type-check pass across all 14 packages

Feedback and guidance are welcome!

Interactively review PR in Roo Code Cloud

Implements Phase 1 of A2A protocol support as discussed in #12007:
- A2A types (agent config, task, message, artifact types)
- A2aHub service for managing agent connections
- delegate_to_agent tool for delegating tasks to external agents
- Manual configuration via a2a_settings.json (global/project)
- Configurable headers for authentication (JSON key-value pairs)
- Integration with system prompt, tool parser, and ClineProvider
- A2A tool group added to code mode
- Tests for A2aHub service
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.

1 participant