Mastra remote sandboxes: Daytona and E2B tutorial
Learn how Mastra workspaces use Daytona and E2B sandboxes, S3 storage, and a PDF skill to build activity planners and coding agents.
Player not loading? Watch on YouTube
Alex Booker demonstrates remote sandbox support in Mastra, an open source TypeScript framework. The examples give an AI agent a separate environment for shell commands and generated files. These demos use remote sandbox providers rather than showing how to run models locally.
The first example adds a Daytona sandbox to the default weather agent. It converts temperatures with awk, saves weather.txt, and resumes a stopped sandbox to read the file. Booker configures a one-minute inactivity pause and explains the ephemeral option for deleting a sandbox after use.
An activity planner uses E2B with Linux and Python packages prepared through a template. A Mastra workspace mounts S3 storage for activity guides, skills, and output files. The agent searches Markdown guides with BM25, checks the weather, and uses Anthropic's PDF skill to create a London itinerary and add a watermark. The sample activities are fictional. Booker also describes support for vector and hybrid search.
The final coding assistant demo assigns a Daytona sandbox to each user ID. A starter snapshot supplies the application setup, while a background server provides a preview link with hot module reloading. Booker presents sandbox isolation as a security benefit; the demonstration does not establish a universal guarantee against prompt injection or data exposure.