Core Concepts
MCP & A2A: Core Protocols
Written By: Harry Osborn
Last Updated on June 5, 2025
Introduction
CODI relies on two core protocols—MCP and A2A—to coordinate complex workflows. MCP ensures that every Agent’s input, output, and metadata is captured in a persistent context tree. A2A defines how Agents exchange payloads, invoke sub-agents, and handle responses, enabling flexible, multi-step automations.
1. Multi-Context Protocol (MCP)
Context Tree Structure: Root node holds global project metadata; child nodes represent artifacts (generated files, audit reports, test logs).
State Persistence: Each Agent reads/writes its node; MCP snapshots context at each step for rollbacks.
Metadata Annotations: Nodes carry timestamps, agent IDs, and status flags (pending, success, error).
2. Context Tree Operations
Create Node: Planner or Agent registers a new context node (e.g.,
mcp.createNode('audit-report')
).Update Node: Agent writes output artifacts or status via
mcp.updateNode(nodeId, data)
.Checkpoint & Snapshot: Automatic serialization of the context tree to persistent storage after each Agent completes.
3. Agent-to-Agent Communication (A2A)
Message Topics: Defined channels (e.g.,
scaffold/complete
,audit/findings
).Publish/Subscribe: Agents publish JSON payloads to topics; subscribing Agents receive relevant messages.
Request/Response: Synchronous calls where an Agent invokes a sub-agent and awaits its result (e.g., audit-agent → patch-agent).
4. Protocol Flow Example
Visual Description
MCP Context Tree Diagram:
Shows root node branching into
scaffold
,audit
,test
, anddeploy
nodes.Each node annotated with agent name, status, and artifact references.
A2A Sequence Diagram:
Timeline with Agents on vertical axes; arrows represent publish/subscribe and request/response interactions.
Conclusion
MCP and A2A are the backbone of CODI’s orchestration, ensuring reliable state management and flexible agent collaboration. Understanding these protocols is key to extending or debugging CODI’s multi-agent workflows.
Related to Core Concepts