Runtimes
Flexible, secure, and scalable code execution with CAMEL’s runtime environments: guardrails, Docker, remote, and cloud sandboxes.
CAMEL’s runtime module enables the secure, flexible, and isolated execution of tools and code. Runtimes allow agents to safely run functions in controlled environments—from in-process security checks to Docker isolation and remote/cloud sandboxes.
What are Runtimes?
Modern agent systems often require more than a simple interpreter. Runtimes provide safe, scalable execution via guardrails, isolation, or remote/cloud endpoints—ideal for complex or untrusted code.
LLMGuardRuntime
Guardrail layer for safe function execution.
- LLM-based risk scoring (1=safe, 3=unsafe)
- Threshold control for blocking risky calls
- Pre-configured safety system prompt/tool
DockerRuntime / UbuntuDockerRuntime
Isolated, reproducible containers via Docker.
- Sandbox tool execution for safety
- FastAPI server for tool endpoints
- Ubuntu flavor supports .py script execution, env vars, and more
RemoteHttpRuntime
Remote, distributed execution on HTTP servers.
- Tool execution via FastAPI HTTP APIs
- Distribute compute and offload risky code
- Easy integration with remote endpoints
DaytonaRuntime
Cloud-managed sandboxing with Daytona SDK.
- Secure remote sandbox per tool
- Upload, run, and manage source code safely
- Automated input/output handling
Runtime Interface
All runtimes inherit from BaseRuntime, which defines core methods:
add(funcs)
: Register one or moreFunctionTool
objects for executionreset()
: Reset the runtime to its initial stateget_tools()
: List all tools managed by the runtime
Quick Start Example: RemoteHttpRuntime
Remote HTTP Runtime Example
Easily run tools in a remote FastAPI-based runtime—great for scaling, isolation, and experimentation.
Runtime Types: Key Features
LLMGuardRuntime
LLMGuardRuntime
- Evaluates risk before executing functions or tool calls (risk scores 1-3)
- Customizable LLM-driven safety logic
- Blocks or allows function execution based on threshold
DockerRuntime / UbuntuDockerRuntime
DockerRuntime / UbuntuDockerRuntime
- Runs CAMEL tools/agents in Docker containers for isolation and reproducibility
- UbuntuDocker flavor adds support for full script execution and system-level configuration
- Preconfigures
PYTHON_EXECUTABLE
,PYTHONPATH
, and more for custom envs
RemoteHttpRuntime
RemoteHttpRuntime
- Executes registered tools on a remote FastAPI server via HTTP endpoints
- Ideal for distributed, scalable, or cross-server tool execution
DaytonaRuntime
DaytonaRuntime
- Runs code in a managed, remote cloud sandbox using Daytona SDK
- Uploads user code, executes with input/output capture
- Safety and resource guarantees from cloud provider
More Examples
You’ll find runnable scripts for each runtime in examples/runtime/ in our main repo.
Each script demonstrates how to initialize and use a specific runtime—perfect for experimentation or production setups.
Final Note
The runtime system primarily sandboxes FunctionTool
-style tool functions.
For agent-level, dynamic code execution, always consider dedicated sandboxing—such as UbuntuDockerRuntime’s exec_python_file()
—for running dynamically generated scripts with maximum isolation and safety.