Agent Architectures

Easy 25 min read

Architecture Overview

Why Architecture Matters

The Problem: A single agent approach works for simple tasks, but complex workflows require coordinating multiple capabilities, routing decisions, and error recovery.

The Solution: Agent architectures provide proven patterns for organizing agent systems -- from simple single-agent setups to sophisticated multi-agent orchestrations.

Real Impact: Choosing the right architecture can mean the difference between an agent that handles 80% of cases and one that handles 99%.

Real-World Analogy

Think of agent architectures like company structures:

  • Single Agent = A solo freelancer who does everything
  • Router = A receptionist who directs you to the right department
  • Multi-Agent = A team of specialists collaborating on a project
  • Hierarchical = A company with managers overseeing specialist teams

Comparing Architectures

Single Agent

One LLM handles everything -- perception, reasoning, tool use, and response. Simple to build but limited in complexity.

Router Architecture

A classifier agent routes requests to specialized sub-agents. Great for diverse task types with clear boundaries.

Parallel Multi-Agent

Multiple agents work simultaneously on different aspects of a task. Results are combined by an aggregator.

Orchestrator-Worker

A central orchestrator breaks tasks into subtasks and delegates to worker agents, then synthesizes results.

Single Agent Architecture

Architecture Comparison
Single Agent User Agent Tools Simple, one LLM does everything Router Architecture Router Agent A Agent B Agent C Orchestrator-Worker Pattern Orchestrator Worker 1 Worker 2 Worker 3 Worker 4

Router Architecture

router_agent.py
class RouterAgent:
    def __init__(self):
        self.agents = {
            "code": CodeAgent(),
            "research": ResearchAgent(),
            "data": DataAnalysisAgent(),
        }

    def route(self, query):
        # Use LLM to classify the intent
        intent = self.classify(query)
        agent = self.agents[intent]
        return agent.run(query)

    def classify(self, query):
        response = llm.chat(messages=[{
            "role": "system",
            "content": "Classify: code, research, or data"
        }, {"role": "user", "content": query}])
        return response.strip().lower()

Multi-Agent Systems

When to Use Multi-Agent

  • Parallel processing: Different aspects of a task can be handled simultaneously
  • Specialization: Each agent has deep expertise in one domain
  • Debate/verification: Agents can check each other's work
  • Complex workflows: Tasks that naturally decompose into independent subtasks

Hierarchical Agents

ArchitectureComplexityBest ForTradeoff
SingleLowSimple tasks, prototypingLimited capability
RouterMediumDiverse task typesClassification errors
ParallelMediumIndependent subtasksCoordination overhead
OrchestratorHighComplex multi-step workflowsHigher latency and cost
HierarchicalVery HighEnterprise-scale systemsSignificant engineering

Quick Reference

PatternDescriptionExample Use Case
Single AgentOne LLM + tools handles all tasksPersonal coding assistant
RouterClassifier routes to specialistsCustomer support with departments
Fan-out/Fan-inParallel agents, results aggregatedMulti-source research
Orchestrator-WorkerManager delegates to workersComplex data pipeline builder
Evaluator-OptimizerOne generates, another evaluatesCode review and improvement