Foundations

Before picking a pattern, build the mental models. This section covers the vocabulary, anatomy, and decision frameworks you'll use throughout the repository.

Foundations

This section establishes the mental models and vocabulary you need before diving into any specific pattern. Read this first.

What Are LLM Applications?

An LLM application is any system that uses a large language model to process inputs and produce outputs. These range from a single API call with a well-crafted prompt to complex multi-agent systems that plan, reason, and act autonomously.

Most production LLM systems fall somewhere on this spectrum:

graph LR A([Single LLM Call]) -->|"adds structure"| B([Prompt Chain]) B -->|"adds orchestration"| C([LLM Workflow]) C -->|"adds autonomy"| D([Agent]) D -->|"adds collaboration"| E([Multi-Agent System]) style A fill:#e8f5e9 style B fill:#c8e6c9 style C fill:#a5d6a7 style D fill:#81c784 style E fill:#66bb6a

Single LLM Call — One prompt in, one response out. No loops, no tools. Useful for classification, summarization, and extraction.

Prompt Chain — Multiple LLM calls in sequence where each output feeds the next input. Adds structure and validation gates between steps.

LLM Workflow — Orchestrated patterns of LLM calls with branching, parallelism, or evaluation loops. The system follows a predetermined control flow — the code decides what happens next, not the LLM.

Agent — An LLM-driven system where the model itself decides what to do next. The LLM chooses which tools to call, when to stop, and how to respond to observations. Control flow is dynamic.

Multi-Agent System — Multiple agents collaborating, each with specialized capabilities. A supervisor or protocol coordinates their interactions.

The Key Insight

The difference between a workflow and an agent is who controls the loop:

  • In a workflow, the developer writes the control flow. The LLM fills in the blanks.
  • In an agent, the LLM is the control flow. The developer provides tools and constraints.

This distinction matters because it determines your system's predictability, debuggability, and failure modes. Workflows are easier to test and reason about. Agents are more flexible but harder to control.

How This Repository Is Organized

Section What It Covers Start Here If...
Foundations Core concepts, terminology, pattern selection You're new to agent design
Workflows Pre-agent LLM patterns (chaining, parallelism, orchestration, evaluation) You need structured LLM pipelines
Agent Patterns Agent architectures (ReAct, planning, memory, RAG, multi-agent) You need autonomous LLM behavior
Composition How to combine patterns into complete systems You're designing a production system

Reading Order

If you're learning from scratch, read in this order:

  1. Terminology — Get the vocabulary right
  2. Anatomy of an Agent — Understand what makes agents tick
  3. Choosing a Pattern — Pick the right tool for your problem
  4. Workflows — Learn the foundational patterns
  5. Agent Patterns — See how workflows evolve into agents

Before shipping to production, also read:

  • Anti-Patterns — The 12 most common design mistakes and how to avoid them

In This Section

  • Terminology — Precise definitions of agent, workflow, tool, and other overloaded terms
  • Anatomy of an Agent — The components every agent has and what distinguishes agents from workflows
  • Choosing a Pattern — Decision flowchart and guidance for selecting the right pattern
  • Anti-Patterns — What not to build, why people build it anyway, and the correct alternative
  • Testing Strategies — Unit tests, mock LLMs, integration tests, evaluation, and regression testing for LLM systems