Daytona Sandbox Tools
Description
The Daytona sandbox tools give CrewAI agents access to isolated, ephemeral compute environments powered by Daytona. Three tools are available so you can give an agent exactly the capabilities it needs:DaytonaExecTool— run any shell command inside a sandbox.DaytonaPythonTool— execute a block of Python source code inside a sandbox.DaytonaFileTool— read, write, append, list, delete, and inspect files inside a sandbox.
Installation
DAYTONA_API_URL and DAYTONA_TARGET are also respected if set.
Sandbox Lifecycle
All three tools inherit lifecycle controls fromDaytonaBaseTool:
Ephemeral mode is the safe default: nothing leaks if the agent forgets to clean up. Use persistent mode when you want filesystem state or installed packages to carry across multiple tool calls — this is typical when pairing
DaytonaFileTool with DaytonaExecTool.
Examples
One-shot Python execution (ephemeral)
Code
Multi-step shell session (persistent)
Code
Each tool instance maintains its own persistent sandbox. To share one sandbox across two tools, create the first tool, grab its sandbox id via
tool._persistent_sandbox.id, and pass it to the second tool via sandbox_id=....Attach to an existing sandbox
Code
Custom sandbox parameters
Pass Daytona’sCreateSandboxFromSnapshotParams kwargs via create_params:
Code
Agent integration
Code
