- Updated
- Reading
- 10 min
- By
- Anlyon Team
AI agent action timed out: how to tell whether it happened, and reconcile it
When an agent's refund, email or file update loses its response, record it as unknown, keep its allowance held, and settle it from provider evidence, a same-key replay or an operator's labelled resolution.
- reconciliation
- timeouts
- unknown outcomes
- runbook
- impact limits
- read-back
When an agent's action times out, you do not know whether it happened. The provider may have applied the refund, sent the email or committed the file before the connection dropped. The safe answer is to record the outcome as unknown, never send the request again under a new identity, keep its allowance held, and settle it from the provider's own record of that specific operation.
This guide is the runbook for that state: what Anlyon does automatically, what an operator does when automation runs out, and how to design actions so a lost response can still be read back.
TL;DR
- An unknown outcome is not a failure. Anlyon does not send the request again.
- Its allowance stays held until the outcome settles, so another agent cannot spend it.
- Anlyon looks the operation up at the provider, read-only, up to 12 times with backoff.
- Four ways out: a read-back match, an on-demand reconcile, a same-key replay (Stripe and Resend, 24 hours), or an operator's resolution labelled
manual. - Finding nothing is not proof the write failed.
Why is a timeout not a failure?
A timeout, a reset connection, a 5xx or a worker that dies after sending all end the same way: the request may have arrived. Calling that failed invites a retry, and a retried refund is a second refund. So a governed action whose response is lost records:
{ "status": "unknown", "grade": "unknown" }
The HTTP status of the invoke is 200. The uncertainty is in the body, so a caller that checks only the status code misses it. A 409 from Stripe or Resend on an idempotent write is also recorded unknown, because it can mean the idempotency key is still in use. Other provider 4xx answers are failed.
On the agent side, the rule is short: keep the effect id, and do not invoke again.
import { Client } from '@anlyonhq/sdk';
const agent = new Client({ apiKey: process.env.ANLYON_AGENT_KEY! });
const operationKey = 'refund-request-42'; // persisted before the call
const { data } = await agent.actions.invoke(
'refund',
{ paymentIntent: 'pi_3Pabc', amount: 3000, currency: 'usd' },
{ operationKey },
);
if (data!.status === 'unknown') {
// Store the effect id against your own refund request, and stop.
console.log('Unresolved', operationKey, data!.effectId, data!.grade);
}
If the agent or a restarted worker repeats exactly this call, the same operationKey with the same request returns the existing effect in its current state. Nothing is sent. A new key would be a new refund. For how to keep that key stable across crashes, see resuming an agent after a restart. For what the tool should tell the model, see structured tool outcomes.
Why does an unknown action still hold my allowance?
Every governed action reserves its impact against applicable impact limits before dispatch. When the outcome is unknown, that reservation is neither consumed nor released. It is held, and it survives restarts and period boundaries.
A worked example. A refund action sits under a $100.00 daily limit, which is 10,000 in integer minor units:
| Field | Value | What it means |
|---|---|---|
limit | 10000 | $100.00 for the UTC day |
consumed | 4000 | Refunds that settled as succeeded |
reserved | 5000 | A $20.00 refund still dispatching, plus a $30.00 refund whose response was lost |
unknownExposure | 3000 | The part of reserved whose outcome is unknown. Not additional |
available | 1000 | limit - consumed - reserved |
The $30.00 refund is not spare capacity because Stripe did not answer. If it landed, releasing it would let the next agent refund money the limit already covered. Read these numbers from the API, not from a cached dashboard total:
const ops = new Client({ apiKey: process.env.ANLYON_OPERATOR_KEY! });
const { data: limits } = await ops.impactLimits.list();
for (const l of limits ?? []) {
console.log(l.name, { consumed: l.consumed, reserved: l.reserved, unknownExposure: l.unknownExposure, available: l.available });
}
Raising the limit is a decision to permit more exposure. It is not evidence that the original refund failed, and lowering a limit never releases what is already held. A dependent action also waits: unknown and pending never satisfy a dependsOn, so a call that depends on this refund is refused with DEPENDENCY_UNRESOLVED.
How does Anlyon find out what happened?
When it records the unknown outcome, Anlyon schedules a lookup. The lookup reads and never writes. The delay starts at 30 seconds and doubles after each attempt, up to one hour. After 12 attempts automatic reconciliation stops and the effect shows reconciliation.exhausted: true. It is still unknown, and its allowance is still held. Nothing times out into failed.
What the lookup asks depends on the action:
| Action | Lookup after a lost response | Same-key replay |
|---|---|---|
stripe.refund | By refund id, or by the anlyon_effect metadata every refund carries | Yes, within 24 hours |
github.file_update | A commit on the branch whose message carries the effect trailer | No |
resend.email_send | By email id, or a scan of recent sent emails for the anlyon_effect tag, bounded at 3 pages and 20 reads | Yes, within 24 hours |
| Declared HTTP action | Repeats your verify rule, when the rule does not need the lost response | No |
A match settles the effect. For an adapter that read the provider's own record, or a declared action whose verify rule matched, the grade is confirmed. The limit moves the amount from reserved to consumed, in the period the reservation was made.
Why is an empty search not proof of failure?
Absence of evidence is not evidence of absence. Stripe metadata can be removed after the fact. A force-push can remove a commit that landed. A provider list can lag, and every search here is bounded. So a lookup that finds nothing leaves the effect unknown.
After dispatch, the provider's own record of this operation in a failed state is what settles an effect failed without an operator. A Stripe refund that Stripe reports as failed is that. Not finding the refund is not. A customer saying they never received an email is not either.
The same caution applies to attribution. Matching a file's current content does not prove this action wrote it, because another writer could have. Look for evidence the write itself created: the effect trailer on the commit, the effect tag on the email, the effect metadata on the refund.
How do I design a read-back that survives a lost response?
For a declared action, the verify rule is the lookup. A rule that builds its URL from the write response, such as {{response.id}}, cannot run once that response is lost. The id was in it. Reconciliation sends no request, and the effect waits for an operator. The preview says so in advance, in its limitations block.
The fix is an identifier known before dispatch. If the API lets the caller choose the id, write to it and read it back at the same place:
await ops.actions.declare('send-email', {
impact: { dimension: 'emails', amount: 'count(input.to)', bound: 'exact' },
verify: {
url: 'https://api.example.com/v1/emails/{{input.emailId}}',
status: 200,
match: [
{ path: 'id', equals: '{{input.emailId}}' },
{ path: 'status', equals: 'sent' },
],
},
});
Then make the match discriminating. A 200 from a health endpoint, or a resource that already had the desired value, can match without this write landing. Match fields the write created: the operation id, the target, the consequential value. If the provider does not expose that evidence, say so in the action's review notes instead of calling the result verified. The read-back design guide goes through weak and strong rules in detail.
| API design | After a lost response |
|---|---|
| The provider assigns an id and returns it only in the response | Nothing to look up. An operator resolves it |
| The request carries an id your application chose | The read-back can locate the operation |
| The read returns only the current value | A match may not identify which write produced it |
| The read returns the operation id, target and result | Strong evidence this operation landed |
What does the operator runbook look like?
Reconcile needs actions:invoke. Notes, resolution and replay need actions:resolve, which no key receives by default, and the key that requested an effect can never resolve or replay it. Keep these with an operator, not with the agent.
1. Find what is open. List effects that still hold capacity, and look for exhausted ones.
const { data: open } = await ops.actions.effects({ unresolved: true });
for (const e of open ?? []) {
console.log(e.id, e.action.name, e.outcome, e.reconciliation.attempts, e.reconciliation.exhausted);
}
2. Read the effect. Evidence is append-only: each observation keeps its source, time and provider ids, and a later one never erases an earlier one.
const { data: effect } = await ops.actions.effect('eff_01JABCDEF');
for (const item of effect!.evidence) console.log(item.observedAt, item.source, item.summary);
for (const r of effect!.reservations) console.log(r.name, r.amount, r.state, r.exposure);
3. Ask again now. An on-demand reconcile runs the same read-only lookup without waiting for the schedule, and it works while the environment is halted.
const { data: after } = await ops.actions.reconcileEffect('eff_01JABCDEF');
console.log(after!.outcome, after!.grade, after!.verification);
4. Replay, where the provider deduplicates. For stripe.refund and resend.email_send, inside 24 hours, replayEffect repeats the write under the same provider idempotency key. It passes every control a dispatch passes: current preview, valid approval, same action version, no halt, active requesting credential, current policy. A refusal answers 409 REPLAY_REFUSED and sends nothing. GitHub file updates and declared actions refuse a replay before any write.
await ops.actions.replayEffect('eff_01JABCDEF');
5. Resolve with evidence. When no lookup can settle it, record what you checked. The reason is 10 to 2,000 characters.
await ops.actions.addEffectNote('eff_01JABCDEF', 'Stripe support ticket 81233 confirms refund re_3Pxyz for pi_3Pabc.');
const { data: resolved } = await ops.actions.resolveEffect('eff_01JABCDEF', {
outcome: 'succeeded',
reason: 'Stripe dashboard shows refund re_3Pxyz of 3000 usd on pi_3Pabc at 14:02 UTC.',
externalReference: 're_3Pxyz',
});
console.log(resolved!.grade, resolved!.verification); // acknowledged, manual
A manual succeeded grades acknowledged, never confirmed, and keeps verification: "manual" wherever it is shown. A manual failed releases the allowance, so never resolve failure to free capacity. That turns accounting pressure into a claim about the world you have not checked. An invocation governed by an effect is resolved through its effect: resolving the invocation directly is refused with EFFECT_RESOLUTION_REQUIRED.
What evidence belongs in a resolution?
| Evidence | Question to ask |
|---|---|
| Provider operation record | Does it identify this operation, target and amount? |
| Current resource state | Could another actor have produced the same state? |
| Empty provider search | Was it exhaustive, and recent enough? |
| Support confirmation | Which exact operation and time window does it cover? |
Record the effect and invocation ids, environment, action version, operation key, target, amount and timestamps. Keep secret values and unneeded customer content out of notes. Then tell your application which business operation settled, so a restarted agent does not recreate it. For the wider incident record, see investigating one agent action.
Where can I try this safely?
Run the lost-response model locally to see the accounting without a provider. For a real Stripe test account, the stripe.refund adapter has a fault drill that discards Stripe's response on purpose, described in the governed effects reference. The full lifecycle is in When the outcome is unknown, and the background is in what a timed-out API call means.
Frequently asked questions
- My AI agent's API call timed out. Did the action happen?
- You cannot tell from the timeout. The request may have reached the provider and been applied before the connection failed. Treat the outcome as unknown, do not send the request again under a new key, and look for the provider's own record of that specific operation, using an identifier that existed before the request was sent.
- Why does a timed-out action still use my agent's allowance?
- Because it may have happened. Anlyon reserves an action's impact before dispatch, and while the outcome is unknown that reservation is neither consumed nor released. Releasing it would let another agent spend capacity the first operation may already have used. It settles when a read-back finds the operation, a same-key replay recovers it, or an operator resolves it.
- Does Anlyon retry an action whose response was lost?
- No. Anlyon does not send the request again. It schedules read-only lookups at the provider, backing off from 30 seconds to one hour, and stops after 12 attempts. After that the effect stays unknown until an operator resolves it. Stripe refunds and Resend sends also offer an explicit same-key replay inside a 24-hour window, which an operator holding actions:resolve can request.
- Can an operator mark an unknown action as succeeded?
- Yes, with resolveEffect and a written reason. The resolution is labelled manual, never provider verification, and a manual succeeded grades acknowledged rather than confirmed. It needs the actions:resolve scope, and the key that requested the effect can never resolve it.
