cage-bro Python SDK
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)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| cage_bro-0.2.0.tar.gz | 3.5 kB | Without provenance | Details for cage_bro-0.2.0.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| cage_bro-0.2.0-py3-none-any.whl | Python 3 | none | any | Details for cage_bro-0.2.0-py3-none-any.whl |
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
|
Security for cage-bro 0.2.0
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.