Agent ArchitectureRuntime and effect recoveryPrincipal
How should delayed agent actions bind to an object incarnation when resource IDs can be reused?
By Amit Kumar2 min readWorked answer includedReviewed 28 Sept 2026
The question
Interview question
A human approves a change for legacy account 42. Before execution, the account is deleted and 42 is assigned to someone else. Design preparation and atomic write conditions that distinguish replacement from ordinary updates. Explain what cannot be guaranteed if the provider exposes only an unconditional update by reusable ID.
Draft your approach first
Take a few minutes before you read the answer. Name the constraint that matters most, the failure you are designing for and how you would know it worked.
Reveal the worked answerWorked answer
The number 42 may be the same while the thing it names has changed. Imagine a legacy system that reuses local numeric account IDs after deletion. The agent prepared a change for account 42, a human approved it, and the workflow waited overnight. In between, the old account was deleted and the ID was assigned to a different account. A resume that fetches by ID and blindly applies the approved change can be perfectly idempotent and still change the wrong object.
At preparation, bind the approval to an object incarnation, not just a display ID. That could be an immutable provider ID, a generation ID that changes on recreation, or a version and immutable subject identity checked together. The tool must enforce the expected incarnation in the same operation that makes the change. An earlier GET followed by an unconditional POST leaves a race. HTTP's If-Match condition and DynamoDB's conditional version update illustrate conditional writes, though the actual API must expose a validator that distinguishes a recreated object. A simple version counter reset to 1 on recreation could suffer the same ID-reuse problem.
An adapter helps only if it can enforce the check and write under one authoritative transaction or provider condition. Serializing calls in the agent gateway cannot prevent an independent source client from deleting and recreating the object between a gateway read and the later write. A content hash or version counter that can repeat after recreation may also fail to distinguish the new incarnation. If the external contract exposes no enforceable identity condition, retain the blocked state instead of claiming that an extra preflight GET removes the race.
If the condition fails, stop the action, fetch the current object and ask for a fresh decision. Do not silently reinterpret yesterday's approval against today's object. Log the approved subject, expected incarnation, action parameters and the condition failure without dumping private account data. A test should delete and recreate an object between approval and execution, and another should update the original object without replacing it. Those may need different review policies, but neither should accidentally pass an unconditional write.
If the provider offers only update(id) and can reuse IDs, we cannot guarantee the binding by adding more reasoning in the agent. Put the write behind an adapter that can perform an atomic check, ask the provider for a stronger API, or withhold that delayed action. The human approved a preview. The world changed before commit. addresses changed values before commit. This is a stronger identity problem: the target itself has been replaced.
Related questions
Keep practising agent architecture
Follow another question in this area, or search the complete library.
Get my essays on AI engineering and distributed systems by email. Subscribe to ArchCrux