> ## Documentation Index
> Fetch the complete documentation index at: https://praison.ai/docs/llms.txt
> Use this file to discover all available pages before exploring further.

# Sandbox Protocol • AI Agent SDK

> SandboxProtocol: Protocol for sandbox implementations.

# SandboxProtocol

> Defined in the [**protocols**](../modules/protocols) module.

<Badge color="blue">AI Agent</Badge>

Protocol for sandbox implementations.

Sandboxes provide isolated environments for safe code execution.
Implementations can use Docker, subprocess isolation, or other
containerization technologies.

Example usage (implementation in praisonai wrapper):
from praisonai.sandbox import DockerSandbox

sandbox = DockerSandbox(image="python:3.11-slim")
result = await sandbox.execute("print('Hello, World!')")
print(result.stdout)

## Methods

<CardGroup cols={2}>
  <Card title="is_available()" icon="function" href="../functions/SandboxProtocol-is_available">
    Whether the sandbox backend is available.
  </Card>

  <Card title="sandbox_type()" icon="function" href="../functions/SandboxProtocol-sandbox_type">
    Type of sandbox (docker, subprocess, etc.).
  </Card>

  <Card title="start()" icon="function" href="../functions/SandboxProtocol-start">
    Start/initialize the sandbox environment.
  </Card>

  <Card title="stop()" icon="function" href="../functions/SandboxProtocol-stop">
    Stop/cleanup the sandbox environment.
  </Card>

  <Card title="execute()" icon="function" href="../functions/SandboxProtocol-execute">
    Execute code in the sandbox.
  </Card>

  <Card title="execute_file()" icon="function" href="../functions/SandboxProtocol-execute_file">
    Execute a file in the sandbox.
  </Card>

  <Card title="run_command()" icon="function" href="../functions/SandboxProtocol-run_command">
    Run a shell command in the sandbox.
  </Card>

  <Card title="write_file()" icon="function" href="../functions/SandboxProtocol-write_file">
    Write a file to the sandbox.
  </Card>

  <Card title="read_file()" icon="function" href="../functions/SandboxProtocol-read_file">
    Read a file from the sandbox.
  </Card>

  <Card title="list_files()" icon="function" href="../functions/SandboxProtocol-list_files">
    List files in a sandbox directory.
  </Card>

  <Card title="get_status()" icon="function" href="../functions/SandboxProtocol-get_status">
    Get sandbox status information.
  </Card>

  <Card title="cleanup()" icon="function" href="../functions/SandboxProtocol-cleanup">
    Clean up sandbox resources (files, processes, etc.).
  </Card>

  <Card title="reset()" icon="function" href="../functions/SandboxProtocol-reset">
    Reset sandbox to initial state.
  </Card>
</CardGroup>

## Source

<Card title="View on GitHub" icon="github" href="https://github.com/MervinPraison/PraisonAI/blob/main/src/praisonai-agents/praisonaiagents/sandbox/protocols.py#L198">
  `praisonaiagents/sandbox/protocols.py` at line 198
</Card>

***

## Related Documentation

<CardGroup cols={2}>
  <Card title="Sandbox Feature" icon="box" href="/docs/features/sandbox" />
</CardGroup>
