Class Central is learner-supported. When you buy through links on our site, we may earn an affiliate commission.

YouTube

Creating a Python Sandbox for Agents to Run Code

Trelis Research via YouTube

Overview

Coursera Flash Sale
40% Off Coursera Plus for 3 Months!
Grab it
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

Reviews

Start your review of Creating a Python Sandbox for Agents to Run Code

Never Stop Learning.

Get personalized course recommendations, track subjects and courses with reminders, and more.

Someone learning on their laptop while sitting on the floor.