Receipts and grades
Read the receipt of every call Anlyon made for your agent: what the destination replied, which action version ran, for which user, and a grade that says how far the outcome was verified.
Because Anlyon makes the production call, it can say what happened to it. An invocation is that record: one intended operation, its status, the destination’s reply, the action version that ran, the approval that let it through and the end user it acted for. A governed action adds an effect to the invocation, and every effect carries a grade that says how far the outcome was verified.
Why a graded receipt
After an incident the question is never “did the HTTP call return 200”. It is “did the refund happen, once, for the right customer, and who approved it”. A 2xx does not answer that, and a timeout does not mean nothing happened.
- Risk.
failedandunknownare separate statuses, so your code can retry what provably did not happen and stop on what might have. That is how one refund does not become two. - Effort. You do not write read-back checks, evidence logs or an operator queue for uncertain calls. Each receipt carries its evidence and the grade is derived for you.
- Cost. Filtering effects by grade gives you the short list that needs a person, instead of every call.
The seven grades
| Grade | Meaning |
|---|---|
confirmed |
The outcome is succeeded, and a read-back matched or an adapter read the provider’s own record of the operation. |
acknowledged |
The provider accepted the request with a 2xx. No read-back has matched. An operator’s manual succeeded also grades here. |
unknown |
No usable response. Anlyon does not send it again. It stays unknown until a read-back or an operator settles it. The allowance stays held. |
failed |
The provider rejected the request, or the request provably never left Anlyon. |
refused |
Anlyon refused at dispatch. Causes include an exhausted or unbounded limit, an expired preview or approval, a changed action version and a digest mismatch. |
denied |
The approval was denied. |
pending |
No receipt yet. The effect is waiting for approval, is being dispatched, or the provider accepted it and has not finished it. |
confirmed, acknowledged, unknown, failed, refused and denied are the six receipt grades. pending exists so the API returns a grade on every effect, including one that has not run.
An action with no declaration and no adapter creates no effect and returns no grade. Its succeeded status records an HTTP result, not independent verification of the business outcome.
How the grade is derived
An effect has a stage (where it is in Anlyon’s pipeline), an outcome (what happened in the world) and a verification (who established the outcome). The grade is derived from them by one rule in the database. No code path writes it. The rule is read top to bottom, and the earliest match wins:
| Order | Condition | Grade | verification |
|---|---|---|---|
| 1 | stage is rejected and the rejection reason is approval_denied |
denied |
not_dispatched |
| 2 | stage is rejected for any other reason |
refused |
not_dispatched |
| 3 | outcome is succeeded, established by the provider, and a read-back or the provider’s own record verified it |
confirmed |
provider |
| 4 | outcome is succeeded in any other case |
acknowledged |
provider or manual |
| 5 | outcome is failed |
failed |
provider, manual, or not_dispatched when the request never left Anlyon |
| 6 | outcome is unknown |
unknown |
unverified |
| 7 | Anything else: outcome is not_dispatched or pending |
pending |
not_dispatched or unverified |
A rejected effect always has outcome: not_dispatched. Nothing was sent.
Two rows deserve a second look. An acknowledged effect can show verification: provider: the provider’s 2xx established the outcome, and nothing read it back. And an approval that expired before anyone decided grades refused, not denied. Its rejection reason is approval_expired.
Read the grade of a call
The invoke response and a single invocation read carry the grade of the effect the invocation created. It is absent on list reads and when the invocation has no effect.
import { Client } from '@anlyonhq/sdk';
const agent = new Client({ apiKey: process.env.ANLYON_API_KEY! });
const { data } = await agent.actions.invoke(
'send-email',
{ messageId: 'm-1', subject: 'Welcome', to: ['a@example.com'] },
{ idempotencyKey: 'welcome:m-1' },
);
console.log(data!.status, data!.grade, data!.effectId, data!.actionVersionId);curl -s -X POST https://api.anlyon.com/api/v2/actions/send-email/invoke \
-H "Authorization: Bearer $ANLYON_API_KEY" \
-H "Content-Type: application/json" \
-H "Idempotency-Key: welcome:m-1" \
-d '{ "input": { "messageId": "m-1", "subject": "Welcome", "to": ["a@example.com"] } }'import os
from anlyon import Client
agent = Client(api_key=os.environ["ANLYON_API_KEY"])
result = agent.actions.invoke(
"send-email",
{"messageId": "m-1", "subject": "Welcome", "to": ["a@example.com"]},
idempotency_key="welcome:m-1",
)
print(result.data["status"], result.data["grade"], result.data["effectId"])send-email here is a declared action with a read-back. A response whose read-back matched:
{
"success": true,
"data": {
"id": "inv_01JABCDEF",
"actionName": "send-email",
"actionVersionId": "acv_01JABCDEF",
"status": "succeeded",
"grade": "confirmed",
"effectId": "eff_01JABCDEF",
"endUserId": null,
"responseStatus": 200,
"body": "{\"id\":\"m-1\",\"status\":\"queued\"}",
"error": null,
"durationMs": 412,
"approvalId": null,
"decision": null,
"retryOf": null,
"pendingApproval": false,
"createdAt": "2026-10-27T09:00:00.000Z",
"completedAt": "2026-10-27T09:00:00.412Z"
}
}
The invocation’s status and the effect’s grade answer different questions. An effect refused on an exhausted limit has invocation status: failed and grade: refused. A lost response has status: unknown and grade: unknown.
Find the receipts that need attention
List effects by grade, outcome or stage. unresolved: true lists everything still holding impact-limit capacity: pending, unknown or possibly partial.
const { data: unread } = await agent.actions.effects({ grade: 'acknowledged' });
const { data: open } = await agent.actions.effects({ unresolved: true });
const { data: oneUser } = await agent.actions.effects({ endUserId: 'user_4417', grade: 'unknown' });
const { data: effect } = await agent.actions.effect('eff_01JABCDEF');
for (const item of effect!.evidence) console.log(item.observedAt, item.source, item.summary);curl -s "https://api.anlyon.com/api/v2/actions/effects?grade=unknown&limit=50" \
-H "Authorization: Bearer $ANLYON_API_KEY"
curl -s https://api.anlyon.com/api/v2/actions/effects/eff_01JABCDEF \
-H "Authorization: Bearer $ANLYON_API_KEY"unread = agent.actions.effects(grade="acknowledged").data
open_effects = agent.actions.effects(unresolved=True).data
one_user = agent.actions.effects(end_user_id="user_4417", grade="unknown").data
effect = agent.actions.effect("eff_01JABCDEF").dataFilters on the list: action, outcome, stage, grade, unresolved, endUserId, actingFor (workspace for your own accounts, end_users for calls made for a user), limit (1 to 100, default 20) and offset. Reading effects needs actions:read, which is in the default set. A key created with endUserRequired sees only its own end user’s effects. API reference: List governed effects, Get an effect.
A single effect adds its attempts, its append-only evidence, its limit reservations and the preview its approval was bound to. See Governed effects.
Read an invocation
Every action has invocations, governed or not.
const { data } = await agent.actions.invocation('inv_01JABCDEF');
console.log(data!.status); // pending_approval | running | succeeded | failed | unknown | denied | expired
console.log(data!.responseStatus); // what the destination replied, or null
console.log(data!.approvalId); // set when the call was gated
console.log(data!.decision); // why it was allowed or refused, when a policy, person or expiry decided
const { data: queue } = await agent.actions.invocations({ status: 'unknown' });
const { data: refunds } = await agent.actions.invocationsFor('refund-order', { limit: 50 });curl -s https://api.anlyon.com/api/v2/actions/invocations/inv_01JABCDEF \
-H "Authorization: Bearer $ANLYON_API_KEY"
curl -s "https://api.anlyon.com/api/v2/actions/invocations?status=unknown&actingFor=end_users" \
-H "Authorization: Bearer $ANLYON_API_KEY"data = agent.actions.invocation("inv_01JABCDEF").data
print(data["status"], data["responseStatus"])
queue = agent.actions.invocations(status="unknown").data
refunds = agent.actions.invocations_for("refund-order", limit=50).dataThe list takes action, status, endUserId, actingFor, limit and offset. The console shows the same records under Actions → Invocations. API reference: Get an invocation, List invocations.
Tell failed from unknown
Two of these statuses look similar and mean opposite things.
| Status | What it means | What to do |
|---|---|---|
pending_approval |
Parked. Nobody has decided yet. | Wait, or poll the approval. |
running |
Dispatching now. | Wait. |
succeeded |
The destination replied with a 2xx. If the response body could not be read after the status arrived, the invocation is still succeeded and body says the body was unavailable. |
Read responseStatus and body. |
failed |
The call did not happen. It was refused before dispatch, failed before anything was sent, or the destination refused it with a 4xx (a 402, for example, is failed). |
Safe to retry once you have fixed the cause. |
unknown |
The request may have reached the destination and Anlyon cannot confirm the outcome. A timeout, a socket that died after the request was written, or a 5xx from the destination: a server error does not say the change was undone, so Anlyon treats a 5xx as indeterminate. responseStatus is kept when one arrived. |
Reconcile with the destination before doing anything else. Do not retry blind. |
denied |
A person, or a policy, declined. | Nothing ran. |
expired |
Nobody decided in time. | Nothing ran. |
An unknown invocation carries a message saying exactly that: the destination may have received this request, Anlyon cannot confirm the outcome, reconcile with the provider before retrying. Treat any status your code does not recognise as not successful, never as failed.
Resolve an unknown outcome
For a governed action, settle an unknown outcome through its effect: see When the outcome is unknown. For an action with no adapter and no declaration, check the destination yourself, then record what happened on the invocation. Nothing is sent to the destination.
import { Client } from '@anlyonhq/sdk';
// An operator key with actions:resolve. Never the key that made the call.
const operator = new Client({ apiKey: process.env.ANLYON_OPERATOR_KEY! });
const { data: queue } = await operator.actions.invocations({ status: 'unknown' });
await operator.actions.resolveInvocation('inv_01JABCDEF', {
outcome: 'failed',
evidence: 'Stripe shows no charge for order 4417.',
externalReference: 'order_4417',
});curl -s -X POST https://api.anlyon.com/api/v2/actions/invocations/inv_01JABCDEF/resolve \
-H "Authorization: Bearer $ANLYON_OPERATOR_KEY" \
-H "Content-Type: application/json" \
-d '{ "outcome": "failed", "evidence": "Stripe shows no charge for order 4417.", "externalReference": "order_4417" }'operator = Client(api_key=os.environ["ANLYON_OPERATOR_KEY"])
operator.actions.resolve_invocation(
"inv_01JABCDEF",
outcome="failed",
evidence="Stripe shows no charge for order 4417.",
external_reference="order_4417",
)- Who can resolve. A workspace admin in the console, or a key holding
actions:resolve, which no key receives by default. The key that made the call can never resolve it, so an agent cannot declare its own uncertain call failed and try again. - Evidence is required: 10 to 2000 characters, kept on the invocation with who resolved it and when. The invocation shows it as
resolution. - Billing follows the answer. Resolved
succeededis billed. Resolvedfailedreleases the reserved usage and refunds the key’s budget reservation. - One resolution wins. An invocation that is no longer
unknownreturns409, including when two operators resolve it at the same moment. - Governed invocations resolve through their effect. An invocation with an
effectIdanswers409 EFFECT_RESOLUTION_REQUIRED: resolve the effect instead, which also settles its limit allowance.
API reference: Resolve an unknown invocation.
Retry a failed call on purpose
Resolving does not free the original’s idempotency key. Running the action again is a new decision, made visible with retryOf:
await operator.actions.invoke(
'refund-order',
{ charge: 'ch_3P9x', amount: 12000 },
{ retryOf: 'inv_01JABCDEF', idempotencyKey: 'refund:4417:retry-1' },
);curl -s -X POST https://api.anlyon.com/api/v2/actions/refund-order/invoke \
-H "Authorization: Bearer $ANLYON_OPERATOR_KEY" \
-H "Content-Type: application/json" \
-H "Idempotency-Key: refund:4417:retry-1" \
-d '{ "input": { "charge": "ch_3P9x", "amount": 12000 }, "retryOf": "inv_01JABCDEF" }'operator.actions.invoke(
"refund-order",
{"charge": "ch_3P9x", "amount": 12000},
retry_of="inv_01JABCDEF",
idempotency_key="refund:4417:retry-1",
)A retry needs its own idempotency key and names the invocation it retries. It is allowed when the original is failed (on its own or resolved as failed) and of the same action. An unknown original must be resolved first, and a succeeded one cannot be retried this way: both answer 409. Each invocation can be retried once: if the retry fails, retry the retry. The link shows on both invocations as retryOf and retriedBy.
What is recorded, and what is scrubbed
| Recorded | Not recorded |
|---|---|
| Action name and the action version that executed | Any resolved secret value |
| Response status, truncated response body, duration | The interpolated URL or headers |
The approval id and the decision with its policy name and version, when gated. Who decided is on the approval |
|
The end user the call acted for (endUserId), or null for your own accounts |
|
| The run and span the invocation belongs to |
Log lines carry the action’s template, never the interpolated request. Anything the upstream sends back is scrubbed for secret values before it is persisted or logged, and the response body is truncated, so an API that echoes your request cannot put a credential into your own audit trail. Once an end user is erased, their id on these records reads erased~<hash>.
Attribute a call to the agent run that made it
Pass a runId and the invocation joins that run’s trace alongside the model calls and approval waits that led to it. That answers the question asked after an incident: which agent issued this refund, on which version of the action, and who approved it. A run can be exported as OpenTelemetry Protocol JSON with GET /api/v2/runs/{runId}/export.
See Analytics for aggregate reporting, and Approvals and policies for the decision half of the record.
Errors you may see
| Status and code | When | What to do |
|---|---|---|
409 on resolve |
The invocation is no longer unknown. |
Read it: someone already resolved it. |
409 EFFECT_RESOLUTION_REQUIRED |
The invocation belongs to a governed effect. | Resolve the effect at POST /api/v2/actions/effects/{id}/resolve. |
409 on retryOf |
The original is unknown, succeeded, or already retried. |
Resolve an unknown original first. Retry the retry when a retry failed. |
400 on retryOf |
No idempotency key, or the original belongs to another action. | Send a new key, and retry with the same action. |
403 |
The key lacks actions:resolve, or it made the call it is trying to resolve. |
Use a separate operator key or an admin in the console. |
How it behaves
- A receipt is a database record with provider evidence.
confirmedon a declared action means your own verify rule matched. A resource that already existed can match, so write a rule that distinguishes this write.- Confirmed is Resend’s record of the send, not inbox delivery.
acknowledgedmeans the provider answered2xxand nothing read the result back. A declared action with noverifyrule gradesacknowledged.- A manual
succeededgradesacknowledged. It keepsverification: manualand is never shown as provider verification. - A lost response that lookup cannot find stays
unknown. The effect keeps its allowance until evidence or an operator settles it. - A request is sent once. When the outcome cannot be confirmed, the invocation is recorded
unknownand you reconcile before retrying.
Related
- Idempotency and retries: retrying safely after a
failed, and what to do about anunknown. - When the outcome is unknown: reconcile, replay and resolve a governed effect.
- Governed effects: evidence, reconciliation and resolution of an effect.
- Approvals and policies: who decided, under which policy.
- Immutable versions and rollback: pinning the definition an invocation runs.

