# Stateless Agent Architecture Patterns

> Design pattern for disposable agent sandboxes using external history and presigned URLs.

An architectural pattern from Browser Use detailing how to keep untrusted execution sandboxes completely disposable. By delegating conversation history management to a control plane and using presigned URLs for file storage, sandboxes can be killed or restarted anytime without credential exposure or state loss.

## How it works

- LLM calls: sandbox sends only new messages; control plane stores full conversation history in DB, reconstructs context per call, forwards to provider — kill and restart sandbox anytime, conversation resumes.
- File sync: sandbox never holds AWS keys; it requests session-scoped presigned S3 URLs from POST /presigned-urls and uploads/downloads /workspace files directly.

## What it is for

- Isolate untrusted agent code execution without losing conversation context
- Prevent sensitive cloud credentials from being exposed within agent sandboxes
- Enable zero-downtime restarts and migration of execution environments during long tasks

## Key points

- Control plane stores full conversation history in a centralized database
- Sandbox only emits delta messages, allowing the control plane to reconstruct LLM context
- Arbitrary sandbox restarts without disrupting ongoing user conversations
- Session-scoped presigned S3 URLs generated on demand to avoid sandbox AWS keys
- Direct file synchronization between sandbox workspace and object storage

## Pricing

Free

## Details

- Type: Tip
- Category: [Development](https://xiry.app/topics/development.md)
- Open source: no
- Platforms: other
- For: AI engineers and systems architects building code execution environments
- Tags: agents, sandboxing, architecture, security, llm

## Why it was saved

- [@larsencc, 27 February 2026](https://x.com/larsencc/status/2027225210412470668): Clean patterns for stateless sandboxes: LLM history owned by proxy, AWS credentials never reach the agent.

## Related

- [Browser Use Agent Sandbox Architecture](https://xiry.app/resources/browser-use-agent-sandbox-architecture): Architecture pattern for securely running code-executing agents inside isolated micro-VMs (Framework, Free)
- [ScrapeGraphAI](https://xiry.app/resources/scrapegraphai): Open-source Python library and API for prompt-based web scraping using LLMs (GitHub repo, Freemium)
- [AIMap](https://xiry.app/resources/aimap): Discovery and security testing platform for exposed internet-facing AI endpoints. (Web app, Open source)
- [Enabling FIRE-1 in the Firecrawl Scrape API](https://xiry.app/resources/enabling-fire-1-in-the-firecrawl-scrape-api): API configuration pattern for Firecrawl's agent-driven web navigation model (Tip, Freemium)
- [Fractals](https://xiry.app/resources/fractals): Recursive task orchestrator running agent swarms in isolated git worktrees. (GitHub repo, Open source)
- [Sandbox Hardening Checklist for Code-Executing Agents](https://xiry.app/resources/sandbox-hardening-checklist-for-code-executing-agents): A three-step checklist to isolate and harden runtimes for arbitrary code execution. (Tip, Free)

Updated 11 October 2026. Page: https://xiry.app/resources/stateless-agent-architecture-patterns

Make your own library: Xiry takes your saved reels, tweets, Reddit bookmarks and Watch Later videos, makes them searchable and pulls the useful stuff out, like this library. It's invite-only for now; join the waitlist at https://xiry.app/#waitlist.
