4. AI agents under supervision
Run an AI agent in a sandbox, watch its sessions and roll back its changes.
In this lesson you run an agent in a sandbox, watch what it does and roll back its changes.
Video transcript
Lesson four: AI agents under supervision. We run an agent in a sandbox, watch what it does, and roll back its changes. To keep things predictable, the agent in the video is a simple script standing in for a real one; Claude Code and Codex work exactly the same way.
Run
run starts an agent in a sandbox, with its own home folder and only the environment it needs. The --worktree flag gives it a separate copy of the project on its own branch, so two agents never write to the same files, and the --checkpoints flag saves the folder after every turn.
tmgr run --agent claude-code --worktree --checkpoints --name site-footerThe live session view opens right away: type a request, and watch the agent edit files. Ctrl+] then D detaches, and the agent keeps working.
Watch
agents lists every session and its state: working, waiting for input, or blocked.
tmgr agentspeek prints a session's current screen as plain text, and attach brings the live view back.
tmgr peek site-footerRoll back
Every agent turn is a restore point. checkpoints list shows them.
tmgr checkpoints list site-footercheckpoints diff shows what changed in a step.
tmgr checkpoints diff site-footer 3checkpoints restore puts the folder back to that state. It asks for confirmation. The current state is saved first, so you can undo the rollback.
tmgr checkpoints restore site-footer 2And halt stops the session.
tmgr halt site-footerNext
Agents can also ask you questions directly. That's the next lesson: 5. The Decisions inbox.