Overview
Every task follows a lifecycle from creation through completion (or failure). The lifecycle is designed for accountability — you can see what the agent is working on, what is blocked, and what has been accomplished.Status Flow
Status Definitions
The Dashboard Play Flow
This is the primary task execution workflow:1
User Clicks Play
The user clicks the play button on a pending task in the dashboard. This triggers:
POST /api/tasks/:id/start— Updates status toin_progress- A chat message is sent to the gateway: “Work on task: [title]”
2
Agent Receives and Works
The agent receives the message and begins working. It can:
- Use any available tools (exec, browser, memory, etc.)
- Stream progress updates in the chat
- Create sub-tasks if needed
3
Agent Completes
When finished, the agent:
- Calls the
taskstool withaction: complete - Emits
[TASK_DONE:title]in the response stream
4
Dashboard Updates
The dashboard updates through two mechanisms:
- Instant: Parses
[TASK_DONE:title]from the stream for immediate UI update - Polling: Checks the database every 5 seconds as a backup
Heartbeat-Triggered Tasks
The heartbeat system can trigger task work autonomously:1
Heartbeat fires on schedule
2
Agent checks for pending tasks
3
Picks the highest-priority task
4
Works on it and updates status
Task Accountability
Tasks track:- Who created it: User, agent, heartbeat, or schedule
- When each status change happened: Full audit trail
- Time spent: Duration in each status
- Completion notes: What the agent did to complete the task
