Routing

AI Engineers, Product Managers

Recipe Overview

Tasks often vary by type (e.g., translation vs. coding vs. QA). A routing agent first classifies input and then sends it to the specialized sub-agent best suited for that task. The problem it solves is that one-size-fits-all prompts fail across diverse requests. Anthropic describes routing as directing inputs to specialized models or prompts based on content. For instance, the agent might detect a math question and use a calculation model, or recognize a creative prompt and switch to a more imaginative model. This solves accuracy by matching task types to optimal handling, improving both speed and quality across diverse workflows.

Why This Recipe Works

Directs inputs to specialized models based on content type, improving task-specific performance

Implementation Tips

Best For:

AI Engineers, Product Managers

Key Success Factor:

Directs inputs to specialized models based on content type, improving task-specific performance...

More AI Agent Recipes

Discover other proven implementation patterns

Developers, Data Scientists

Prompt Chaining

When faced with a complex multi-step task, breaking it into sequential prompts can simplify the problem for the model.

Read Recipe →
Software Engineers, Operations Teams

Parallelization

When different parts of a task can be done simultaneously, parallelization speeds up processing.

Read Recipe →
Engineering Managers, System Architects

Orchestrator-Workers

Complex tasks with unpredictable subtasks require dynamic breakdown.

Read Recipe →
Quality Assurance, Content Creators

Evaluator-Optimizer

Ensuring answer quality can be hard in one pass.

Read Recipe →
Researchers, System Administrators

Autonomous Agent

Some tasks have no fixed steps and require continuous control.

Read Recipe →
Analysts, Researchers

Reflection Pattern

LLMs may make logical mistakes without self-review.

Read Recipe →