Official Python SDK for the Computer Agents Agentic Compute Platform API. Build with threads, computers, agents, resources, and databases.
Project description
Computer Agents Python SDK
The official Python SDK for the Computer Agents Cloud API. Build against the Agentic Compute Platform with threads, computers, resources, databases, skills, and agents.
Installation
pip install computer-agents
Quick Start
from computer_agents import ComputerAgentsClient
client = ComputerAgentsClient(api_key="ca_your_api_key")
# Execute a task
result = client.run(
"Create a REST API with Flask",
computer_id="env_xxx",
on_event=lambda e: print(e["type"]),
)
print(result.content)
print(f"Thread ID: {result.thread_id}")
Multi-Turn Conversations
# Create a thread for persistent conversation
thread = client.threads.create(environment_id="env_xxx")
# First message
result = client.threads.send_message(
thread["id"],
content="Create a Python web server",
on_event=lambda e: print(e),
)
# Follow-up (continues same session)
result2 = client.threads.send_message(
thread["id"],
content="Add authentication to the server",
)
Computers
# Create a custom computer
computer = client.computers.create(
name="data-science",
internet_access=True,
runtimes={"python": "3.12"},
)
# Install packages
client.computers.install_packages(computer["id"], "python", ["pandas", "numpy"])
# Add MCP servers
client.computers.update(
computer["id"],
mcp_servers=[{
"type": "stdio",
"name": "filesystem",
"command": "npx",
"args": ["@modelcontextprotocol/server-filesystem", "/workspace"],
}],
)
Computer Change History
history = client.computers.list_changes(
computer["id"],
limit=25,
project_id="proj_123",
operation=["created", "modified"],
)
latest = history["data"][0]
latest_file = latest["files"][0]
diff = client.computers.get_change_diff(
computer["id"],
latest["id"],
path=latest_file["path"],
)
file_state = client.computers.get_change_file(
computer["id"],
latest["id"],
path=latest_file["path"],
)
fork = client.computers.fork_from_change(
computer["id"],
latest["id"],
name="history-branch",
)
Agents
# Create a custom agent
agent = client.agents.create(
name="Code Reviewer",
model="claude-sonnet-4-5",
instructions="You are a thorough code reviewer.",
enabled_skills=["web_search"],
)
# Use the agent
thread = client.threads.create(
computer_id="env_xxx",
agent_id=agent["id"],
)
Files
# Upload a file
client.files.upload_file(
"env_xxx",
filename="app.py",
content='print("hello")',
path="src",
)
# Download a file
content = client.files.get_file("env_xxx", "src/app.py")
# List files
files = client.files.list_files("env_xxx")
Git Operations
diff = client.git.diff("env_xxx")
client.git.commit("env_xxx", message="Update feature")
client.git.push("env_xxx")
Schedules
schedule = client.schedules.create(
name="Daily Report",
agent_id="agent_xxx",
agent_name="Reporter",
task="Generate daily report",
schedule_type="recurring",
cron_expression="0 9 * * *",
)
Resources
resource = client.resources.create(
name="crm-web",
kind="web_app",
auth_mode="public",
)
client.resources.deploy(resource["id"])
analytics = client.resources.get_analytics(resource["id"])
Databases
database = client.databases.create(name="crm-data")
client.databases.create_collection(database["id"], name="leads")
client.databases.create_document(
database["id"],
"leads",
data={"company": "Acme", "stage": "new"},
)
Skills
skills = client.skills.list()
print([skill["name"] for skill in skills])
Configuration
The API key can be provided via:
- Constructor argument:
ComputerAgentsClient(api_key="ca_...") - Environment variable:
COMPUTER_AGENTS_API_KEY
# Custom base URL and timeout
client = ComputerAgentsClient(
api_key="ca_...",
base_url="https://custom-api.example.com",
timeout=120.0,
debug=True,
)
Context Manager
with ComputerAgentsClient(api_key="ca_...") as client:
result = client.run("Hello world", computer_id="env_xxx")
print(result.content)
# Client is automatically closed
API Resources
| Resource | Description |
|---|---|
client.threads |
Conversation management with SSE streaming |
client.environments / client.computers |
Computer configuration and lifecycle |
client.agents |
Agent configuration (model, instructions, skills) |
client.resources |
Web apps, functions, auth modules, and runtimes |
client.databases |
Managed database surfaces |
client.skills |
Custom ACP skills |
client.files |
File management in computer workspaces |
client.schedules |
Scheduled task management |
client.triggers |
Event-driven triggers |
client.orchestrations |
Agent-to-agent orchestration |
client.budget |
Budget and usage tracking |
client.billing |
Billing records and statistics |
client.git |
Git operations on computer workspaces |
Requirements
- Python >= 3.9
- httpx >= 0.25.0
Contributing
See CONTRIBUTING.md for development setup and guidelines.
License
MIT - see LICENSE for details.
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
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 computer_agents-2.6.1.tar.gz.
File metadata
- Download URL: computer_agents-2.6.1.tar.gz
- Upload date:
- Size: 33.9 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.11.6
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
490aea1bda6f3f0efcf4a80eda9d27c2905a7dcdfc5b18f61a28b1ca874951f3
|
|
| MD5 |
d554433048f720aaaa2f8e7b65548aae
|
|
| BLAKE2b-256 |
797c44331dc051043713c6190e251158ac9fd0bc6fda0a20b11283d6d1ed1aed
|
File details
Details for the file computer_agents-2.6.1-py3-none-any.whl.
File metadata
- Download URL: computer_agents-2.6.1-py3-none-any.whl
- Upload date:
- Size: 39.2 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.11.6
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
885367c99f2096b27423a96bd04e0e9b92ecfa62d0610676fbf07b9ddd2764cb
|
|
| MD5 |
d5c9bc40e9232810f6634db97e974635
|
|
| BLAKE2b-256 |
339f341eab0e71e78a73a4a93d55f512b88eb0bc461a4c220251ceaf45c72f89
|