a2a_tool.md · 8.0 KB

A2A Tool

Summary

The A2A (Agent-to-Agent) Tool enables standardized agent-to-agent communication following the A2A protocol. It provides capabilities for agent discovery, message passing, authentication, and interoperability with external A2A-compatible systems.

External Resources

Official A2A Python SDK

AgenticPlace Organization

- A2A: Open protocol for agent communication and interoperability - mindXalpha/beta/gamma: mindX augmentic deployments - SimpleCoder: Coding agent working with mindX BDI control - mcp.agent: Google Cloud MCP server/client for agents - ROMA: Meta-agent framework for multi-agent systems - DeepResearchAgent: Hierarchical multi-agent research system

Technical Explanation

The A2A Tool follows mindX doctrine:

Architecture

Features

Usage

Registering an Agent

from tools.a2a_tool import A2ATool
from agents.memory_agent import MemoryAgent

memory_agent = MemoryAgent() a2a_tool = A2ATool(memory_agent=memory_agent)

result = await a2a_tool.execute( operation="register_agent", agent_id="my_agent_123", name="My Agent", description="A helpful AI agent", capabilities=["text_generation", "code_analysis", "data_processing"], endpoint="https://mindx.internal/my_agent_123/a2a", public_key="0x...", version="1.0.0" )

agent_card = result["agent_card"]

Discovering Agents

# Discover all agents
result = await a2a_tool.execute(operation="discover_agents")

Discover by query

result = await a2a_tool.execute( operation="discover_agents", query="code analysis" )

Discover by capability

result = await a2a_tool.execute( operation="discover_agents", capability="text_generation" )

Sending Messages

result = await a2a_tool.execute(
    operation="send_message",
    from_agent="agent_1",
    to_agent="agent_2",
    message_type="request",
    payload={
        "action": "analyze_code",
        "code": "...",
        "language": "python"
    }
)

message_id = result["message_id"]

Receiving Messages

result = await a2a_tool.execute(
    operation="receive_message",
    agent_id="agent_2"
)

message = result["message"]

Querying Capabilities

result = await a2a_tool.execute(
    operation="query_capabilities",
    agent_id="my_agent_123"
)

capabilities = result["capabilities"]

Executing Actions

result = await a2a_tool.execute(
    operation="execute_action",
    from_agent="agent_1",
    to_agent="agent_2",
    action="process_data",
    parameters={
        "data": "...",
        "format": "json"
    }
)

Generating Discovery Endpoint

result = await a2a_tool.execute(
    operation="generate_discovery_endpoint",
    base_url="https://mindx.internal"
)

discovery_url = result["discovery_endpoint"]

Returns: https://mindx.internal/.well-known/agents.json

Operations

Core Operations

External Resource Operations

Integration

The A2A Tool integrates with:

GitHub Agent Integration

from tools.a2a_tool import A2ATool
from tools.github_agent_tool import GitHubAgentTool
from agents.memory_agent import MemoryAgent

memory_agent = MemoryAgent() github_agent = GitHubAgentTool(memory_agent=memory_agent) a2a_tool = A2ATool(memory_agent=memory_agent, github_agent=github_agent)

Get external resources

result = await a2a_tool.execute(operation="get_external_resources")

Get AgenticPlace repositories

result = await a2a_tool.execute(operation="get_agenticplace_repos")

Sync with AgenticPlace (creates backup first)

result = await a2a_tool.execute(operation="sync_with_agenticplace")

File Structure

data/a2a/
├── agent_cards_registry.json    # Agent cards registry
├── messages_registry.json       # Message history
├── agent_cards/                 # Individual agent cards
│   └── {agent_id}.json
├── messages/                     # Individual messages
│   └── {message_id}.json
└── .well-known/                 # Discovery endpoint
    └── agents.json

Protocol Details

Message Format

{
  "message_id": "msg_123",
  "from_agent": "agent_1",
  "to_agent": "agent_2",
  "message_type": "request",
  "protocol_version": "2.0",
  "timestamp": "2024-01-01T00:00:00Z",
  "payload": {...},
  "signature": "...",
  "metadata": {...}
}

Agent Card Format

{
  "agent_id": "agent_123",
  "name": "Agent Name",
  "description": "Agent description",
  "version": "1.0.0",
  "capabilities": ["cap1", "cap2"],
  "endpoint": "https://...",
  "public_key": "0x...",
  "signature": "..."
}

Use Cases

  1. Inter-Agent Communication: Agents communicate with each other
  2. Capability Discovery: Find agents with specific capabilities
  3. Action Delegation: Delegate tasks to specialized agents
  4. External Integration: Connect with A2A-compatible systems
  5. Agent Marketplace: Enable agent discovery and interaction
  6. A2A SDK Integration: Use official a2a-python SDK for protocol compliance
  7. AgenticPlace Sync: Sync with AgenticPlace repositories for interoperability
  8. GitHub Backup: Automatic backup before syncing external resources

Claude Access

Claude has access to the following external resources through this tool:

- A2A protocol implementation - mindX deployment variants (alpha, beta, gamma) - SimpleCoder coding agent - MCP agent for Google Cloud - ROMA multi-agent framework - DeepResearchAgent


All DocumentsDocument IndexThe Book of mindXImprovement JournalAPI Reference