Workspaces
Workspaces are isolated environments where agents execute tasks. Each workspace has its own file system, installed software, and configuration.
Types
Host Workspace
The default workspace. Runs directly on your server.
- Full access to the host file system
- Uses globally installed tools
- No isolation (agent can affect system state)
- Zero setup required
Good for: trusted tasks, system administration, quick experiments.
Container Workspace
Isolated Linux environment using systemd-nspawn.
- Separate file system (canβt see host files)
- Own installed packages
- Destroyed and recreated cleanly
- Template-based setup
Good for: untrusted code, experiments, reproducible environments.
Creating Workspaces
Via Dashboard
- Go to Workspaces in sidebar
- Click New Workspace
- Choose:
- Host: Direct execution on server
- Container: Isolated environment
- If container:
- Select a template or configure manually
- Choose distro (Ubuntu Noble, Jammy, Debian, Arch)
- Add skills and tools from your Library
- Click Create
For containers, click Build to create the environment (takes 1-3 minutes).
Via API
curl -X POST "https://agent.yourdomain.com/api/workspaces" \
-H "Authorization: Bearer $TOKEN" \
-H "Content-Type: application/json" \
-d '{
"name": "python-project",
"workspace_type": "container",
"distro": "ubuntu-noble",
"skills": ["python-dev"],
"init_script": "#!/bin/bash\napt install -y python3 python3-pip"
}'Container Lifecycle
pending β building β ready β (in use) β (destroyed)
β β
βββ rebuild βββββββββ| Status | Meaning |
|---|---|
pending | Created but not built |
building | debootstrap + init script running |
ready | Available for missions |
error | Build failed (check logs) |
Configuration
Skills and Tools
Workspaces can have skills and tools from your Library:
{
"skills": ["python-dev", "docker"],
"tools": ["custom-linter"]
}These are synced to .opencode/skill/ and .opencode/tool/ inside the workspace.
Environment Variables
Set environment variables available to all commands:
{
"env_vars": {
"NODE_ENV": "development",
"DATABASE_URL": "postgres://localhost/dev"
}
}Init Script
For containers, the init script runs during build:
#!/bin/bash
apt update
apt install -y nodejs npm python3 python3-pip
pip3 install poetry
npm install -g typescriptTemplates
Templates are reusable workspace configurations stored in your Library.
Create a template:
// library/workspace-template/fullstack.json
{
"name": "fullstack",
"description": "Node + Python development",
"distro": "ubuntu-noble",
"skills": ["typescript-dev", "python-dev"],
"env_vars": {
"NODE_ENV": "development"
},
"init_script": "#!/bin/bash\napt install -y nodejs npm python3 python3-pip"
}Use a template:
curl -X POST "https://agent.yourdomain.com/api/workspaces" \
-H "Authorization: Bearer $TOKEN" \
-d '{"name": "my-project", "template": "fullstack"}'Executing Commands
Run commands in a workspace:
curl -X POST "https://agent.yourdomain.com/api/workspaces/$ID/exec" \
-H "Authorization: Bearer $TOKEN" \
-d '{"command": "python3 --version"}'Response:
{
"exit_code": 0,
"stdout": "Python 3.12.0\n",
"stderr": "",
"timed_out": false
}Debugging Container Builds
If a container build fails:
-
Check status:
GET /api/workspaces/$ID # Look at error_message field -
View init log:
GET /api/workspaces/$ID/init-log # Returns stdout/stderr from init script -
Get debug info:
GET /api/workspaces/$ID/debug # Container state, directory structure, etc. -
Re-run init (without full rebuild):
POST /api/workspaces/$ID/rerun-init # Faster iteration on init script fixes
Distros
| Distro | ID | Notes |
|---|---|---|
| Ubuntu 24.04 | ubuntu-noble | Recommended |
| Ubuntu 22.04 | ubuntu-jammy | LTS |
| Debian 12 | debian-bookworm | Stable |
| Arch Linux | arch-linux | Rolling release |
Best Practices
- Use containers for untrusted code. Never run unknown code in host workspace.
- Create templates for repeated setups. Donβt rebuild the same environment.
- Keep init scripts idempotent. Should work on re-run.
- Version your templates. Theyβre in your Library git repo.
Next Steps
- API Reference: Full workspace API documentation
- Desktop Automation: Run browsers in workspaces