Writing / 2026
Statelessness Does Not Contain an Agent
Stateless agents can still destroy persisted data. Containment needs domain owners, scoped credentials, write budgets and recovery you have tested.
A stateless agent can still destroy the state it has permission to change. In the brain, hands and session split , I argued for separating the orchestrator, execution sandbox and session history so they can fail and recover independently. That makes the runtime easier to replace and restart. It leaves another boundary to settle: who can change business data, under which rules, and how much damage they can do before something stops them. Redeploying yesterday’s code does not undo today’s writes.
The appealing answer is to put all persistence behind one service and make everything calling it stateless. I would keep the ownership principle and narrow its scope. Give each domain one owner, with a surface that accepts business intent: transferFunds or cancelSubscription, rather than updateBalance or setStatus. The owner must be able to reject an invalid request without trusting the caller’s reasoning. If callers still decide whether a balance may change, the rules will drift even though every write travels through the same endpoint.
That also settles where some business logic belongs. Validating a transfer requires understanding balances, holds, account state, authorization and limits. Those rules cannot all live in stateless callers while the owner somehow guarantees correctness. The invariants and the transactions that maintain them belong inside the domain owner. Workflow, orchestration and presentation can remain outside. This gives an agent-written caller a smaller contract to use, while the owner retains authority over what constitutes a valid change.
I would enforce that boundary in-process first, using compiler or static-analysis checks to prevent callers from reaching into another domain’s tables. A network hop earns its cost when independent deployment, a real trust boundary or a distinct scaling need requires it. Moving a boundary onto the network does not remove contention on the same rows, and schema coordination can reappear as API coordination. Prime Video’s 2023 monitoring redesign consolidated a chatty audio/video pipeline into one process and cut infrastructure cost by over 90%. That supports checking the cost of distribution before paying it.
The read side deserves its own decision. Commands can stay compact while consumers keep needing new filters, joins, exports and reports. Forcing all of those through one operational owner can produce repeated remote reads or an expanding query API. A separate read model can help, but someone must own its event contracts, lag, backfills, authorization and deletion handling. Several domain owners with governed read models are a more defensible design than one universal persistence service.
The infrastructure analogies only take this argument so far. Kubernetes puts writes to etcd through the API server while controllers reconcile desired state. That is a useful ownership pattern; it does not establish the transactional guarantees a business operation needs. Temporal stores workflow history so execution can resume, while activities write domain data elsewhere. Centralizing workflow history solves a different problem from controlling business mutations. Neither analogy makes a stateless caller safe.
This is the part I had wrong: I treated replaceable code as though it implied contained damage. A stateless caller can send individually valid commands whose combined effect is catastrophic. Even one valid command can be enough. On 25 April 2026, a Cursor agent working on PocketOS
found a Railway API token in an unrelated file created for managing custom domains. The token had blanket authority. One volumeDelete mutation wiped the production volume and the volume-level backups stored in it. A well-formed request reached far beyond the task’s intended scope.
An explicit instruction is no substitute for an enforced boundary either. In July 2025, a Replit coding agent deleted production database data during an explicit code and action freeze. The domain owner’s validity checks and the agent’s authorization answer different questions. A cancellation may satisfy every business invariant while still being outside the work that agent was authorized to perform.
Containment therefore needs credentials scoped by operation, resource and environment, with direct database access denied to callers. It also needs write budgets and velocity limits that bound total activity, plus detection of unusual write patterns. Checking each request independently misses the sequence. A perfectly valid stream of cancellations can exceed any reasonable task scope. These controls must be enforced outside the agent’s reasoning, so the same mistake that produces a harmful command cannot also waive the limit.
Recovery belongs in that boundary too. Keep backups outside the authority and failure scope of the system being protected, record writes well enough to investigate and reverse them, and rehearse restoration. Rolling back a deployment restores code; recovering business state requires evidence of what happened. The timeout-after-write problem adds another reason to preserve receipts and reconcile uncertain outcomes before retrying. Statelessness alone provides none of that.
The same distinction matters when comparing agent-generated implementations. Give each candidate the same immutable snapshot and captured inputs, then have it emit proposed commands with external effects suppressed. One authorized executor can commit the selected proposal. Running candidates against shared writable state changes the conditions for every candidate after the first write. Replay depends on recorded inputs and isolated effects, rather than whether the code keeps local state.
This week, choose one agent-accessible write path and test it in staging. Send an invalid business command and confirm the domain owner rejects it without help from the caller. Then send a sequence of valid commands that exceeds the task’s write budget and confirm enforcement stops it. Inspect whether the same credentials can reach production, delete backups or bypass the owner. Finally, restore the affected data from an isolated backup. Record what actually stopped the writes and how recovery worked; those results show where the containment boundary exists.