Skip to main content

cage-bro Python SDK

PyPI License

Python SDK for cage-bro — a sandboxed execution environment for AI agents with browser, shell, code execution, file ops, and MCP support.

Install

pip install cage-bro

Requires a running cage-bro server. See the main project for installation instructions.

Quick Start

from cage_bro import CageBro

cage = CageBro("http://localhost:8080")

# Shell commands
result = cage.shell_exec("ls -la")
print(result["stdout"])

# Code execution
result = cage.python("print(2 + 2)")
print(result["stdout"])

# File operations
cage.file_write("hello.txt", "world")
content = cage.file_read("hello.txt")

# Browser automation
cage.browser_launch()
cage.browser_navigate("https://example.com")
screenshot = cage.browser_screenshot()

Context Manager

with CageBro("http://localhost:8080") as cage:
    cage.shell_exec("echo hello")

API Reference

Sandbox

Method Description
info() Get sandbox info
health() Health check

Shell

Method Description
shell_exec(command, timeout_ms=None) Execute a shell command
shell_create_session(shell=None) Create a persistent shell session

Files

Method Description
file_read(path) Read a file and return its content
file_write(path, content) Write content to a file
file_edit(path, old_text, new_text) Edit a file (find and replace)
file_list(path=".") List directory contents
file_search(query, path=None) Search files for text
file_delete(path) Delete a file or directory

Code Execution

Method Description
python(code, timeout_ms=None) Execute Python code in the sandbox
node(code, timeout_ms=None) Execute Node.js code in the sandbox

Browser

Method Description
browser_launch(port=None, stealth=True) Launch the headless browser
browser_navigate(url) Navigate to a URL
browser_screenshot() Take a screenshot of the current page
browser_click(selector) Click an element by CSS selector
browser_type(selector, text) Type text into an input element
browser_evaluate(expression) Evaluate JavaScript in the browser
browser_content() Get the current page HTML content
browser_close() Close the browser

Links

License

Apache-2.0

Metadata

Release files for cage-bro 0.2.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for cage-bro 0.2.0
File Size Uploaded
cage_bro-0.2.0.tar.gz 3.5 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for cage-bro 0.2.0
File Interpreter ABI Platform
cage_bro-0.2.0-py3-none-any.whl Python 3 none any Details

Total release size: 7.4 kB

Release files / cage_bro-0.2.0.tar.gz

Download URL cage_bro-0.2.0.tar.gz
Size 3.5 kB
Tags Source
SHA-256 checksum
How to use checksums
169850b48aea84fb49649624b645648cfa9c99684101a2656d2e17947b15acca
BLAKE2b-256 checksum
How to use checksums
b858ca9c45dda04884f61d26593535c3b827be00a79d8e38a40a9070b909c6df
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.11.14

Release files / cage_bro-0.2.0-py3-none-any.whl

Download URL cage_bro-0.2.0-py3-none-any.whl
Size 3.9 kB
Tags Python 3
SHA-256 checksum
How to use checksums
a289aa2d51e3d83fa327ce76460fbc1aceb962ec2ff0b9570692ec3256f138ed
BLAKE2b-256 checksum
How to use checksums
d063e9adc4a18cf446a97721d28a0bc12d4c97c4a8f9bfbbcf6862a08ac41085
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.11.14

Release history Release notifications | RSS feed

This release

0.2.0 This release

2 release files

0.1.1

2 release files

0.1.0

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page