Universal language for AI agents to collaborate. Framework-agnostic coordination across LangGraph, CrewAI, Semantic Kernel, and custom systems.
A2A (Agent-to-Agent) Protocol is a framework-agnostic standard for coordinating multiple AI agents. It allows agents built with different frameworks (LangGraph, CrewAI, Semantic Kernel, custom systems) to work together seamlessly.
The protocol focuses on task coordination, state sharing, and orchestration of complex multi-agent workflows.
A2A workflows define agents, tasks, and dependencies:
{
agents: [
{ id: "planner", role: "planning", framework: "langgraph" },
{ id: "researcher", role: "research", framework: "crewai" },
{ id: "executor", role: "execution", framework: "langgraph" }
],
tasks: [
{ id: "plan", agent: "planner" },
{ id: "research", agent: "researcher", depends: ["plan"] },
{ id: "execute", agent: "executor", depends: ["research", "plan"] }
]
}
Execution graph:
┌─────────┐
│ Plan │
└────┬────┘
│
┌────▼─────────┐
│ Research │
└────┬─────────┘
│
┌────▼─────────┐
│ Execute │
└──────────────┘
A2A integrates with the 6-dimension ontology for complete tracking:
groupIdTasks execute one after another:
Task1 → Task2 → Task3 → Task4
Independent tasks run simultaneously:
Task1 ─┐
Task2 ─┤→ Task4
Task3 ─┘
One task spawns multiple parallel subtasks:
┌─→ SubTask1 ─┐
Task1 ─┤─→ SubTask2 ─┤→ Task2
└─→ SubTask3 ─┘
Task execution depends on previous results:
┌─→ Task2 (if error)
Task1 ─┤
└─→ Task3 (if success)
A2A enables agents to share information:
A2A includes robust error handling:
A2A designed for large-scale workflows:
| Aspect | A2A | ACP | MCP |
|---|---|---|---|
| Primary Use | Task coordination | Agent messaging | Resource access |
| Focus | Workflow orchestration | Inter-agent chat | AI data access |
| State Management | Rich, versioned | Minimal | None |
| Task Tracking | Built-in | Via connections | Via tools |
✅ Keep tasks focused: Each task should have one clear purpose ✅ Use meaningful names: Make workflow easy to understand ✅ Set timeouts: Prevent infinite waits ✅ Monitor metrics: Track performance and success rates ✅ Version workflows: Track changes over time ✅ Document dependencies: Make relationships explicit
How this protocol maps to the 6-dimension ontology
A2A coordination happens within group boundaries
Role-based access determines which agents can coordinate with which
Agents, tasks, and workflow states stored as things
Task dependencies and delegations tracked as connections
Coordination events (task_created, task_started, task_completed) logged
Workflow patterns and outcomes stored for learning
Work with any agent framework - LangGraph, CrewAI, AutoGen, custom
Coordinate complex workflows with multiple specialized agents
Express dependencies, run tasks in parallel when possible
Keep agent states in sync across distributed systems
Coordinate planner, researcher, writer, and reviewer agents
Assemble domain-specific agents (sales, engineering, finance)
Handle failures gracefully with fallback agents
Pause workflows for human approval before proceeding
// Define workflow using A2A protocol
const workflow = {
id: "workflow_research_report",
name: "Research and Write Report",
agents: [
{
id: "agent_researcher",
role: "researcher",
task: "research_topic",
inputs: { topic: "${topic}" }
},
{
id: "agent_writer",
role: "writer",
task: "write_report",
inputs: { research: "${agent_researcher.output}" },
dependencies: ["agent_researcher"]
},
{
id: "agent_editor",
role: "editor",
task: "review_report",
inputs: { report: "${agent_writer.output}" },
dependencies: ["agent_writer"]
}
],
outputs: {
finalReport: "${agent_editor.output}"
}
};
// Create workflow as thing
const workflowId = await ctx.db.insert("things", {
type: "workflow",
name: workflow.name,
groupId: ctx.auth?.getOrganizationId?.(),
properties: {
workflow: workflow,
status: "draft"
},
status: "active",
createdAt: Date.now(),
updatedAt: Date.now()
});
// Execute multi-agent workflow
import { A2AClient } from "@a2a/sdk";
const client = new A2AClient({ apiKey: process.env.A2A_API_KEY });
// Start workflow
const execution = await client.workflow.execute({
workflowId: "workflow_research_report",
inputs: {
topic: "Quantum Computing Applications"
},
agents: [
{ id: "researcher", framework: "crewai" },
{ id: "writer", framework: "langgraph" },
{ id: "editor", framework: "custom" }
]
});
// Monitor execution
execution.on("agent_completed", (event) => {
console.log(`${event.agentId} completed: ${event.output}`);
// Log to ontology
await ctx.db.insert("events", {
type: "task_completed",
groupId: ctx.auth?.getOrganizationId?.(),
actorId: event.agentId,
targetId: workflowId,
metadata: {
protocol: "a2a",
taskId: event.taskId,
result: event.output
},
timestamp: Date.now()
});
});
const result = await execution.wait();
return result.outputs.finalReport;
// A2A with error handling and fallback agents
const workflow = {
tasks: [
{
id: "primary_search",
agent: "web_search_agent",
fallback: {
agent: "cache_search_agent",
condition: "timeout || rate_limit"
}
}
]
};
// Implement fallback handling
try {
result = await executeWithA2A(workflow.tasks[0]);
} catch (error) {
if (shouldUseFallback(error, workflow.tasks[0].fallback)) {
result = await executeWithA2A(workflow.tasks[0].fallback);
// Log fallback event
await ctx.db.insert("events", {
type: "agent_fallback",
metadata: {
protocol: "a2a",
primary: workflow.tasks[0].agent,
fallback: workflow.tasks[0].fallback.agent,
reason: error.message
},
timestamp: Date.now()
});
}
}