Skip to main content
← Back to Changelog
NEW FEATURE

Agent Sandboxes in Beta

Most code an agent writes is short and calls a few tools. That job needs an isolated interpreter, not a container or a VM. Agent Sandboxes runs it in Pydantic Monty, our open-source interpreter built with Rust, hosted and scaled by Logfire. There is nothing to boot, build, or keep warm between runs. Agent Sandboxes is in Beta and on for every plan.

The Agent Sandboxes overview in Logfire: sessions, code runs, host calls, OS calls and failures, a chart of code runs over the last 15 minutes, and the start of the sessions list

  • Only the tools you expose. Agent code reaches the functions your application hands it and nothing else. It gets no files, network, or secrets unless you grant them, and your tools keep their own access.
  • Cold start in milliseconds. Every run, and every user, gets a fresh session.
  • Limits that hold. Memory is bounded per session and CPU time per run. A loop that never ends hits its limit and stops, and your application carries on.
  • Pause at any tool call. Snapshot a session and pick it up later, right where it stopped, even after a deploy or a worker change.
  • Traced next to your agent. Every run shows up in Logfire beside the agent that asked for it, with each tool call and how long it took.

With Pydantic AI, pass CodeMode(monty_sandbox=logfire.agent_sandboxes) to your agent, with pydantic-ai-harness 0.67.0 or later, and the code it writes runs in Agent Sandboxes.

Every Logfire plan includes 50,000 free sandbox invocations a month. See pricing for more.

Where to find it: Agent Sandboxes in your project sidebar. See the Agent Sandboxes docs.

Get started with Logfire for free

Sign up today and see your first trace in under 2 minutes

01 Install

$ uv add logfire

Resolved 7 packages in 128ms
Installed 7 packages in 89ms
+ logfire

02 Instrument

import logfire

logfire.configure()
logfire.info('Hello {name}', name='world')

Free up to 10m records per month No credit card needed