跳到主要内容
非官方简体中文翻译,内容版权归 Mastra 所有,遵循 Apache-2.0 许可。

TaskSignalProvider

Added in: @mastra/core@1.42.0

Bundles the built-in task tools (task_write, task_update, task_complete, task_check) and the TaskStateProcessor behind a single agent registration. Use it to add a structured, durable task list to an agent without wiring the tools and processor separately.

Extends SignalProvider. The task list is stored in the thread-scoped tasks storage domain (the source of truth) and projected onto the agent state-signal lane by the processor, so it survives observational-memory truncation without invalidating the prompt cache.

Usage example
Usage example的直接链接

Register the provider on an agent that has Memory and a Mastra storage:

src/mastra/index.ts
import { Agent } from '@mastra/core/agent'
import { TaskSignalProvider } from '@mastra/core/signals'

const agent = new Agent({
id: 'coder',
name: 'coder',
instructions: '...',
model,
memory,
signals: [new TaskSignalProvider()],
})

The Agent automatically merges the four task tools into its toolset and registers the processor on its input-processor chain. No other wiring is required.

Task tracking requires a memory-backed thread (threadId + resourceId). Without memory the task tools no-op and return a result explaining that task tracking requires agent memory. The tasks storage domain is wired in-memory by default, so task tracking works without configuring a storage backend.

Constructor parameters
Constructor parameters的直接链接

TaskSignalProvider takes no constructor arguments.

Properties
Properties的直接链接

id:

'task-signals'
Stable identifier for the provider instance.

Methods
Methods的直接链接

Agent integration
Agent integration的直接链接

The Agent calls these methods automatically when the provider is passed to signals, so you normally don't call them directly.

getTools()
gettools的直接链接

Returns the four task tools keyed by their tool ids (task_write, task_update, task_complete, task_check). The Agent merges these into its toolset.

const tools = new TaskSignalProvider().getTools()
// { task_write, task_update, task_complete, task_check }

Returns: Record<string, Tool>

getInputProcessors()
getinputprocessors的直接链接

Returns the provider's TaskStateProcessor instance. The Agent registers it on the input-processor chain, which propagates the Mastra instance so the processor can resolve the tasks store.

const [processor] = new TaskSignalProvider().getInputProcessors()
// processor instanceof TaskStateProcessor

Returns: InputProcessorOrWorkflow[]