The problem

An agent decides to act, a human approves, and the action is executed against an external API. If the process dies between approval and execution, nobody knows whether it happened.

The shape

  1. The approval and the intended action are written to an actions table in the same transaction.
  2. A relay reads pending actions, executes each with its row ID as the idempotency key, and records the outcome.
  3. The agent observes the outcome through the same table, never through the API response.

Delivery is at-least-once. If the relay crashes after the call but before recording the outcome, it calls again, so the receiver must deduplicate on that key.

Trade-offs

  • Plus: complete audit trail, safe retries, replay after an outage, one place to enforce permissions.
  • Minus: one more hop of latency, one more component to run, eventual consistency the UI must show honestly.

Where it sits

On the Tools node of the AI Application map, between the gateway and the systems of record. The MCP gateway decision explains why the gateway alone is not enough.

Key takeaways

  • Record the intended action and the approval in one transaction, then execute from the outbox.
  • The outbox gives you audit, retry and replay for free.
  • Latency goes up by one hop. For writes that matter, that is the right trade.

About this architecture pattern

Format
Architecture pattern
Level
Architect
Read
1 min read
Published
Sep 28, 2026

Reusable shapes with their trade-offs.

Article · · 2 min read

Read post-mortems, not tutorials

Tutorials teach one tool's happy path. Post-mortems teach how systems fail, and that carries over to every stack you will work on.