# Sandboxed agents cancel and recover across replicas without Redis

> Sandboxed ClaudeAgent and CodexAgent runs in Agno AgentOS now cancel and recover across replicas on a Postgres durable queue, with no Redis required.

- Published: 2026-11-12
- Author: Yash Pratap Solanky
- Categories: Changelog
- Canonical: https://www.agno.com/blog/sandboxed-agents-cancel-and-recover-across-replicas-without-redis
- Markdown: https://www.agno.com/blog/sandboxed-agents-cancel-and-recover-across-replicas-without-redis.md

Sandboxed `ClaudeAgent` and `CodexAgent` runs now cancel and recover correctly across AgentOS replicas that share Postgres and a checkpoint store, with no Redis required. Agno's durable queue, `QueueConfig(durable=True)`, handles both, along with `/resume`.

Before, a cancel that reached the wrong replica settled the run as failed, and a resumed stream could tail forever. Large checkpoint transfers also held a database transaction open the whole time.

```python
sandbox = DockerSandbox(
    "agno-sandbox:local",
    network="isolated",
    checkpoints=FileCheckpointStore(Path("/shared/checkpoints")),
)
agent = ClaudeAgent(id="coder", permission_mode="acceptEdits", sandbox=sandbox)

agent_os = AgentOS(
    agents=[agent],
    db=db,
    queue=QueueConfig(durable=True, db=db, max_attempts=2),
)
```

- A cancel sent to the replica that isn't running the turn now ends it as cancelled. When the turn fails, the replica running it checks Postgres for that cancel.
- `/resume` on a replica that can't see the run's live events answers from the database with the run's real status. The stream closes with `stream_expired` or `replay`, and the client polls the run for its output.
- An attempt that finds its computer gone removes what's left, restores the last checkpoint onto a new one and finishes the turn, so `max_attempts=2` covers losing either the worker process or the host.
- The queue worker retires computers kept warm past `warm_computer_seconds` every 180 seconds, on every replica.

Checkpoint restore and capture used to run inside the Postgres transaction that locked the session, run and binding rows. While files moved, the cancel endpoint and the queue's writers waited, a pooled connection stayed checked out, the heartbeat couldn't renew the lease, and a database with `idle_in_transaction_session_timeout` killed the turn. Both transfers now run with no transaction open. The binding records the pending restore, a short transaction under the lease confirms it, and nothing executes on the computer until that confirmation commits.

We started this AgentOS against an embedded Postgres with no Redis, and it came up on the queue. The cancel, resume and recovery paths need a real sandbox image, so this entry describes them from the pull requests and their tests.

See the [cookbook](https://github.com/agno-agi/agno/blob/main/cookbook/frameworks/sandbox/docker/agentos.py), and learn more about [multi-replica deployments](https://docs.agno.com/agent-os/background-execution/multi-replica) in the documentation.
