Task tools
Four built-in, agent-agnostic tools that manage a structured task list for an agent run. The task list is persisted in the thread-scoped threadState storage domain and projected onto the agent state-signal lane so it survives observational-memory truncation.
Task tracking requires a memory-backed thread (threadId + resourceId). Without memory the tools return an error explaining that task tracking requires agent memory.
The recommended setup is TaskSignalProvider, which bundles all four tools and the TaskStateProcessor in a single registration. See Built-in tools for the conceptual guide.
Usage exampleDirect link to Usage example
import { Agent } from '@mastra/core/agent'
import { Memory } from '@mastra/memory'
import { TaskSignalProvider } from '@mastra/core/signals'
const agent = new Agent({
id: 'coder',
name: 'Coder',
instructions: 'Track your progress with the task tools.',
model,
memory: new Memory(),
signals: [new TaskSignalProvider()],
})
Or import the tools directly:
import { taskWriteTool, taskUpdateTool, taskCompleteTool, taskCheckTool } from '@mastra/core/tools'
const agent = new Agent({
id: 'coder',
name: 'Coder',
instructions: 'Track your progress with the task tools.',
model,
memory: new Memory(),
tools: { taskWriteTool, taskUpdateTool, taskCompleteTool, taskCheckTool },
})
task_writeDirect link to task_write
Create or replace the entire task list. Each call replaces the previous list.
Input schemaDirect link to Input schema
tasks:
id?:
content:
status:
activeForm:
OutputDirect link to Output
Returns a TaskToolResult with a human-readable content summary, the full tasks array with assigned IDs, and an isError flag.
BehaviorDirect link to Behavior
- IDs must be unique within a call. Duplicate explicit IDs get a generated fallback.
- When an ID is omitted while rewriting an existing list, one unambiguous matching task reuses its previous ID for stability.
- Only one task can have
in_progressstatus at a time. Submitting multiplein_progresstasks returns an error.
task_updateDirect link to task_update
Update one task by its stable ID. Include only the fields that changed.
Input schemaDirect link to Input schema
id:
content?:
status?:
activeForm?:
At least one of content, status, or activeForm is required.
BehaviorDirect link to Behavior
- When the update sets a task to
in_progress, any otherin_progresstask is automatically demoted topending. - Returns an error with available task IDs when the ID is not found.
task_completeDirect link to task_complete
Mark one task completed by its stable ID.
Input schemaDirect link to Input schema
id:
BehaviorDirect link to Behavior
Returns an error with available task IDs when the ID is not found.
task_checkDirect link to task_check
Check the completion status of the task list. Takes no input parameters.
OutputDirect link to Output
Returns a TaskCheckResult with: