---
title: "Building Agents that Don't Break Themselves"
description: "Separate where an agent lives from where it executes code: keep the agent loop on a durable host and send every shell command to a disposable Sprite sandbox."
url: "https://swe.quest/articles/building-agents-that-don-t-break-themselves-946af945ee4733ac"
canonical: "https://fly.io/blog/building-agents-that-dont-break-themselves/"
source: "Fly.io"
published: "2026-06-08"
difficulty: "medium"
kind: "Case study"
reading_minutes: 6
tags: ["ai-agents","sandboxing","identity-auth","virtualization"]
---

# Building Agents that Don't Break Themselves

A post on [Fly.io](https://swe.quest/sources/flyio.md), published 2026-06-08, 6 min read, Case study. Original: [https://fly.io/blog/building-agents-that-dont-break-themselves/](https://fly.io/blog/building-agents-that-dont-break-themselves/)

## Summary

Separate where an agent lives from where it executes code: keep the agent loop on a durable host and send every shell command to a disposable Sprite sandbox. SpriteDoc, an internal multi-user troubleshooting agent built on Pi, creates one Sprite per session on first filesystem use and tears it down when idle. It injects each user's flyctl token only for the duration of a single command, so no credential ever rests in the sandbox. Kyle's Hermes Agent backend instead keeps one persistent Sprite per task and skips dangerous-command approval prompts because the sandbox is the security boundary. Copy-on-write checkpoints let an agent that deletes its own work and toolchain be restored in about nine seconds.

Written by swe.quest, not by the author.

**Difficulty:** Medium: assumes a working developer; shows how it is built or done

## Topics

- [AI agents](https://swe.quest/tags/ai-agents.md) (AI & ML)
- [Sandboxing & isolation](https://swe.quest/tags/sandboxing.md) (Security)
- [Identity & auth](https://swe.quest/tags/identity-auth.md) (Security)
- [Virtualization](https://swe.quest/tags/virtualization.md) (Infrastructure)

## Prerequisites

- LLM agent tool loops ([easy posts on LLMs](https://swe.quest/tags/llms.md?difficulty=easy))
- sandboxing basics ([easy posts on Sandboxing & isolation](https://swe.quest/tags/sandboxing.md?difficulty=easy))

## Keywords

Fly.io, Sprites, SpriteDoc, Hermes Agent, Nous Research, flyctl, Pi agent

## Related posts

- [Agent Swarms on Sprites](https://swe.quest/articles/agent-swarms-on-sprites-839304324464381c.md): Fly.io · 2026-02-09 · Medium · 3 min read · AI agents, Sandboxing & isolation, AI for coding
  Running each coding agent in a swarm on its own Sprite (a Fly.io sandboxed machine) avoids the shared-filesystem, conflicting-dependency and blast-radius problems of co-located agents.
- [Why AI Agents Need Isolation](https://swe.quest/articles/why-ai-agents-need-isolation-2e7b1a6342af3236.md): Docker · 2026-07-01 · Easy · 9 min read · Sandboxing & isolation, AI agents, Virtualization, Containers, AI for coding
  AI coding agents that run commands, install packages and handle credentials should execute behind an isolation boundary rather than directly on the developer's host.
- [How to Run Untrusted Code Safely](https://swe.quest/articles/how-to-run-untrusted-code-safely-e25a4476701c9dc9.md): Fly.io · 2026-02-02 · Medium · 3 min read · Sandboxing & isolation, Virtualization, Security, AI agents
  Containers share the host kernel, so truly untrusted code such as AI-generated scripts or user submissions needs hardware isolation, allowlist-based network egress control enforced from outside the sandbox, rollback and multiple runtimes.
- [How to Choose the Right Sandbox for AI Agents](https://swe.quest/articles/how-to-choose-the-right-sandbox-for-ai-agents-9eb1c4b875269506.md): LangChain · 2026-11-18 · Easy · 7 min read · Sandboxing & isolation, AI agents, Security, Virtualization
  Agents that write and run code face prompt injection risk, and Willison's "lethal trifecta" (sensitive data, untrusted content, external communication) and Meta's "Agents Rule of Two" frame when autonomy becomes dangerous.
- [Scaling Managed Agents with stable interfaces](https://swe.quest/articles/scaling-managed-agents-with-stable-interfaces-06b4cb4f85923c79.md): Anthropic Engineering · 2026-04-08 · Medium · 9 min read · AI agents, System design, Sandboxing & isolation, Resilience, LLMs
  Claude Managed Agents splits a long-running agent into three virtualized interfaces: an append-only session log, a stateless harness that calls Claude and routes tool calls, and sandboxes reached through a generic \`execute(name, input) → string\` tool call.

Browse: [Latest posts](https://swe.quest/index.md) · [Topics](https://swe.quest/tags.md) · [Sources](https://swe.quest/sources.md) · [Topic map](https://swe.quest/map.md) · [Site guide (llms.txt)](https://swe.quest/llms.txt)
