5 AI Protocols — One Progression: Prompt → Tool Call → RAG → MCP → A2A (Architecture Cheat Sheet)
The complete 5-level AI engineering progression: how each protocol solves the exact bottleneck of the one before it, with JSON schemas, pgvector SQL, MCP config, A2A Agent Cards, and a 1-page architecture decision tree.
Most developers learn Prompting, Tool Calling, RAG, MCP, and A2A as five disconnected buzzwords.
In reality, they form one strict engineering progression—where each level was invented solely to fix the breaking point of the level before it.
📥 Download the 1-Page Printable Cheat Sheet:
1. The 5-Level AI Protocol Comparison Matrix
| Level | Protocol | Core Mechanism | What It Solves | Breaking Point (Why You Need the Next Level) |
|---|---|---|---|---|
| 01 | Raw Prompts | Text In → Frozen Weights → Text Out | Summarization, translation, zero-setup text generation | Hallucinates live facts and cannot trigger real-world actions or APIs |
| 02 | Tool Calling | Model emits structured { name, arguments } JSON; your server executes the function | Live API lookups (Stripe, weather, SQL row by ID) & deterministic actions | Context overflow—you cannot stuff 10,000 internal PDFs into a function argument |
| 03 | Vector RAG | Embed query → Cosine similarity search → Inject only Top-$K$ relevant chunks | Grounded answers over millions of private documents with citations | $M \times N$ Glue Code—every AI app still rewrites custom wrappers for every tool |
| 04 | MCP | Universal JSON-RPC 2.0 pipe exposing Tools, Resources, and Prompts | Write 1 MCP Server once; plug into Claude Code, Cursor, Windsurf, or custom hosts | Single-Agent Bottleneck—one agent’s context window overflows on complex multi-domain workflows |
| 05 | A2A Protocol | Peer-to-peer task delegation via /.well-known/agent.json & HTTP/SSE streams | Multi-agent teamwork across opaque security boundaries without sharing internal memory or API keys | Full enterprise multi-agent mesh (combines all 5 layers!) |
2. Level 01 → Level 05: Copy-Paste Schemas & Payloads
Level 01: Raw Prompts (POST /v1/chat/completions)
A stateless text completion call. The model only knows what was baked into its weights before its training cutoff.
{
"model": "claude-sonnet-4-20250514",
"messages": [
{
"role": "user",
"content": "What was our Q3 Stripe revenue?"
}
]
}
- Failure mode: Because the model has zero live database access, it either refuses or guesses a hallucinated number.
Level 02: Tool Calling (Structured Function Intent)
Instead of guessing, the LLM pauses generation and outputs a structured JSON object matching your function schema. The LLM does not execute the code—your backend executes it and feeds the result back.
// 1. LLM emits structured tool_use intent:
{
"type": "tool_use",
"id": "toolu_01A09q90qw90lq917835lq9",
"name": "get_stripe_revenue",
"input": {
"quarter": "2026-Q3",
"currency": "USD"
}
}
// 2. Your backend executes stripe.revenue("2026-Q3") and returns:
{
"role": "tool",
"tool_use_id": "toolu_01A09q90qw90lq917835lq9",
"content": "{\"quarter\":\"2026-Q3\",\"net_revenue_usd\":1420000}"
}
Level 03: Vector RAG (Retrieval-Augmented Generation with pgvector)
When a user asks a question spanning 10,000 internal runbooks or PDFs, you embed their query into a dense vector (1536 floats) and retrieve only the Top-3 closest chunks via cosine distance (<=>):
-- Retrieve Top-3 semantically relevant chunks in PostgreSQL + pgvector
SELECT
doc_id,
section_title,
chunk_text,
1 - (embedding <=> $1::vector) AS cosine_similarity
FROM company_knowledge_chunks
WHERE 1 - (embedding <=> $1::vector) > 0.78
ORDER BY embedding <=> $1::vector ASC
LIMIT 3;
Level 04: MCP (Model Context Protocol — .mcp.json)
Instead of writing custom API wrappers for GitHub, Postgres, and Sentry in every single agent, MCP standardizes tool discovery (tools/list), execution (tools/call), and data attachment (resources/read) over a single JSON-RPC 2.0 pipe:
{
"mcpServers": {
"postgres": {
"command": "npx",
"args": ["-y", "@modelcontextprotocol/server-postgres", "postgresql://localhost/prod_ro"]
},
"github": {
"command": "npx",
"args": ["-y", "@modelcontextprotocol/server-github"],
"env": {
"GITHUB_PERSONAL_ACCESS_TOKEN": "${GITHUB_TOKEN}"
}
}
}
}
Level 05: A2A Protocol (Agent-to-Agent Task Delegation)
While MCP connects an agent to tools, A2A connects an agent to other specialist agents. Each specialist publishes an Agent Card at /.well-known/agent.json so peer agents can delegate tasks without ever seeing the specialist’s internal prompts, memory, or credentials:
// GET https://security-agent.internal/.well-known/agent.json
{
"name": "SecurityAuditAgent",
"description": "Autonomous SAST/DAST and dependency vulnerability auditor for pull requests.",
"url": "https://security-agent.internal/a2a",
"version": "1.0.0",
"capabilities": {
"streaming": true,
"pushNotifications": false
},
"skills": [
{
"id": "audit-pr",
"name": "Audit Pull Request",
"inputModes": ["application/json"],
"outputModes": ["application/json"]
}
]
}
3. Architecture Decision Tree: Which Layer Should You Use?
- Does the task only need text transformation or reasoning over text the user already pasted? $\to$ Stop at Level 01 (Raw Prompt). Keep it simple.
- Does the model need to check 1–5 live APIs or trigger a database mutation? $\to$ Add Level 02 (Tool Calling).
- Does the model need to search across thousands of unstructured docs, tickets, or runbooks? $\to$ Add Level 03 (Vector RAG).
- Are you connecting multiple tools across IDEs (
Claude Code,Cursor) and backend services? $\to$ Standardize on Level 04 (MCP). - Do you have separate domain agents (Coding, Security, Data, Billing) owned by different teams or security boundaries? $\to$ Connect them at Level 05 (A2A Protocol).
Test Your Understanding
Quick architectural scenario challenge based on this breakdown.
A 3rd-party payment gateway starts timing out with 504 errors during peak traffic.
Q1.How should a downstream dependency failure be handled to protect upstream service availability?
Comments –
Sign in to share your thoughts
Nothing yet. Be the first.