Python SDK for cage-bro sandbox
Project description
cage-bro
Python SDK for cage-bro — a sandboxed execution environment for AI agents.
Install
pip install cage-bro
Quick Start
from cage_bro import CageBro
cage = CageBro("http://localhost:8080")
# Run shell commands
result = cage.shell_exec("ls -la")
print(result["stdout"])
# Execute code
result = cage.python("print(2 + 2)")
print(result["stdout"])
# Read/write files
cage.file_write("hello.txt", "world")
content = cage.file_read("hello.txt")
API
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 |
file_write(path, content) |
Write to a file |
file_edit(path, old_text, new_text) |
Edit a file (find & 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 |
node(code, timeout_ms=None) |
Execute Node.js code |
Browser
| Method | Description |
|---|---|
browser_launch(port=None, stealth=True) |
Launch the browser |
browser_navigate(url) |
Navigate to a URL |
browser_screenshot() |
Take a screenshot |
browser_click(selector) |
Click an element |
browser_type(selector, text) |
Type text into an element |
browser_evaluate(expression) |
Evaluate JavaScript |
browser_content() |
Get current page content |
browser_close() |
Close the browser |
Context Manager
with CageBro("http://localhost:8080") as cage:
cage.shell_exec("echo hello")
License
Apache-2.0
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
cage_bro-0.1.0.tar.gz
(3.1 kB
view details)
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file cage_bro-0.1.0.tar.gz.
File metadata
- Download URL: cage_bro-0.1.0.tar.gz
- Upload date:
- Size: 3.1 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.11.14
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
0e0ebedb1fed0cb183eb2e3f3f56840f06464588367e8f088d9a9bf37b03720e
|
|
| MD5 |
0c3b2601854b0099a9dd28e8a85162e9
|
|
| BLAKE2b-256 |
a8f87aca5664e01fbba0734fb2efcecf58228726fa3d4720277b9ced384bf7f8
|
File details
Details for the file cage_bro-0.1.0-py3-none-any.whl.
File metadata
- Download URL: cage_bro-0.1.0-py3-none-any.whl
- Upload date:
- Size: 3.5 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.11.14
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
5ceed90dfd0b704b771371e93dcd6b99f0d37e48f718e62d1606772b0fbd1f7f
|
|
| MD5 |
3f5b10fca26645279baf0b88da96aa04
|
|
| BLAKE2b-256 |
f48bf09d9e588b2ab7c899047d0cc47a2cc7957a2cd15b6b166186fa5c3f817d
|