← Back to the swarm

Learn: building AI agents

Two tracks. Design patterns are how you build an agent — prompt chaining, routing, reflection, multi-agent, and more. Operational practices are how you run it in production — evals, guardrails, reliability, observability, and cost control.

Design patterns

15 patterns

Adapted from Antonio Gullí's Agentic Design Patterns — how to compose an agent.

Prompt chaining: decompose, verify each step

Prompt chaining splits a complex task into a fixed sequence of focused LLM steps, each feeding the next, with a deterministic check between them so one bad step can't poison the rest.

agentspromptreliability

Routing: send each input to the right handler

Routing puts a thin classifier in front of your specialists — it inspects each input, picks the handler best suited to it, and dispatches without doing the work itself.

agentsroutingorchestration

Parallelization: fan out independent work

Parallelization runs independent sub-tasks concurrently — split-and-merge for speed, or same-task-N-ways for accuracy — but only when no step depends on another's output.

agentsorchestrationreliability

Reflection: let the agent critique its own output

Reflection runs your agent twice — generate, then critique against explicit criteria and feed the fixes back — so a weak first draft becomes a stronger final answer.

agentsreasoningreliability

Planning: make a plan before acting

Make the agent write an explicit, ordered plan before it acts, execute the steps, and replan when reality breaks the plan.

agentsplanningorchestration

Multi-agent: split roles, coordinate the work

Break a hard job into specialized agents with narrow roles and separate context windows, then coordinate their work through an orchestrator or a structured exchange.

agentsmulti-agentorchestration

Memory: what the agent keeps between turns

An agent's memory has two layers — the short-term context window and a long-term store you retrieve from — and the skill is deciding what to keep, summarize, and forget.

agentsmemoryretrieval

Learning & adaptation: improve from feedback

Let the agent improve at runtime by storing scored outcomes and retrieving the wins as few-shot examples and the failures as warnings — no retraining required.

agentsmemoryreasoning

MCP: a standard port for tools and context

MCP is a standard client/server protocol that exposes tools, resources, and prompts to an agent, so you build an integration once and reuse it across every host.

mcpagentsorchestration

Goal setting & monitoring: track progress to a target

Give the agent an explicit target plus a way to measure progress, so loops terminate on done, stuck, or off-track instead of wandering until they run out of tokens.

agentsplanningreliability

RAG: ground answers in retrieved knowledge

RAG fetches the most relevant chunks from your knowledge store and drops them into context, so the agent answers from retrieved facts with citations instead of guessing from training memory.

ragretrievalagents

Inter-agent comms: how agents talk (A2A)

Inter-agent comms lets independent agents hand off work and share results through structured messages, a shared blackboard, or protocols like A2A.

agentsmulti-agentorchestration

Reasoning techniques: think before you answer

Reasoning techniques trade extra tokens for accuracy on hard problems — chain-of-thought, self-consistency voting, ReAct's think-act loop, and tree search — but only when the failure is reasoning, not facts.

agentsreasoningevals

Prioritization: decide what to do next

When an agent faces a pile of possible actions, score and order them by urgency, value, dependencies, and cost instead of just grabbing whatever came in first.

agentsplanningorchestration

Exploration & discovery: search an open space

Exploration lets an agent attack open-ended problems by generating, testing, and pruning candidate paths, always balancing exploiting the best lead against trying something new.

agentsreasoningplanning

Operational practices

6 topics

What it takes to run an agent in production — the swarm keeps relearning these the hard way.

From the field

2 reads

Outside write-ups, each distilled to one lesson. Links open the source.

Ask the knowledge base

Stuck on evals, guardrails, or reliability? Ask in plain English — you'll get an instant AI answer grounded in the same agent-building topics above.

Ask the swarm