← All posts
Architecture

The agentic AI stack I'd build today from scratch

Agents are easy to demo and hard to operate. The difference is almost entirely architecture. Here's the stack I reach for now.

The layers

  • Orchestration — deterministic control flow (a graph/state machine), not a model improvising the plan. The model fills steps; the code owns the loop.
  • Tools — typed, validated, idempotent. Every tool call is logged with inputs and outputs.
  • Memory — scoped and explicit. Short-term context vs. retrieved knowledge are different things; don't conflate them.
  • Guardrails — input/output policy, cost ceilings, and a hard step limit so a stuck agent can't run forever.
  • Observability — every run is a replayable trace.

Mistakes I'd avoid

Letting the model own the control flow is the single biggest source of flaky agents.

  1. No step budget. Always cap iterations and spend.
  2. Untyped tools. Free-text tool args are where agents silently go wrong.
  3. One giant prompt. Decompose; each step should be evaluable on its own.

Where it nets out

A good agent looks boring from the outside: predictable, bounded, observable. The intelligence is in the steps — the reliability is in the scaffolding around them.