You are treating your AI prompts like database transactions. They aren't.

Published: 2026-02-27

URL: https://theagenticstack.substack.com/p/why-prompts-wont-save-your-data


That sounds harsh, but here is the reality: if your “autonomous agent” relies on a system prompt to handle failures, you are gambling with your enterprise data. You have spent weeks optimizing your LLM’s reasoning, but you’ve neglected the one thing that actually keeps systems alive—transactional integrity. We have entered the era of the “God Model” fallacy. We believe that if the model is smart enough, it will “figure out” how to fix a broken workflow.

It won’t. Thanks for reading! Subscribe for free to receive new posts and support my work. When you move from a monolithic LLM to a swarm of asynchronous agents, you aren’t just doing AI anymore. You are managing a distributed systems problem.

And in distributed systems, partial failure is the only guarantee. If you cannot cleanly and reliably revert the actions of your agentic swarm when it makes a mistake, you aren’t building an autonomous system. You are just writing a very expensive, very fast script for data corruption.

The 30-Second “Hold Your Breath” Anti-Pattern Most engineers start their agentic journey with a synchronous “Request-Response” model. They trigger an agent, the agent calls three tools in a row, and the server waits for the final result.

This is the Request-Reply Fallacy. When you ask an agent to “Onboard a new senior engineer,” you are initiating a cascade of state mutations across Google Workspace, Workday, and procurement APIs. The IT Agent provisions the email. (Committed).

The HR Agent creates the profile. (Committed). The Hardware Agent fails to order the laptop due to a budget error. (Failure). In a traditional database, you would just hit ROLLBACK. But you cannot rollback an API call to Workday. You cannot “un-send” a provisioned license. Your system is now in a critically inconsistent state. You have a Workday profile accruing payroll liabilities for an employee who has no laptop and cannot work.

This is where traditional backend instincts—like implementing a Two-Phase Commit (2PC)—fail. Why Two-Phase Commits (2PC) Are Catastrophic for AI A 2PC protocol works by “locking” all participating databases before committing.

It asks everyone to “prepare,” and only when everyone says “yes” does it commit the data. This works for SQL. It is architectural suicide for AI. The Latency Problem: Agentic workflows are long-lived. You cannot lock an enterprise database for five minutes while an LLM “thinks” or an agent researches a procurement policy.

The ensuing thread starvation would collapse your entire application. The Sovereign System Problem: Your external APIs (Stripe, Salesforce, AWS) don’t care about your transaction manager. You cannot ask Salesforce to “hold a lock” on a lead while your AI decides its next move. If we cannot rely on local atomicity or distributed locking, we must rely on distributed compensation.

The Blueprint: The Saga Pattern for AI A Saga is a sequence of local transactions. Each transaction updates the state and publishes an event to trigger the next step. The defining feature of a Saga is how it handles a break in the chain: Compensating Transactions.

A compensating transaction is a specific, explicitly programmed action designed to logically undo the work of a previous step. It is the “Undo” button for the real world. In our onboarding example, the Saga architecture reacts to the Hardware failure by reversing the flow: The system detects the Task_Failed event.

It triggers the HR Agent’s compensating tool: SuspendWorkdayProfile. It triggers the IT Agent’s compensating tool: ArchiveWorkspaceEmail. The business logic remains sound, even if the audit logs show a “create and cancel” sequence.

The Idempotency Imperative: Designing for Retries Asynchronous systems are noisy. Events will be duplicated. Network stutters will cause the same “Undo” command to be sent three times. If your Cancel_Flight tool isn’t idempotent, the first call refunds the money, and the second call throws an error because the flight is already gone.

Or worse, it refunds the money twice. To solve this, every intent in your swarm must carry a unique idempotency key (UUID v4). Your tools must be designed to check this key against a local state log before acting: “Have we already canceled Flight 123 for this user? If yes, return 200 OK and do nothing.” Orchestration vs. Choreography: Why AI Needs a Manager How do you coordinate these reversions?

  1. Choreography (The Decentralized Nightmare)

In Choreography, agents just listen to a global bus. “I saw a hardware failure, so I’ll undo my HR work.” “Action without Taste”. Asking probabilistic LLMs to independently listen to a message broker and deduce when to self-revert is a recipe for state drift. It is impossible to debug and impossible to trace.

  1. Orchestration (The Deterministic Standard)

You must use a central Orchestrator—a deterministic state machine (like AWS Step Functions or a Java Spring Orchestrator). The Orchestrator holds the Directed Acyclic Graph (DAG) of the workflow. It knows exactly which steps succeeded.

When a failure occurs, it systematically moves backward, explicitly commanding agents to execute their compensating tools. This removes the burden of “thinking” from the worker agents. They become compliant function executors during the reversion phase. Implementation: The Orchestration Data Contract A production-grade Orchestrator sends a payload that leaves zero room for model “creativity.” It overrides the agent’s autonomy to ensure the compensation is executed clinically. JSON { "eventid": "evt98765", "traceid": "traceuuid1234", "idempotencykey": "idemuuid5678", "actiontype": "COMPENSATINGTRANSACTION", "targetagent": "HRAgentPool", "tooltoinvoke": "SuspendWorkdayProfile", "parameters": { "employeeid": "WD_55432", "reason": "Saga Reversion: Downstream failure." }, "context": "You are executing a rollback.

Do not attempt to reason. Execute the tool immediately with the provided parameters." } The Nightmare Scenario: When “Undo” Fails What happens if the Orchestrator tries to archive the email, but the Google Workspace API is down (503 Service Unavailable)? You are now in the “Ultimate Inconsistent State.” Your architecture must include Exponential Backoff and Dead Letter Queues (DLQs). Retry: The Orchestrator attempts the compensation at increasing intervals (5s, 30s, 5m).

The DLQ: If all retries fail, the entire payload is routed to a Dead Letter Queue. The Human Alert: The DLQ triggers a PagerDuty alert. A human architect reviews the state of “Trace-1234” and manually resolves the inconsistency. Conclusion: Taste and Consistency in Architecture In engineering, Taste is knowing when to use a probabilistic model and when to use a deterministic state machine. Consistency is ensuring your data never enters an “impossible” state because you were too lazy to architect for failure.

Stop obsessing over your system prompts. Start obsessing over your state reversion strategies. Reliability is not a prompt. It is an architecture. Thanks for reading! Subscribe for free to receive new posts and support my work.