Engineer your agent like a distributed system: seven production layers
ghumare64 · x · 2026-11-27
The author argues an agent is a distributed system with one unreliable node, and should be engineered as such. The model gets the attention but is the part you'll swap most often; seven surrounding layers decide whether the system holds up, and each is a familiar backend problem.
- Triggers: production agents start from webhooks, queue messages and cron ticks with at-least-once delivery — give every trigger an idempotency key and dedupe before the run; park human-needed runs in a review queue with evidence attached.
- State: a run is a state machine that gets interrupted mid-flight — persist every transition in Postgres, put timeouts and retry budgets with backoff on each step, resume from the last checkpoint; version prompt, tools and model alias as one artifact so rollback moves all three together.
- Tools: anything with a correct answer (eligibility rules, tax math, state transitions) belongs in unit-tested code; model output is untrusted input, so validate at the tool boundary like a public API request; keep tools narrow, least-privilege and safe to call twice.
- Context: retrieval is a query the agent runs mid-task, filtered by caller permissions; every source needs an owner and freshness date — this is cache invalidation, and stale data yields confident wrong answers that longer prompts make worse.
- Memory: context is what the company knows, memory is what the agent learned from its runs — treat it like a database with a schema, write rules, retention policy and contradiction resolution; most memory bugs are bad writes surfacing weeks later as bad reads.
- Evals: regression tests built from real past cases signed off by domain experts, run in CI on every prompt/tool/model change; calibrate LLM judges against human labels; irreversible actions like moving money wait for human approval.
- Runtime: route every model call through one gateway you control with per-tenant keys, rate limits and hard spend caps; use model aliases so a provider swap is a config change; trace trigger-to-tool-call-to-token-count, alert on cost and error rate, keep a working kill switch.
He adds: you don't need all seven on day one — a single-user laptop agent gets by with layers 3 and 6; the rest become mandatory the first time it runs unwatched.
Related event: Production Agent Systems Need Six to Seven Layers Beyond the Model(2 posts)→
More from coding & agent
- Fugue: a native C++ ComfyUI alternative with 99% AI-written code — PropertySoft8530 · 2026-11-27
- Cloudflare launches D1 Insights to auto-recommend indexes, with agent-friendly CLI — irvinebroque · 2026-11-27
- Burkov's True Positive Weekly #187: NVIDIA OpenShell, weight-space programming, and 2026 LLM roundup — burkov · 2026-11-27
- CI provider benchmark adds heatmap view: 13 services compared on queue, cache, disk IOPS and cost — DanielLockyer · 2026-11-27
- Antigravity's permission policy called worst among coding agents: no generalization across similar commands — teortaxesTex · 2026-11-27
- Dev Asks: What's the Most Boring Thing You've Automated With Agents? — weswinder · 2026-11-27