Illustrated architecture pipeline for shipping a production AI agent MVP in four weeks
Back to blog
Architecture14 min

The AI Agent Architecture Playbook: Ship a Production MVP in 4 Weeks

Most autonomous agent projects die between the demo and the third real user. This is the end-to-end architecture playbook UltraMVP uses on every engagement — the same blueprint we use to ship agent MVPs to production in four weeks, and the reference we hand our own engineers on day one.

[ TL;DR ]

Most autonomous agent projects die between the demo and the third real user. This is the end-to-end architecture playbook UltraMVP uses on every engagement — the same blueprint we use to ship agent MVPs to production in four weeks, and the reference we hand our own engineers on day one.

[ 01 ]

The four-week arc, at a glance

Week 1 is discovery, eval set, and thin vertical slice. Week 2 is planner-executor loop, tool contracts, and first end-to-end trace. Week 3 is memory, guardrails, cost control, and hardening. Week 4 is staged rollout, observability, and handover. Every week ends with a demo against a frozen eval set, not a vibes check.

If a week ends without moving the eval score, we stop and cut scope. Timeline slips are almost always scope problems disguised as engineering problems.

[ 02 ]

Pick the agent topology before writing code

Three topologies cover ~90% of real workloads. Single-agent with tools works for triage, extraction, and routing. Planner-executor separates the model that decides from the model that acts — cheaper, more debuggable, and easier to evaluate. Multi-agent (supervisor + specialists) is only worth the complexity when tasks are truly heterogeneous and long-running.

Default to planner-executor. It compresses cost by using a small model for execution steps, gives you a natural place to inject guardrails, and produces traces a human can actually read during incident review.

  • Single-agent + tools — fast to ship, hard to debug at scale
  • Planner-executor — best default; separates decisions from actions
  • Multi-agent supervisor — only when specialization is real, not aesthetic
[ 03 ]

Tool contracts are the real API of your agent

The tools you expose define the agent's capability envelope more than the model choice does. Keep the surface area small — five to twelve well-designed tools beats forty overlapping ones every time.

Every tool needs a typed schema, an idempotency key, a timeout, and a structured error shape. Return machine-readable failures the planner can reason about, not stack traces. Log every invocation with inputs, outputs, latency, and cost.

  • Typed inputs and outputs — Zod, Pydantic, or JSON schema
  • Idempotency keys on every write — retries must be safe
  • Structured errors: { code, retryable, message, hint }
  • Per-tool timeout and cost ceiling; kill runaway calls
[ 04 ]

Memory: three tiers, not one bucket

Working memory is the current run's scratchpad — kept in the prompt, bounded by tokens. Episodic memory is prior runs for this user or entity — stored in Postgres with structured fields, retrieved by ID not by vector similarity. Semantic memory is the knowledge base — retrieved with hybrid BM25 + dense search and re-ranked.

Almost every 'the agent forgot' bug is really an episodic-memory bug. Vector search cannot substitute for a foreign key.

[ 05 ]

Evaluation is week-one work, not a launch checklist

Build the eval set before the agent. 50–200 representative cases, curated by a subject-matter expert, with ground truth for task success, tool selection, and (where applicable) exact outputs. This is the artifact that lets you ship confidently.

Run the suite on every prompt change, tool change, and model upgrade. Pair automated scoring (LLM-as-judge with rubric, plus deterministic checks) with a weekly human review of 20 random traces. The judge finds regressions; the human finds blind spots the judge shares with the agent.

[ 06 ]

Guardrails at four layers

Input layer: PII redaction, prompt-injection detection, per-tenant rate limits. Planning layer: cap steps per run, cap tool calls per step, block disallowed tool sequences. Output layer: schema validation, policy classifier, deterministic checks for the destructive tools. Human layer: approval gates on high-blast-radius actions with clear diff previews.

Guardrails are cheap to add in week 3 and painfully expensive to add after an incident.

[ 07 ]

Cost and latency: budget them like features

Set a per-run cost ceiling and a per-run latency SLO before the first prompt. Route trivial planning to a small model, escalate to a frontier model only on hard branches. Cache aggressively — prompt caching for stable system prompts, embedding cache for retrieval, tool-result cache for deterministic reads.

Most production agents settle at $0.02–$0.15 per successful run once tuned. If yours is 10× that, the loop is too long, not the model too expensive.

[ 08 ]

Observability from day one

Every run gets a trace ID that follows it through logs, spans, tool calls, and downstream services. Store the full transcript, tool I/O, and eval score. Alert on regression in success rate, spike in cost per run, and increase in tool-error rate — not on raw latency.

OpenTelemetry + Langfuse (or the equivalent) is enough for 95% of teams. Do not build a bespoke dashboard in month one.

[ 09 ]

Rollout: staged, reversible, boring

Ship behind a feature flag to internal users first. Then 1% of external traffic with shadow mode (agent runs, human ships). Then 10% with the agent shipping directly. Then 100%. Each stage runs at least three days and must clear the eval bar and the incident bar.

Boring rollouts are how AI agents become boring, dependable software — which is the actual goal.

[ Key takeaways ]
  • 01Default to planner-executor; multi-agent is a tax, not a feature
  • 02Curate the eval set in week one — it is the ship gate
  • 03Five to twelve well-typed tools beats forty sloppy ones
  • 04Three memory tiers: working, episodic (SQL), semantic (hybrid RAG)
  • 05Guardrails at input, planning, output, and human layers
  • 06Trace every run end-to-end; alert on success rate and cost, not latency
  • 07Staged rollout with shadow mode is non-negotiable for high-blast-radius actions
[ FAQ ]

Frequently asked questions

Can you really ship a production AI agent in 4 weeks?

+

Yes, for a well-scoped vertical slice with a real eval set and a clear success metric. Enterprise-wide multi-agent orchestration takes longer. The 4-week timeline is for a single agent solving a single business workflow to production quality.

Which framework should we standardize on?

+

For most teams: LangGraph for the agent loop, Temporal for durable multi-step workflows, OpenTelemetry + Langfuse for tracing. Frameworks are a small part of success — the architecture decisions above matter more than the SDK.

Should we build with open-source models or frontier APIs?

+

Start with a frontier API to prove the workflow, then fine-tune a smaller open model (Gemma 4, Llama) on the winning traces once you have volume. This gives you the best time-to-value and the best long-term unit economics.

How do you handle prompt injection in production?

+

Layered: strip untrusted content markers, run a classifier on tool outputs before they re-enter the planner, and never let untrusted data trigger high-blast-radius tools without a human gate. There is no single silver bullet.

What is the biggest reason agent projects fail?

+

No eval set. Without a frozen scored benchmark, teams cannot tell whether a change improved the agent or regressed it, so every deploy is a coin flip. Build the eval before the agent.

[ Start your build ]

Ship a production AI agent in 4 weeks

We architect and ship custom AI agents end-to-end — planner-executor loops, evals, guardrails, and observability. Book a discovery call and get a scoped 4-week plan.

Book a discovery call