Background execution

Every tool call so far has been blocking, meaning the agent loop waits for the result before continuing. But what about long-running commands like test suites or builds? The agent sits idle for minutes. The parallelism phase adds a BackgroundManager that runs commands in daemon threads and returns a task_id immediately.

Background execution flow

background_run returns immediately. Results arrive via notification queue.

Terminal
bash
# Run the background tasks agent
make 08-background-tasks

# Try: "Run 'sleep 3 && echo DONE' in the background"
# Then immediately ask another question while it runs.

See background execution in action. The agent returns immediately and notifies you when the background command finishes.

Quiz: Quiz

Loading practice…