What shape is the system: pipeline, agent, retrieval, or none of the above?
Once "build" wins, the next decision is architectural: a fixed pipeline, an autonomous agent, a retrieval layer, or some combination — and each shape carries a different reliability profile before you write the first prompt.
What actually happens at this stage
Design is where most of the long-term reliability of an AI system gets decided, and it happens before any model is called in anger. The central fork is agent versus pipeline: a pipeline is a fixed sequence of steps where the model fills in one or two of them, predictable and easy to test because the control flow doesn't change; an agent is a loop where the model decides what happens next, powerful for open-ended tasks and much harder to bound, test, and debug. Most systems that get called "an AI agent" in a pitch deck would be more reliable, cheaper, and easier to eval as a pipeline — reach for a real agent only when the task's steps genuinely can't be known in advance.
If any part of the system needs to answer from your own data, retrieval enters the design, and it deserves the same deliberateness as the agent-vs-pipeline call. The default architecture is chunk, embed, retrieve by similarity, rerank, generate — and every one of those five verbs is a place a demo-passing system quietly breaks in production. Chunking that ignores document structure splits tables and procedures in half; embeddings encode topical resemblance far better than exact identifiers, dates, or negation; a system that looks solid on ten demo queries can fail badly on the identifier-shaped queries real users actually ask.
The vector-database-versus-pgvector fork belongs here too, and it's smaller than it looks from the outside: if you already run Postgres and your corpus is in the low millions of vectors, pgvector removes an entire piece of infrastructure to operate for a real but bounded performance cost; a dedicated vector database earns its keep once scale, filtering complexity, or query latency requirements outgrow what an extension bolted onto your primary database can deliver.
Whichever shape you land on, design it to be model-agnostic from the start, not as a retrofit after the first provider price change or deprecation notice. That means an abstraction layer between your application and any single model provider — not a big one, but a real one — so a workload can route to whichever model is cheapest or most capable for that specific call, and a provider outage or pricing change becomes a config change rather than a rewrite. Almost every team that skips this does so because it looks like premature abstraction on day one; almost every team that skips it retrofits it within a year, under worse conditions than they'd have chosen for themselves.
Whatever shape emerges — agent, pipeline, retrieval, or a combination — should come out of this stage as a small number of named, deliberate patterns, not an emergent pile of prompts. An intent router in front of specialist agents instead of one god-agent; a bounded loop with an explicit step and token budget instead of an open-ended one; typed tool contracts instead of free-form string arguments. We hit exactly this coordination problem operating fleets of coding agents ourselves — it's the reason CodeHerder exists, as a shared task registry and per-task cost ledger instead of a wall of uncoordinated terminal tabs. None of these are exotic; they're the standard shapes for the failure modes this stage is trying to design around before they happen, and adopting the two or three your system actually needs beats adopting all of them.
The common mistake
The most common mistake at this stage is reaching for an agent when a pipeline would do — building an open-ended loop for a task whose steps were actually knowable in advance, then spending the next quarter building the guardrails a pipeline would never have needed in the first place.
How do you know this stage is finished?
- You've explicitly chosen agent, pipeline, retrieval, or a combination — and can say why the alternative shapes were rejected.
- If retrieval is involved, chunking respects document structure and you've checked identifier/negation queries specifically, not just topical ones.
- The vector-store decision (pgvector vs. a dedicated database) is sized to your actual scale, not defaulted to whichever is trendiest.
- There's a model-agnostic layer between your application and any single provider, even a thin one.
- The design maps to two or three named patterns your system actually needs — not every pattern in the library.
What backs this up
Insights
- Model-Agnostic by Design
Why the abstraction layer belongs in the design, not in the retrofit after the first price change.
Case studies
- Retrieval Pipeline That Actually Cut Support Load
What a retrieval design that respects structure and identifiers actually buys you in production.
Comparisons
- Agents vs Pipelines: When Autonomy Is Worth the Reliability Cost
The central fork of this stage — decide it on purpose, not by whichever shape a pitch deck defaulted to.
- Vector Database vs pgvector: Do You Actually Need a Dedicated Store
Smaller than it looks: sized to your actual scale, not to whichever is trendiest.
Patterns
- Intent router to specialists
The standard shape for "one agent that knows everything" before it becomes a reliability problem.
- Bounded agent loop
The termination contract every agent design needs before it ships, not after it loops for 40 minutes.
- Typed tool contract
Tighter schemas at design time are what stop a model inventing a plausible-looking tool argument later.
- Structure-aware chunking
The retrieval design decision most fixed-size chunkers get wrong before anyone notices.
- Retrieve-then-rerank
The two-stage shape that recovers precision pure similarity search can't reach alone.
Glossary
- Agent (Agentic AI)
What actually makes something "agentic" — a spectrum, not the on/off switch the agent-vs-pipeline fork implies.
- Tool Calling
The primitive underneath every agent design in this stage.
- Model Context Protocol (MCP)
The standard worth adopting early if the model-agnostic call above is genuine.
- Tool Contract
The schema that stops a model inventing a tool argument — tighten it at design time, not after an incident.
- Context Engineering
What deciding the shape of the agent design above is actually called once tool defs and retrieved content enter the same window.
- Chunking
The retrieval decision with the most leverage over whether the design actually works on real documents.
- Embeddings
What a retrieval design is actually built on, and where its blind spots come from.
- Vector Search (Semantic Search)
Why it's usually paired with metadata filters and a reranker rather than trusted alone.
- Model-Agnostic Architecture
The design property this stage's provider-independence argument is actually named after.
More
- CodeHerder
The bounded-loop, task-registry coordination problem above, solved at the scale of a whole agent fleet.
- The Agent Tool Interface
The full pillar behind the tool contract and typed-tool-contract calls above: six interface surfaces, 24 named design rules, and five ways a tool interface fails.
Questions on this stage
What comes up before and during design.
01 Do we need an agent, or is a pipeline enough?
Default to a pipeline. Reach for an agent only when the task's steps genuinely can't be known in advance — most systems pitched as "agents" are pipelines with one or two model-filled steps, and would be more reliable built that way on purpose.
02 pgvector or a dedicated vector database?
If you already run Postgres and your corpus is in the low millions of vectors, start with pgvector — it removes a whole piece of infrastructure to operate. Move to a dedicated vector database once scale, filtering, or latency requirements outgrow it.
03 Why does model-agnostic architecture matter this early?
Because it's cheap to build in from the start and expensive to retrofit. Almost every team that skips it ends up doing the retrofit within a year, usually right after a price change or deprecation they didn't choose the timing of.
A Ship Audit checks your actual system against every stage of this handbook and hands back a written, prioritized plan.