# AI Agents Are Just Distributed Systems Now — Salman Munaf, TikTok
<!--
ref: @content/youtube/aie/2026-08-29-ai-agents-are-just-distributed-systems-now-salman-munaf-tikt
version: 3
updated_at: 2026-10-31T19:00:40.874Z
-->

Salman Munaf (AI Engineer, 2026-08-29): Munaf's argument is that once an agent can call tools, write to databases, and touch external services, the architectural boundary has moved past the model — the agent is now a *probabilistic coordinator* sitting where deterministic orchestration services used to sit.

*Synthesized from Salman Munaf on AI Engineer, 2026-08-29.*

Salman Munaf is an engineer at TikTok who argues that the moment an LLM gained the ability to call external systems, it stopped being a model problem and became a distributed systems problem.

## Core Thesis
Munaf's argument is that once an agent can call tools, write to databases, and touch external services, the architectural boundary has moved past the model — the agent is now a *probabilistic coordinator* sitting where deterministic orchestration services used to sit. Traditional multi-step coordinators walked a mapped-out decision tree; an agent's action space is open-ended and its side effects land in the real world. The fix is not a smarter model but the classic distributed-systems toolkit — idempotency, compensating transactions, circuit breakers, budgets, scoped credentials, and traces — wrapped around a non-deterministic planner.

## Key Insights
- The two failure modes everyone cites — the Replit agent deleting a production database, and the Air Canada chatbot issuing an incorrect refund — were, in Munaf's reading, systems-design failures rather than model failures. The first needed robust backups and scoped authority (an agent should simply not hold delete rights on a production DB); the second needed retrieval from an authoritative source of truth so the agent wasn't reasoning off stale policy.
- The agent loop — plan, act, observe, persist, decide — crosses a system boundary at *every* step. Planning reaches data sources; action hits external APIs, tools, and databases; observation ingests partial results that shape the next move; persistence can write incorrect state; the decide step can trigger a retry storm.
- A timeout is not a failure — it means **unknown**. Munaf's worked example: an agent calls a `refund customer` tool and the request times out. Did the refund happen? A human would go check the source of truth; an agent's default reflex is to retry, which is how one refund becomes two.
- Server-succeeded-but-client-saw-an-error is a real and common split — the database wrote the row, the client got an error. Humans reconcile this by inspecting the actual state; agents need guardrails instead.
- Idempotency has to be baked into the tool contract, not bolted on: request IDs, idempotency keys, and a status-lookup path so a duplicate call can ask "what happened to my previous request?" rather than re-executing the side effect.
- Context that can influence an action is not context — it is **state**. State goes stale, conflicts with authoritative data, and corrupts downstream actions. Munaf splits agent memory into short-term (the thread tied to a single execution) and long-term (project files, system prompts, databases, the cache layer), and says you must decide up front which wins when they disagree.
- Treat memory as a cache with provenance and invalidation: when the source-of-truth store updates, invalidate the agent's held context so it stops acting on stale reads.
- Multi-step agent work fails *partway*, and the partial success spans system boundaries. His example: the agent updates an internal ticket, emails the customer, then fails to update the CRM. Each irreversible step needs a defined compensating operation — a wrongly sent email is compensated by a correcting or apology email, not by pretending it didn't happen.
- Circuit breakers belong in front of every external call so an unhealthy or saturated downstream doesn't get hammered by an agent's retry loop into a cascading failure. Pair them with exponential backoff.
- Budget the loop explicitly: **max turns, max spend, max parallel calls**. Without those, an agent that can't solve a problem will keep spending trying.
- The default build instinct is to hand the agent every permission so it can finish the task — full read/write on the whole table. Munaf calls this the trap: a harmless model becomes dangerous the moment it can perform unsafe operations. Separate read and write credentials, and allowlist the tools.
- Human approval must not be blanket. Bind it to action, timestamp, actor, and expiration — an approval for a **$30 refund** must not silently authorize a subsequent **$300 refund**.
- Logs alone can't reconstruct an agent failure. You need traces covering: model called, prompt sent, tool calls made with request and response, errors returned, retrieved context the agent was reacting to, writes performed, and approvals received.

## Actionable Takeaways
1. Inventory the blast radius before writing the loop: list every external system the agent touches, every piece of state it reads or mutates, every credential it holds, and every action it can take.
2. Persist every step of the agent loop — plan, action, observation, decision — so that on failure the agent (or an operator) can identify exactly where it broke and run the reversal.
3. Define an explicit compensating transaction for each irreversible step *before* shipping the tool. Ask per tool: if this half-succeeds, what undoes it?
4. Give every side-effecting tool a request ID and an idempotency key, plus a status-lookup endpoint, so a retried call after a timeout returns the prior result instead of duplicating the effect.
5. Treat timeouts as unknown, never as failure. Route them to a status lookup, not to an automatic retry.
6. Put circuit breakers plus exponential backoff on every external dependency, and cap fan-out with max parallel calls to prevent retry storms and cascading failures.
7. Set max turns, max spend, and max parallelism as hard budget boundaries on the loop.
8. Classify agent memory into short-term (single execution thread) and long-term (project files, system prompts, databases, cache), declare which is authoritative under conflict, and invalidate held context whenever the source-of-truth store updates.
9. Replace blanket credentials with scoped ones: split read from write, allowlist callable tools, and never grant production-delete authority.
10. Scope each human approval to its action, timestamp, actor, and expiration so approval for one amount can't be reused for a larger one.
11. Instrument traces — not just logs — capturing model, prompt, tool request/response, errors, retrieved context, writes, and approvals, so a failure is reconstructable after the fact.
12. Use the closing design question as a review gate on every agent: what does the system let this agent do when it is wrong?

## Notable Quotes
> "The timeout does not actually mean that a failure had occurred. It means unknown." — Salman Munaf

> "A harmless model can become dangerous when it can perform unsafe operations." — Salman Munaf

> "Smarter models reduce mistakes... however, it cannot eliminate network failures, stale data or adversarial input." — Salman Munaf

> "When building AI agents, we should also ask what the system lets it do when it is wrong." — Salman Munaf

---

*You're reading a protocol on [protocol.supply](https://protocol.supply) — hosted, searchable knowledge for AI agents. Think Agent Skills, as an API: bootstrap once (`curl -sL https://api.protocol.supply/bootstrap`), search (`/search?q=…`), fetch (`/@repo/slug`).*

*Any skill can become a protocol, and any protocol installs as a local skill — tell your agent "install this as a skill" or see [`@protocol/protocol-to-skill`](https://api.protocol.supply/@protocol/protocol-to-skill).*