Tool calling is how AI agents interact with the real world. Here are the four most common patterns.
Pattern 1: Sequential (most common)
The agent calls tools one after another, using each result to decide the next step.
Read file → Find bug → Fix code → Run tests → Commit
When to use: Most coding tasks. Claude Code and Aider use this pattern.
Pattern 2: Parallel
Multiple tool calls at once for independent tasks.
Check server A ─┐
Check server B ─┤→ Aggregate results → Report
Check server C ─┘
When to use: Monitoring, batch operations. Kimi’s Agent Swarm uses this at scale with up to 100 parallel agents.
Pattern 3: Conditional
The agent decides which tool to call based on context.
If error is in frontend → use browser tool
If error is in backend → use log reader tool
If error is in database → use SQL tool
When to use: Debugging workflows, model routing.
Pattern 4: Recursive (agent loop)
The agent calls tools in a loop until a condition is met.
Write code → Run tests → Tests fail → Fix code → Run tests → Tests pass → Done
When to use: Agentic coding, auto-fixing, iterative refinement.
Implementing with MCP
MCP standardizes tool calling across AI providers. Build your tools as MCP servers and they work with any host. See our TypeScript and Python tutorials.
Security
Every pattern needs guardrails: max iterations for loops, timeouts for parallel calls, permission checks for conditionals. See our MCP Security Checklist.
Related: What is Tool Calling? · MCP Complete Guide · How to Build an AI Agent