# Agentic Pattern Library > 48 design patterns by Vikas Goyal in two tracks: designing agentic AI systems, and building software with AI coding agents. Each pattern has a problem, forces, solution, when to use and avoid, trade-offs, failure modes, related patterns and a worked example. Numbers in worked examples are illustrative, not recommendations. Choose real values from your requirements and make them configurable. ## Machine-readable versions - [All patterns as JSON](https://vikasgoyal.github.io/agentic/patterns/patterns.json): structured fields for every pattern - [All patterns as Markdown](https://vikasgoyal.github.io/agentic/patterns/llms-full.txt): full text of every card in one file - [Agent skill](https://vikasgoyal.github.io/agentic/patterns/skill/SKILL.md): drop-in SKILL.md for coding agents ## Track: Agentic systems ### Core loop - [Tool Use](https://vikasgoyal.github.io/agentic/patterns/tool-use/): The model calls external functions or APIs through structured schemas, grounding it in real data and actions. - [ReAct](https://vikasgoyal.github.io/agentic/patterns/react/): Reason, act, observe, repeat. The default loop in most agent frameworks. - [Plan-and-Execute](https://vikasgoyal.github.io/agentic/patterns/plan-and-execute/): Write the plan first, then execute step by step and replan on failure. - [Reflection](https://vikasgoyal.github.io/agentic/patterns/reflection/): The agent critiques and revises its own output before returning it. - [Prompt Chaining](https://vikasgoyal.github.io/agentic/patterns/prompt-chaining/): A fixed sequence of LLM calls with checks between steps. Predictable and debuggable. - [Routing](https://vikasgoyal.github.io/agentic/patterns/routing/): Classify the request and send it to the right prompt, model or agent. - [Parallelization](https://vikasgoyal.github.io/agentic/patterns/parallelization/): Run independent subtasks at once, or run one task several times and vote. ### Multi-agent - [Orchestrator–Workers](https://vikasgoyal.github.io/agentic/patterns/orchestrator-workers/): A lead agent decomposes the task at runtime, delegates, and merges results. - [Evaluator–Optimizer](https://vikasgoyal.github.io/agentic/patterns/evaluator-optimizer/): One agent generates, another grades against a rubric, and they loop until it passes. - [Hierarchical Supervisor](https://vikasgoyal.github.io/agentic/patterns/hierarchical-supervisor/): Managers over leads over specialists, mirroring an org chart. - [Handoff](https://vikasgoyal.github.io/agentic/patterns/handoff/): Agents pass control and context peer-to-peer with no central boss. - [Debate / Multi-Critic](https://vikasgoyal.github.io/agentic/patterns/debate/): Agents argue from different viewpoints and a judge picks the answer. - [Blackboard](https://vikasgoyal.github.io/agentic/patterns/blackboard/): Agents read and write a shared workspace and contribute when they can. ### Context & memory - [Agentic RAG](https://vikasgoyal.github.io/agentic/patterns/agentic-rag/): The agent decides when and what to retrieve, rewrites queries and checks relevance. - [Tiered Memory](https://vikasgoyal.github.io/agentic/patterns/tiered-memory/): Working, episodic and semantic memory stored and recalled separately. - [Context Compaction](https://vikasgoyal.github.io/agentic/patterns/context-compaction/): Summarize or prune history so long tasks fit the context window. - [Sub-agent Context Isolation](https://vikasgoyal.github.io/agentic/patterns/context-isolation/): A sub-agent explores in a clean context and returns only a summary. ### Safety & control - [Human-in-the-Loop](https://vikasgoyal.github.io/agentic/patterns/human-in-the-loop/): Pause for human approval before risky or irreversible actions. - [Guardrails](https://vikasgoyal.github.io/agentic/patterns/guardrails/): Input and output filters, policy checks and schema validation around the agent. - [Bounded Autonomy](https://vikasgoyal.github.io/agentic/patterns/bounded-autonomy/): Limits enforced by policy, not prompts: tool allowlists, spend caps, scope. - [Sandboxed Execution](https://vikasgoyal.github.io/agentic/patterns/sandboxed-execution/): Code and actions run in isolation with checkpoints and rollback. ### Runtime & interop - [Agent Harness](https://vikasgoyal.github.io/agentic/patterns/agent-harness/): A reusable runtime for loop, tools, memory, permissions and progress, instead of one-off scripts. - [Code-as-Action](https://vikasgoyal.github.io/agentic/patterns/code-as-action/): The agent writes code that chains many tool calls, instead of one JSON call per step. - [Skills / Progressive Disclosure](https://vikasgoyal.github.io/agentic/patterns/skills/): Packaged instructions load only when relevant, keeping base context small. - [Protocol Interop (MCP / A2A)](https://vikasgoyal.github.io/agentic/patterns/protocol-interop/): Standard servers for tools and agent-to-agent messaging across vendors. - [Budget-aware Planning](https://vikasgoyal.github.io/agentic/patterns/budget-aware-planning/): Each stage gets a token, time or dollar budget and degrades gracefully. - [Ambient Agents](https://vikasgoyal.github.io/agentic/patterns/ambient-agents/): Always-on agents watch event streams and act or alert without a prompt. - [Generative UI](https://vikasgoyal.github.io/agentic/patterns/generative-ui/): The agent renders or changes interface elements, not just chat text. - [Delegated Agent Identity](https://vikasgoyal.github.io/agentic/patterns/delegated-identity/): Agents get their own scoped, auditable credentials to act for a user. ### Evaluation & learning - [Rubric LLM-as-Judge](https://vikasgoyal.github.io/agentic/patterns/llm-as-judge/): Automated graders with explicit rubrics for CI evals and runtime monitoring. - [Self-Improving Learning Loop](https://vikasgoyal.github.io/agentic/patterns/learning-loop/): Feedback and outcomes become updated memory, skills or prompts over time. ### Fast & slow - [Talker–Reasoner](https://vikasgoyal.github.io/agentic/patterns/talker-reasoner/): A System 1 model keeps the conversation live while a System 2 model works in the background. - [Fast/Slow Escalation](https://vikasgoyal.github.io/agentic/patterns/fast-slow-escalation/): System 1 by default; escalate to System 2 when signals say the task is hard. - [Draft–Verify](https://vikasgoyal.github.io/agentic/patterns/draft-verify/): System 1 drafts quickly; System 2 checks or corrects the draft. - [Respond-then-Refine](https://vikasgoyal.github.io/agentic/patterns/respond-then-refine/): An instant first answer from System 1, followed by a refined System 2 version. - [Adaptive Thinking Budget](https://vikasgoyal.github.io/agentic/patterns/adaptive-thinking/): One model switches between no thinking and deep thinking based on difficulty. - [Metacognitive Monitor](https://vikasgoyal.github.io/agentic/patterns/metacognitive-monitor/): A lightweight watcher spots surprises and switches the agent into System 2 mode. - [Habit Formation](https://vikasgoyal.github.io/agentic/patterns/habit-formation/): Repeated System 2 solutions get compiled into fast System 1 skills or rules. - [Reflex Layer](https://vikasgoyal.github.io/agentic/patterns/reflex-layer/): Instant System 1 responses for routine or safety-critical checks: triage, guardrails, stop/continue. ## Track: Building with coding agents ### Working agreements - [Spec-Driven Development](https://vikasgoyal.github.io/agentic/patterns/spec-driven-development/): A short spec is the source of truth; the agent builds from it, not from chat history. - [Project Memory File](https://vikasgoyal.github.io/agentic/patterns/project-memory-file/): A CLAUDE.md or AGENTS.md file holds conventions, commands and decisions that build up over time. - [Agent-Ready Repo](https://vikasgoyal.github.io/agentic/patterns/agent-ready-repo/): One-command setup, scripted checks and clear docs, so an agent can run and verify its own work. - [Artifact Ownership](https://vikasgoyal.github.io/agentic/patterns/artifact-ownership/): Each artifact is marked developer-owned, AI-drafted or joint, so everyone knows who decides what. ### Build loop - [Plan-then-Code](https://vikasgoyal.github.io/agentic/patterns/plan-then-code/): The agent proposes a plan; a human approves it before any files change. - [Test-First Agent Loop](https://vikasgoyal.github.io/agentic/patterns/test-first-loop/): Tests define "done"; the agent iterates until they pass. - [Thin-Slice MVPs](https://vikasgoyal.github.io/agentic/patterns/thin-slice-mvps/): Each session ships one small, working vertical slice (MVP1 → MVP2 → MVP3). ### Review & scale - [PR as Review Gate](https://vikasgoyal.github.io/agentic/patterns/pr-review-gate/): Agents work on branches, and every change lands through a reviewed pull request. - [Parallel Agents in Worktrees](https://vikasgoyal.github.io/agentic/patterns/parallel-worktrees/): Several agents work on isolated branches at once, then merge through review.