Skip to main content

Documentation Index

Fetch the complete documentation index at: https://docs.camel-ai.org/llms.txt

Use this file to discover all available pages before exploring further.

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 more FunctionTool objects for execution
  • reset(): Reset the runtime to its initial state
  • get_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.

from camel.runtimes import RemoteHttpRuntime
from camel.toolkits import MathToolkit

if __name__ == "__main__":
    runtime = (
        RemoteHttpRuntime("localhost")
        .add(MathToolkit().get_tools(), "camel.toolkits.MathToolkit")
        .build()
    )

    print("Waiting for runtime to be ready...")
    runtime.wait()
    print("Runtime is ready.")

    # There are more tools imported from MathToolkit.
    # For simplicity, we use only "add" tool here
    add = runtime.get_tools()[0]
    print(f"Add 1 + 2: {add.func(1, 2)}")
    # Example output:
    # Add 1 + 2: 3

Runtime Types: Key Features

  • 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
  • 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
  • Executes registered tools on a remote FastAPI server via HTTP endpoints
  • Ideal for distributed, scalable, or cross-server tool execution
  • 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.