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.
- Python
- TypeScript
- Rust
- Go
- C#
- Java
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())
import { ApprovalResumeSupport, IshClient, PersistenceStore } from "ish-harness";
const client = new IshClient();
const store = new PersistenceStore(client, {
path: "./data/traces.db",
mode: "DiskSync",
});
const approval = new ApprovalResumeSupport(client, store.handle);
const resumed = await approval.resume("snap_01", {
approved: false,
feedback: "Keep the report and explain why it is no longer needed.",
continueRun: async ({ history, environmentWarning }) => ({
history,
warning: environmentWarning,
}),
});
console.log(resumed);
store.close();
client.close();
use ish_harness::engine::approval_resume::ApprovalResumeSession;
use ish_harness::persistence::SqliteWalLogger;
let logger = SqliteWalLogger::new("./data/traces.db")?;
let inspection = ApprovalResumeSession::inspect(&logger, "snap_01", true, "warn", ".")?;
if !inspection.blocked {
let mut session = ApprovalResumeSession::begin(
logger,
"snap_01",
Some(inspection.revision),
false,
Some("Keep the report and explain why it is no longer needed."),
)?;
session.finish()?;
}
store, err := ish.NewPersistenceStore(client, "./data/traces.db", "DiskSync", nil, "")
if err != nil {
panic(err)
}
defer store.Close()
approval, err := ish.NewApprovalResumeSupport(client, store.Handle)
if err != nil {
panic(err)
}
resumed, err := approval.Resume(
ctx,
"snap_01",
func(ctx context.Context, rc ish.ApprovalResumeContext) (any, error) {
return rc.Plan, nil
},
nil, // executeAction callback if approved
nil, // expectedRevision (use inspected revision)
false, // approved
"Keep the report and explain why it is no longer needed.",
true, // verifyEnvironment
"warn",
".",
)
fmt.Println(resumed, err)
using Ish.Harness;
using var client = new IshClient();
using var store = new PersistenceStore(client, path: "./data/traces.db", mode: "DiskSync");
var approval = new ApprovalResumeSupport(client, store.Handle);
var resumed = approval.Resume(
snapshotId: "snap_01",
continueRun: rc => rc.Plan.ToJsonString(),
approved: false,
feedback: "Keep the report and explain why it is no longer needed.");
Console.WriteLine(resumed);
import io.github.ishharness.ApprovalResumeSupport;
import io.github.ishharness.PersistenceStore;
try (var store = new PersistenceStore(client, "./data/traces.db", "DiskSync", null, null)) {
var approval = new ApprovalResumeSupport(client, store.handle());
String outcome = approval.resume(
"snap_01",
null,
false,
"Keep the report and explain why it is no longer needed.",
null,
rc -> rc.plan().toString());
System.out.println(outcome);
}
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
100files 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.