Launch a New Career with Certificates from Google, IBM & Microsoft
Stuck in Tutorial Hell? Learn Backend Dev the Right Way
Overview
Google, IBM & Meta Certificates — All 10,000+ Courses at 40% Off
One annual plan covers every course and certificate on Coursera. 40% off for a limited time.
Get Full Access
This tutorial explores how to create secure Python sandboxes for AI agents to execute code safely. Learn why code sandboxing is essential for agent systems and explore different sandboxing approaches including Docker, Podman, Pyodide, Deno, and SmolAgents. Understand the technical workings of CPython sandboxes and the MCP-run-python implementation. Follow along with practical demonstrations of both pyodide-Deno sandbox with Pydantic AI and the mcp-run-python sandbox. Compare local sandboxing solutions with cloud alternatives like e2b to determine the best approach for your agent development needs. Access the repository at Trelis.com/ADVANCED-inference to implement these techniques in your own projects.
Syllabus
0:00 Why run code in a sandbox?
0:27 Code Sandboxing for Agents with mcp-run-python
1:08 Video Overview
2:30 Types of Sandbox Docker, Podman, Pyodide, Deno, SmolAgents
4:27 How a CPython Sandbox works e.g. smolagents
6:01 How the MCP-run-python sandbox works
6:56 Running a pyodide-Deno sandbox with pydantic AI
11:01 Running code in a mcp-run-python sandbox
14:50 Conclusions local sandboxing vs e2b
Taught by
Trelis Research