Skip to main content

Approval snapshots

When a tool needs human approval, the agent pauses and saves enough state to resume after a decision. The application can approve or reject the request, then continue the agent from the saved checkpoint. The Python SDK exposes ApprovalRequired and agent.resume(...); TypeScript, Go, C#, Java, and Rust expose the same resume capability through their persistence APIs.

The examples below start from an already-created pending snapshot named snap_01; they show the decision and continuation step, not the initial agent setup. Resume against the same persistence store and provide compatible callbacks and workspace state.

import asyncio
from ish import ApprovalRequired


async def main() -> None:
try:
result = await agent.run("Remove the temporary report.")
except ApprovalRequired as signal:
print(f"Review the pending action for snapshot {signal.snapshot_id}")
result = await agent.resume(
snapshot_id=signal.snapshot_id,
approved=False,
feedback="Keep the report and explain why it is no longer needed.",
)
print(result.content)


asyncio.run(main())

Resume approvals safely​

Resuming a paused run does not automatically repeat the tool call that needed approval. ISH checks whether tracked workspace files have changed since the pause and makes sure only one resume attempt can proceed at a time. If the workspace changed, the application can stop, warn, or continue according to the on_drift setting.

If the workspace changed (on_drift)​

Before resuming, ISH compares a limited set of workspace files with the copies recorded when the run paused. It skips common generated and hidden directories.

  • At most 100 files are checked by default.
  • Hidden files and common build, dependency, and cache directories are skipped.
  • A changed or deleted tracked file counts as a workspace change.

| on_drift setting | Behavior when a file changed | | --- | --- | --- | | "raise" | Stop and return an error. | | "warn" | Continue and include a warning for the application. | | "ignore" | Continue without reporting the change. |

ISH also records which resume attempt is active and whether it completed. If the process stops during resume, the application must inspect the saved status and decide whether retrying is safe. These records prevent two workers from resuming the same snapshot at once; they do not make external actions part of the same database transaction.

Agent run checkpoints​

An agent run can also save progress between model and tool calls. If the process stops, this checkpoint helps the application see what was happening and avoid repeating work that ISH already recorded as complete.

The saved progress is limited to 16 MiB and checked for accidental changes when it is read. If a process stops while a model or tool call is in progress, the application should inspect the checkpoint before deciding whether to retry. ISH cannot tell whether an unrelated external service completed an action unless that service provides a way to check its status.

Approval snapshot persistence depends on the configured persistence store and its lifetime. Use a SQLite database file or a custom storage connector if the application needs to retain resume state beyond the current process. Resume relies on local application callbacks and workspace state; do not assume that a snapshot can be moved to another machine or that it captures arbitrary external side effects.

For durable workflow snapshots, see workflow replay.