Coder Workspaces
Manage Coder workspaces and AI coding agent tasks via the coder CLI.
Setup
Install the CLI from your Coder instance (ensures version match):
- See:
https://your-coder-instance.com/clior Coder CLI docs
- See:
Set environment variables:
export CODER_URL="https://your-coder-instance.com" export CODER_SESSION_TOKEN="your-token" # Get from /cli-authAuthenticate:
coder login --token "$CODER_SESSION_TOKEN" "$CODER_URL"Verify:
coder whoami
Workspace Commands
List Workspaces
coder list
coder list --all
coder list --search "status:running"
coder list -o json
Start, Stop, Restart, Delete
coder start <workspace>
coder stop <workspace>
coder restart <workspace> -y
coder delete <workspace> -y
SSH and Run Commands
coder ssh <workspace>
coder ssh <workspace> -- ls -la
coder ssh <workspace> -- "cd /app && npm test"
View Logs
coder logs <workspace>
coder logs <workspace> -f
AI Coding Tasks
Coder Tasks runs AI agents (Claude Code, Aider, etc.) in isolated workspaces.
Task Creation Workflow
Creating a task requires a template and usually a preset.
Step 1: List Available Templates
coder templates list
Step 2: Find Presets for a Template
Check available presets in your Coder web UI when creating a task, or ask your Coder admin.
Step 3: Create the Task
coder tasks create \
--template <template-name> \
--preset "<preset-name>" \
"Your prompt describing what the agent should do"
Task Commands
coder tasks list # List all tasks
coder tasks # Same as list
coder tasks logs <task-name> # View task output
coder tasks connect <task-name> # Interactive session
Task States
- Initializing: Workspace provisioning (timing varies by template)
- Working: Setup script running
- Active: Agent processing your prompt
- Idle: Agent waiting for input
Startup time depends on the template — simple templates may take ~10-15 seconds, complex ones with setup scripts take longer.
Troubleshooting
- CLI not installed: Install from your Coder instance or
brew install coder - Version mismatch: Reinstall CLI from your instance URL
- Auth failed: Run
coder login --token "$CODER_SESSION_TOKEN" "$CODER_URL"