PromptisePromptise
Docs
GitHub
Promptise - AI Framework LogoPromptise

The foundation layer for agentic intelligence. Build, secure and operate autonomous AI systems with Promptise Foundry.

pip install promptise

[01] Foundry

  • MCPcast
  • The Promptise Agent
  • Reasoning Engine
  • MCP
  • Agent Runtime
  • Prompt Engineering
  • Execution Engine
  • Agent Identity

[02] Resources

  • Documentation
  • GitHub
  • Guides
  • Learning Paths
  • Questions

[03] Company

  • About
  • Terms of Service
  • Privacy Policy
  • Cookie Policy
  • Subprocessors

© 2026 Promptise by Manser Ventures. All rights reserved.

Open source · Python

← Guides> Library> Topic

Running LLM-generated code safely: code execution and sandboxing

Letting a model write and run code is powerful: it can do exact arithmetic, transform data and chain many steps in one program instead of dozens of tool calls. It is also risky, because the code is untrusted. It might read files, open network connections, loop forever or exhaust memory, whether by mistake or because a prompt injection told it to.

A sandbox runs that code in isolation, usually a container with no network, a read-only file system and limits on time, memory and processes. These guides show how to set up such a sandbox in Python, how code-action agents write one program in place of many tool calls, and how Program-of-Thought prompting hands calculations to code that runs safely.

[n.01/02]> 3 guides
  1. 01AI Agent Code Execution Sandbox: Run LLM Code SafelyLet an AI agent write and run Python in a Docker sandbox: analyse a CSV, try real escape attempts, set limits, and learn where the sandbox stops.Intermediate · 18 minOct 11, 2026
  2. 02Code-Action Agents in Python: One Program vs 37 Tool CallsBuild a code-action agent in Python over an MCP server, test it against ReAct in 60 runs, and see why a tool budget set too low returns wrong answers.Advanced · 15 minOct 15, 2026
  3. 03Program-of-Thought in Python: Run Model Code SafelyCompute answers with model-written code in Python: an output contract, a locked-down Docker sandbox, a two-run check, and when to use a code tool instead.Advanced · 8 minOct 18, 2026
[n.02/02]> go further

Related topics

  • Agent Reasoning Patterns3
  • Deployment6
  • Model Context Protocol (MCP)37
  • Tool Calling16

Topic hubs

  • Tools and the Model Context Protocol (MCP)→
  • Agent reasoning patterns→
  • Guardrails and security→
  • Runtime, triggers and deployment→

By category and level

  • AI Engineering guides71
  • Prompt Engineering guides54
  • Intermediate guides80
  • Advanced guides24

Search every guide.

The library lists all guides with filters for topic, level, category and reading time.

All guidesLearning paths