What Workers Are
A worker is aCopilotSession created by the orchestrator via client.createSession(). Unlike the orchestrator session (which is persistent), workers are temporary — they are created for a task, run in the background, and destroyed when the task completes.
The orchestrator creates a worker when the user asks for something that involves:
- Writing or modifying code
- Running shell commands
- Reading or writing files
- Anything that needs to operate inside a specific project directory
Creating a Worker
Thecreate_worker_session tool accepts three parameters:
initial_prompt is provided, the task is dispatched in the background and the tool returns immediately with a confirmation message. The orchestrator does not wait.
Sending Follow-Up Prompts
To send additional instructions to an existing worker, usesend_to_worker:
create_worker_session with an initial prompt, this is non-blocking — it dispatches the prompt and returns "Task dispatched to worker 'auth-fix'. I'll notify you when it's done." immediately.
Non-Blocking Execution
All worker tasks run in the background. This is intentional: the orchestrator is single-threaded, and a long-running coding task (which can take minutes) must not block the message queue. The flow looks like this:Worker Limits
Concurrent limit
Max 5 workers can run at the same time. Attempting to create a 6th returns an error listing the active sessions.
Timeout
Each worker task has a configurable timeout. Default: 600 000 ms (10 minutes). Override with
WORKER_TIMEOUT in ~/.max/.env.If a worker times out, it reports:“Worker ‘name’ timed out after Xs (limit: Ys). Set WORKER_TIMEOUT=… to allow more time.”
Protected Directories
Workers are blocked from operating in sensitive directories. Any attempt to create a worker in these paths is refused:~/.ssh/../myproject is resolved and checked against the blocked list.
Worker Completion & Channel Routing
When a worker finishes, its result is fed back into the orchestrator as a system message:proactiveNotifyFn, which routes the summary to the channel that originally sent the request:
- If the message came from Telegram, a proactive notification is sent to that chat.
- If the message came from the TUI, it is broadcast to all SSE subscribers.
WorkerInfo object stores the originChannel at creation time so completions always reach the right place.
Session Management Tools
| Tool | Description |
|---|---|
list_sessions | List all active workers with name, directory, and status |
check_session_status | Get detailed status and last output for a specific worker |
kill_session | Terminate a worker and free its resources |
list_machine_sessions | List ALL Copilot CLI sessions on the machine (VS Code, terminal, etc.) |
attach_machine_session | Attach to an existing machine session as a managed worker |
Worker Data in SQLite
Each worker is persisted to theworker_sessions table for observability:
GET /sessions.