Thursday, November 12, 2026

What Are Compound AI Systems? Models, Agents, and Building AI Products

Say a team builds a support assistant on top of a single language model. In the demo it answers every question about refunds in clear, friendly sentences. A week after launch, a customer is told refunds take 30 days. The real policy, changed last month, is 14 days, and the model had no way to know.

The fix is not a bigger model. It is a system around the model. A compound AI system is an AI application that handles a task with several interacting parts, such as multiple model calls, a retriever, external tools and code that checks the results, instead of relying on one model call alone. Most useful AI products today are built this way. This guide explains what a compound AI system is, where the term comes from, what the parts are, and how to decide how much system your product needs.

Key Takeaways

  • A compound AI system combines a model with other components, such as retrieval, tools, verifiers and control logic, to complete a task one model call cannot do reliably alone.
  • The term comes from a February 2024 Berkeley AI Research (BAIR) post by Matei Zaharia, Omar Khattab and colleagues, which argued that the best AI results were increasingly coming from systems rather than single models.
  • Retrieval-augmented generation (RAG) is the most common compound system. Agents are another kind, where the model itself decides which step comes next.
  • Each added part can improve accuracy, freshness or control, but it also adds cost, latency and new ways to fail. Evaluate the whole system, not only the model.
  • Start with the simplest pipeline that meets your quality bar, and add components only when a measured problem calls for them.

What Is a Compound AI System?

A compound AI system is software that solves an AI task with more than one component working together. The components can include several calls to the same or different models, a search index or vector database, external tools such as a calculator or an API, and ordinary code that decides what runs next and whether a result is good enough.

The phrase took hold after the Berkeley AI Research blog published The Shift from Models to Compound AI Systems on February 18, 2024. Its authors, including Matei Zaharia and Omar Khattab, pointed out that many state-of-the-art results no longer came from a model on its own. They came from systems that wrap models in other parts.

Two examples from that post show the idea. Google DeepMind’s AlphaCode 2 generates up to a million candidate programs for a coding problem and then filters them down to a few answers. AlphaGeometry pairs a language model with a symbolic geometry solver: the model suggests constructions, and the solver does the exact reasoning. The post also cited Databricks data showing that 60% of LLM applications used some form of retrieval and 30% used multi-step chains.

Why Not Just Use a Bigger Model?

A larger model often helps, but it cannot fix every problem. The support assistant from the opening shows four limits that a system can address and a model cannot:

  • Fresh and private data. A model only knows what was in its training data. Your current refund policy, your customer’s order and yesterday’s price change are not in there. A retriever or a database lookup brings them in at request time.
  • Checking the answer. A model can state something wrong with full confidence. A separate check, such as comparing the answer to the source text or running generated code against tests, catches some of those errors before a user sees them.
  • Cost and speed. Not every request needs the most capable model. A system can send simple questions to a cheaper, faster model and save the larger one for hard cases.
  • Control. Rules about what the product may say or do are easier to enforce in code than to hope for in a prompt. A filter or an approval step is predictable in a way a model is not.

In other words, some quality problems are cheaper to solve with system design than with more training.

The Parts of a Compound AI System

Most compound systems are built from the same handful of parts. Few products need all of them.

Component What it does Example
Model calls Generate, classify, summarize or plan One call drafts an answer, a second call grades it
Retriever Finds relevant text or records for the request Search over the help center and policy documents
Tools Let the system act or compute exactly Order lookup API, calculator, code runner
Control logic Decides which step runs next A fixed pipeline in code, or a model choosing tools in a loop
Verifiers and guardrails Check outputs before they reach a user Grounding check, unit tests, content filter
Memory and state Keep track of the conversation or task Stored chat history, a task log

Retrieval is usually the first component teams add. If retrieval quality is your bottleneck, our guide to hybrid search for RAG retrieval covers one of the most reliable improvements.

A Compound AI System in About 30 Lines of Python

The example below has three components: a retriever, a model call and a verifier, plus a fallback. A stub stands in for the language model so the code runs on its own. Notice that the stub, like a real model, will produce a confident answer even when it has nothing to go on.

DOCS = {
    "refunds": "Refunds are issued within 14 days of delivery.",
    "shipping": "Standard shipping takes 3 to 5 business days.",
}


def retrieve(question: str) -> list[str]:
    """Component 1: a retriever (here, simple keyword matching)."""
    words = set(question.lower().replace("?", "").split())
    return [text for key, text in DOCS.items() if key.rstrip("s") in " ".join(words)]


def generate(question: str, context: list[str]) -> str:
    """Component 2: the model call. A stub stands in for a real LLM API."""
    return context[0] if context else "I think refunds take about 30 days."


def verify(answer: str, context: list[str]) -> bool:
    """Component 3: a checker. Only accept answers grounded in retrieved text."""
    return any(answer in passage for passage in context)


def answer(question: str) -> str:
    context = retrieve(question)
    draft = generate(question, context)
    if verify(draft, context):
        return draft
    return "I could not find that in our policies. A person will follow up."  # fallback


print(answer("How long do refunds take?"))
print(answer("Do you price match?"))

Output:

Refunds are issued within 14 days of delivery.
I could not find that in our policies. A person will follow up.

The second question has no matching policy, so the “model” makes something up. The verifier rejects it and the system hands off to a person. In production you would swap each stub for a real part: a vector or hybrid search for retrieve, an LLM API call for generate, and a second model call or a stricter grounding check for verify. The shape stays the same.

Who Decides the Next Step: Workflows vs Agents

The biggest design choice in a compound AI system is where the control logic lives. Anthropic’s engineering team describes the two options in Building Effective Agents: workflows are systems where models and tools follow predefined code paths, and agents are systems where the model directs its own process and tool use.

  • Workflow (code decides). The pipeline above is a workflow. It always retrieves, then generates, then verifies. It is easy to test, easy to explain and cheap to run.
  • Agent (model decides). An agent gets a goal and a set of tools and chooses what to call next, based on each result. It handles cases you did not plan for, at the cost of more model calls and less predictable behavior.

An agent is therefore one kind of compound AI system, not a separate idea. Our guide to implementing AI agents in Python builds that loop step by step. When one agent is not enough, several agents can be combined, which brings its own trade-offs; see our explainer on multi-agent systems as a service.

A practical rule: use a workflow when you can write the steps down in advance, and an agent only when you cannot.

What Gets Harder With a Compound System

Every component you add is another thing that can fail, slow down or cost money. A few problems show up in almost every compound system:

  • Errors compound. If retrieval finds the right document 90% of the time and the model answers correctly from the right document 90% of the time, the pipeline is right only about 81% of the time. Measure each stage, not only the final answer.
  • Latency adds up. A retriever, two model calls and a check run one after another. Run independent steps in parallel where you can, and set a time budget for the whole request.
  • Prompts get tangled. A change to one prompt can break a later step that depended on its output format. Keep a set of real test cases and run them after every change.
  • Tuning is harder. The best prompt for one component depends on the others. Frameworks such as DSPy, which came out of Stanford NLP with Omar Khattab as its lead author, treat a pipeline as a program and optimize its prompts against a metric you define, instead of tuning each prompt by hand.

From Compound System to AI Product

A compound AI system is still not a product. Users also need an interface that fits their work, clear handling of failures, and confidence that their data is safe. Enterprise buyers will ask about access control, audit logs and where data is stored. Developers will ask for an API and documentation.

This is where the system view pays off. Once the model is one part among several, you can see what each user group actually needs and where your product can stand apart. Two teams can call the same model, and the one with better retrieval over better data, tighter checks and a clearer interface will ship the more useful product. If your system takes actions, such as issuing refunds or changing records, plan permissions and approvals early; our guide on how to secure AI agents in the enterprise covers what to put in place.

How to Decide What Your System Needs

  1. Start with one model call and a set of 20 to 50 real examples with known good answers.
  2. Find the failure. Read the wrong answers and sort them: missing knowledge, wrong reasoning, wrong format, unsafe output.
  3. Add the component that matches the failure. Missing knowledge calls for retrieval. Wrong calculations call for a tool. Unsafe or ungrounded output calls for a verifier. Tasks with unpredictable steps may call for an agent.
  4. Measure again. Keep the component only if the test set improves enough to justify the extra cost and latency.

Back to the Support Assistant

The team from the opening did not need a new model. They added a retriever over the current policy documents, a check that every answer is grounded in what was retrieved, and a handoff to a person when it is not. The next customer who asks about refunds hears “14 days”, and a question the policies do not cover goes to a human instead of getting a confident guess. That is a compound AI system: the model writes, and the system around it makes sure what it writes is true.

Frequently Asked Questions

Is RAG a Compound AI System?

Yes. Retrieval-augmented generation combines at least two components, a retriever that finds relevant text and a model that writes an answer from it. It is the most common compound AI system in production and usually the first one teams build.

What Is the Difference Between a Compound AI System and an AI Agent?

A compound AI system is any system that combines a model with other components. An AI agent is one type, where the model decides which tool or step comes next in a loop. A fixed pipeline, such as retrieve, generate and verify, is a compound system but not an agent.

Who Coined the Term “Compound AI Systems”?

The term was popularized by a February 2024 post on the Berkeley AI Research blog, “The Shift from Models to Compound AI Systems”, written by Matei Zaharia, Omar Khattab and colleagues. The post argued that AI progress was shifting from single models to systems built around them.

Do I Need a Framework to Build a Compound AI System?

No. A pipeline of a few function calls, like the example above, is a compound AI system in plain Python. Frameworks help when you have many components to optimize together, need saved state across long tasks, or coordinate several agents.

Disclaimer: The content on this website reflects the views of contributing authors and not necessarily those of Generative AI Lab. This site may contain sponsored content, affiliate links, and material created with generative AI. Thank you for your support.

Generative AI Lab mascot
Generative AI Lab Editorial Team
Articles researched, written and edited by the Generative AI Lab team. About Generative AI Lab

Must read

- Advertisement -spot_img

More articles

- Advertisement -spot_img

Latest articles