All guides
Updated
Reading
8 min
By
Anlyon Team

How to safely resume an AI agent after halting it in an incident

An incident runbook for AI agent actions: halt the environment, take stock of what already left, roll back the definitions that caused it, correct what can be corrected, and resume with one observed operation.

  • halt
  • incident response
  • rollback
  • recovery
  • kill switch

To safely resume an AI agent after halting it, treat the halt as the start of the incident, not the end. Before you resume, list every operation that left around the halt and settle its outcome, fix or roll back whatever caused the incident, decide on corrections as separate reviewed operations, and then let one low-impact action run while you watch its receipt. Resuming is a decision about new work. It does nothing about work that already reached a provider.

TL;DR

  • environment.halt() stops new dispatch after the halt check. It cannot recall a request a provider already accepted.
  • During the halt, reconcile, notes and resolve still work. Replay and new invocations do not.
  • Inventory unresolved effects with actions.effects({ unresolved: true }) and settle them before resuming.
  • Rollback repoints an agent at earlier definitions for future calls. It does not undo a refund, an email or a commit.
  • Corrections are new operations with their own approval and receipt. Some effects have none.
  • Resume, run one small observed operation, and keep an owner on anything still unresolved.

What does a halt actually stop?

An Anlyon environment has one switch. An operator key holding environments:halt flips it, and no key gets that scope by default, because stopping the system is an operator act and not agent work. Put that key behind your on-call runbook, not in the agent's process.

import { Client } from '@anlyonhq/sdk';

// An operator key holding environments:halt. Never the agent's key.
const ops = new Client({ apiKey: process.env.ANLYON_OPERATOR_KEY! });

await ops.environment.halt({ reason: 'refund loop on ticket queue, INC-412' });

const { data: env } = await ops.environment.get();
console.log(env!.halted, env!.haltedAt, env!.haltedReason);

The key halts its own environment. A staging key halts staging and cannot reach production.

While haltedBehaviour
New action invocationsBlocked. An API key's invoke answers 409 ENVIRONMENT_HALTED
A call approved during the haltDoes not run. It is recorded as blocked and does not run later on resume
Queued deliveriesDefer, and resume releases them
Deciding approvalsStill works, including denying the ones that piled up
Reads, reconcile, notes, resolveStill work
Replay of a lost writeRefused with 409 ENVIRONMENT_HALTED
A request a provider already acceptedNot recalled
A provider call your code makes directlyOutside Anlyon, not stopped

Two consequences follow. First, anything the agent can reach without going through Anlyon is still live, so revoke or rotate that access if the incident involves it. Second, a halt is a stop, not an undo. The kill switch post goes into why the second limitation is unavoidable.

Which operations need attention before you resume?

Find the operations dispatched around the halt and sort them by what is known about them. Governed actions carry a receipt grade, which is the fastest way to triage.

import { Client } from '@anlyonhq/sdk';

const ops = new Client({ apiKey: process.env.ANLYON_OPERATOR_KEY! });

// Everything still holding capacity: pending, unknown or possibly partial.
const { data: open } = await ops.actions.effects({ unresolved: true, limit: 100 });
for (const e of open ?? []) {
  console.log(e.id, e.action.name, e.grade, e.outcome, e.target, e.firstDispatchedAt);
}

// What actually ran from the action that misbehaved.
const { data: ran } = await ops.actions.effects({ action: 'refund', grade: 'confirmed', limit: 100 });
What you findBefore resuming
Confirmed or acknowledged effectsDecide whether each needs a business correction
Unknown effectsReconcile from the provider's record, or assign an operator to resolve
Pending effectsLeave them to finish, and watch them
Pending approvalsRecheck relevance, expiry and current policy. Deny what the incident made wrong
Refused, failed and deniedNothing ran. Note them, and do not re-submit by reflex
Queued deliveriesReview destinations, because resume releases them

Unknown outcomes deserve the most care. A lost response means the provider may have done the work. Anlyon does not send the request again, and the outcome stays unknown until a read-back or an operator settles it. Recovery stays open during the halt on purpose:

import { Client } from '@anlyonhq/sdk';

const ops = new Client({ apiKey: process.env.ANLYON_OPERATOR_KEY! });

await ops.actions.reconcileEffect('eff_01JABCDEF'); // read-only lookup at the provider
await ops.actions.addEffectNote('eff_01JABCDEF', 'INC-412: refund loop. Checked Stripe dashboard 14:05 UTC.');

Reconcile needs actions:invoke. Notes and manual resolution need actions:resolve, and the key that requested an effect can never resolve it. A manual resolution is labelled manual and grades acknowledged when it records success. The full procedure, including what counts as evidence, is in how to reconcile an unknown agent action.

How do you fix the cause without re-arming it?

Look at what changed: the action definitions, their declarations, the secrets they reference, approval policies and the limits that apply. While halted, an API key cannot write to the actions API except for reconcile, notes and resolve. Make definition changes from the dashboard, or plan them for right after resume with the limit lowered.

If the incident came from a changed definition, the answer is often a rollback. Every edit to what an action sends appends an immutable version, and you can read them to find the last good one:

import { Client } from '@anlyonhq/sdk';

const ops = new Client({ apiKey: process.env.ANLYON_OPERATOR_KEY! });

const { data: versions } = await ops.actions.versions('refund');
for (const v of versions ?? []) {
  console.log(v.id, v.version, v.current, v.requiresApproval, v.impact, v.createdAt);
}

Rolling back an agent is a pointer move, done from Agents in the dashboard. It repoints the agent at an earlier immutable version, including the action versions that version pinned in its config.actions. Read the limits of that sentence carefully:

  • It applies to subsequent invocations. A call already in flight finishes on the definition it started with.
  • Pins apply to agent-attributed calls. An invocation runs the pinned version when it carries a runId whose run names the agent. A direct actions.invoke() with no run runs the action's current definition.
  • It restores what the version pinned, and no more. Prompts, policies, budgets and data the version did not pin stay as they are. Secrets resolve by name, so production keeps using its current credential. An earlier definition does not bring back a deleted secret.
  • It undoes nothing outside Anlyon. Every refund, email and commit made before the rollback still exists.

A version whose pinned action version can no longer be resolved fails the call with 409 ACTION_VERSION_PIN_UNRESOLVED rather than quietly running the current definition.

Can you undo what already ran?

Split the incident into two jobs: stop further wrong operations, then decide what to do about the ones that happened. The second job depends on the action.

Existing effectWhat a correction looks like
stripe.refundNo undo. A refund cannot be reversed through the Stripe API. Handle it as a business matter with the customer
resend.email_sendNo undo. A sent email cannot be recalled. A follow-up email is a new send with its own review
github.file_updateA new, separately reviewed file update that restores the intended content
A declared actionNot known to Anlyon. Define a separate governed action for the reversal, if the API has one

Where a correction exists, invoke it as its own governed effect with compensates: 'eff_...'. It gets its own preview, approval, impact and receipt, so the record shows the mistake and the correction as two operations. Do not hide a correction inside a retry of the original. And reconcile unknown effects before compensating: correcting an operation you only assumed happened can start a second incident.

Should you halt or lower a limit?

They are different controls, and incidents often need both in sequence.

Operator intentControl
Nothing new leaves while we investigateHalt the environment
The agent keeps working but moves lessLower the applicable limit
Stop a limit applying to new workArchive it, after checking what that permits
Find out what a timed-out action didReconcile or resolve that effect

Lowering a limit never releases capacity already held by pending or unknown operations, so do not expect a reduction to make earlier exposure disappear. A common sequence is: halt, settle the inventory, lower the limit that was too generous, resume. How to choose a limit's scope covers what the limit should cover in the first place.

How do you resume without starting the incident again?

Resume releases what the halt deferred and lets the agent act again:

import { Client } from '@anlyonhq/sdk';

const ops = new Client({ apiKey: process.env.ANLYON_OPERATOR_KEY! });

await ops.environment.resume();

Then choose one low-impact, explicitly authorized operation and follow it to its receipt. Watch the next few refusals, approvals and unknown outcomes rather than the HTTP status codes, because a refused or unknown governed invocation still answers HTTP 200 with the status and grade in the body. A recovered environment is one where receipts read the way you expect, not one where requests return 200.

If the agent restarts as part of recovery, make sure it picks up its unfinished operations under their original keys instead of starting them afresh. See how to resume an agent after a crash without repeating an action.

Write down which environment was halted and when, what changed, which effects were corrected, and which remain unresolved and who owns them. That record is what separates recovery traffic from the original incident when someone reads it next month. Investigating one consequential agent action covers the evidence to keep.

Frequently asked questions

What does halting an Anlyon environment stop?
It stops new dispatch after the halt check. Action invocations are blocked, including calls whose approval arrives during the halt, and an API key's invoke answers 409 ENVIRONMENT_HALTED. Queued deliveries defer and resume releases them. A request an external server already accepted is not recalled, and calls your code makes directly to a provider are outside the halt.
Does rolling back an agent undo the refunds or emails it already sent?
No. Rolling back repoints an agent at an earlier immutable version, including the action definitions that version pinned, for subsequent invocations. It does not undo an external effect already dispatched, and it does not restore prompts, policies, budgets or data the version did not pin. A correction is a separate operation with its own review and receipt.
Can I reconcile unknown outcomes while the environment is halted?
Yes. Reconcile, investigation notes and manual resolution stay available during a halt, so a halt never strands an outcome you need to settle. Replay does not: a replay is a write, and during a halt it answers 409 ENVIRONMENT_HALTED.
Should I halt the environment or lower a limit?
Halt when you need nothing new to leave the environment while you investigate. Lower a limit when the agent may keep working but should move less. Lowering a limit does not release capacity already held by pending or unknown operations, and neither control undoes work already dispatched.

Let your agent act for your users, safely.

A few lines of server code, then send a user a connect link. Nothing to host.

$ claude mcp add --transport http anlyon https://api.anlyon.com/mcp