@mastra/mcp-docs-server 1.2.17-alpha.13 → 1.2.17-alpha.16
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.docs/course/02-agent-tools-mcp/32-conclusion.md +1 -1
- package/.docs/docs/agents/code-mode.md +3 -3
- package/.docs/docs/agents/guardrails.md +1 -1
- package/.docs/docs/agents/{agent-approval.md → human-in-the-loop.md} +5 -5
- package/.docs/docs/agents/networks.md +3 -3
- package/.docs/docs/agents/overview.md +7 -7
- package/.docs/docs/agents/processors.md +2 -2
- package/.docs/docs/agents/{using-tools.md → tools.md} +7 -7
- package/.docs/docs/{server/auth → auth}/custom-auth-provider.md +1 -1
- package/.docs/docs/{server/auth → auth}/fga.md +27 -1
- package/.docs/docs/{server/auth.md → auth/overview.md} +4 -4
- package/.docs/docs/{server/auth → auth}/simple-auth.md +1 -1
- package/.docs/docs/{server/auth → auth}/workers.md +2 -2
- package/.docs/docs/{capabilities/channels.md → channels.md} +2 -2
- package/.docs/docs/{agents → connections}/a2a.md +2 -2
- package/.docs/docs/{agents → connections}/acp.md +1 -1
- package/.docs/docs/{mcp/overview.md → connections/mcp.md} +1 -1
- package/.docs/docs/connections/overview.md +5 -5
- package/.docs/docs/{agents → connections}/sdk-agents.md +1 -1
- package/.docs/docs/deployment/mastra-server.md +2 -2
- package/.docs/docs/deployment/overview.md +1 -1
- package/.docs/docs/deployment/sandbox.md +3 -3
- package/.docs/docs/deployment/workers.md +4 -4
- package/.docs/docs/guides/multi-agent-systems.md +7 -7
- package/.docs/docs/guides/streaming.md +1 -1
- package/.docs/docs/harness/agent-controller.md +5 -3
- package/.docs/docs/{long-running-agents → harness}/background-tasks.md +5 -5
- package/.docs/docs/{long-running-agents → harness}/durable-agents.md +2 -2
- package/.docs/docs/{long-running-agents → harness}/goals.md +6 -6
- package/.docs/docs/harness/overview.md +11 -10
- package/.docs/docs/{long-running-agents → harness}/schedules.md +5 -5
- package/.docs/docs/{long-running-agents → harness}/signal-providers.md +4 -4
- package/.docs/docs/mastra-platform/deploy.md +1 -1
- package/.docs/docs/mastra-platform/overview.md +1 -1
- package/.docs/docs/mastra-platform/server.md +1 -1
- package/.docs/docs/memory/message-history.md +1 -1
- package/.docs/docs/memory/overview.md +4 -4
- package/.docs/docs/memory/working-memory.md +1 -1
- package/.docs/docs/observability/integrations/exporters/mastra-storage.md +1 -1
- package/.docs/docs/{workspace → sandbox}/filesystem.md +2 -2
- package/.docs/docs/{workspace → sandbox}/lsp.md +3 -3
- package/.docs/docs/{workspace/sandbox.md → sandbox/overview.md} +3 -3
- package/.docs/docs/{workspace → sandbox}/search.md +2 -2
- package/.docs/docs/{workspace → sandbox}/skills.md +5 -5
- package/.docs/docs/server/custom-api-routes.md +2 -2
- package/.docs/docs/server/mastra-client.md +2 -2
- package/.docs/docs/server/{mastra-server.md → overview.md} +3 -3
- package/.docs/docs/server/pubsub.md +2 -2
- package/.docs/docs/server/server-adapters.md +4 -4
- package/.docs/docs/{agents/skills.md → skills.md} +4 -4
- package/.docs/docs/{storage/overview.md → storage.md} +1 -1
- package/.docs/docs/studio/auth.md +4 -4
- package/.docs/docs/studio/overview.md +2 -2
- package/.docs/docs/{capabilities/subagents.md → subagents.md} +35 -5
- package/.docs/docs/workflows/agents-and-tools.md +1 -1
- package/.docs/docs/workflows/overview.md +1 -1
- package/.docs/docs/workflows/scheduled-workflows.md +2 -2
- package/.docs/docs/workflows/snapshots.md +1 -1
- package/.docs/integrations/agentic-ui/ai-sdk-ui.md +1 -1
- package/.docs/integrations/agentic-ui/copilotkit.md +1 -1
- package/.docs/integrations/auth/google.md +2 -2
- package/.docs/integrations/auth/workos.md +1 -1
- package/.docs/integrations/browsers/agent-browser.md +2 -2
- package/.docs/integrations/browsers/browser-viewer.md +6 -6
- package/.docs/integrations/browsers/firecrawl.md +1 -1
- package/.docs/integrations/browsers/stagehand.md +2 -2
- package/.docs/integrations/channels/discord.md +2 -2
- package/.docs/integrations/channels/github.md +1 -1
- package/.docs/integrations/channels/imessage.md +4 -4
- package/.docs/integrations/channels/slack.md +5 -5
- package/.docs/integrations/channels/teams.md +2 -2
- package/.docs/integrations/channels/telegram.md +2 -2
- package/.docs/integrations/channels/whatsapp.md +2 -2
- package/.docs/integrations/databases/postgresql.md +1 -0
- package/.docs/integrations/deploy/amazon-ec2.md +2 -2
- package/.docs/integrations/deploy/aws-lambda.md +3 -3
- package/.docs/integrations/deploy/azure-app-services.md +2 -2
- package/.docs/integrations/deploy/cloudflare.md +2 -2
- package/.docs/integrations/deploy/digital-ocean.md +3 -3
- package/.docs/integrations/deploy/kubernetes.md +11 -11
- package/.docs/integrations/deploy/netlify.md +3 -3
- package/.docs/integrations/deploy/vercel.md +2 -2
- package/.docs/integrations/file-storage/amazon-s3.md +1 -1
- package/.docs/integrations/file-storage/azure-blob.md +1 -1
- package/.docs/integrations/file-storage/google-cloud-storage.md +1 -1
- package/.docs/integrations/file-storage/mesa.md +2 -2
- package/.docs/integrations/file-storage/vercel-files.md +1 -1
- package/.docs/integrations/frameworks/astro.md +1 -1
- package/.docs/integrations/frameworks/electron.md +1 -1
- package/.docs/integrations/frameworks/express.md +1 -1
- package/.docs/integrations/frameworks/hono.md +1 -1
- package/.docs/integrations/frameworks/nestjs.md +1 -1
- package/.docs/integrations/frameworks/next-js.md +1 -1
- package/.docs/integrations/frameworks/nuxt.md +1 -1
- package/.docs/integrations/frameworks/sveltekit.md +1 -1
- package/.docs/integrations/frameworks/vite-react.md +1 -1
- package/.docs/integrations/sandboxes/agentcore.md +1 -1
- package/.docs/integrations/sandboxes/apple-container.md +1 -1
- package/.docs/integrations/sandboxes/daytona.md +1 -1
- package/.docs/integrations/sandboxes/docker.md +4 -3
- package/.docs/integrations/sandboxes/e2b.md +1 -1
- package/.docs/integrations/sandboxes/modal.md +1 -1
- package/.docs/models/environment-variables.md +2 -0
- package/.docs/models/gateways/vercel.md +3 -1
- package/.docs/models/index.md +1 -1
- package/.docs/models/providers/arcee.md +79 -0
- package/.docs/models/providers/baseten.md +1 -1
- package/.docs/models/providers/cerebras.md +2 -3
- package/.docs/models/providers/cloudflare-workers-ai.md +1 -1
- package/.docs/models/providers/cortecs.md +2 -1
- package/.docs/models/providers/crof.md +1 -1
- package/.docs/models/providers/crossmodel.md +1 -1
- package/.docs/models/providers/deepinfra.md +2 -1
- package/.docs/models/providers/edenai.md +11 -5
- package/.docs/models/providers/huggingface.md +3 -1
- package/.docs/models/providers/hyper.md +5 -5
- package/.docs/models/providers/jalapeno.md +89 -0
- package/.docs/models/providers/kilo.md +8 -7
- package/.docs/models/providers/merge-gateway.md +3 -1
- package/.docs/models/providers/nano-gpt.md +3 -9
- package/.docs/models/providers/vivgrid.md +2 -1
- package/.docs/models/providers.md +2 -0
- package/.docs/reference/acp/acp-agent.md +2 -2
- package/.docs/reference/acp/create-acp-tool.md +1 -1
- package/.docs/reference/agent-controller/agent-controller-class.md +2 -2
- package/.docs/reference/agents/agent.md +2 -2
- package/.docs/reference/agents/channels.md +2 -2
- package/.docs/reference/agents/createSkill.md +2 -2
- package/.docs/reference/agents/durable-agent.md +1 -1
- package/.docs/reference/agents/generate.md +1 -1
- package/.docs/reference/agents/getSkill.md +1 -1
- package/.docs/reference/agents/listSkills.md +1 -1
- package/.docs/reference/agents/listSuspendedRuns.md +6 -6
- package/.docs/reference/agents/listTools.md +2 -2
- package/.docs/reference/agents/network.md +1 -1
- package/.docs/reference/ai-sdk/handle-network-stream.md +1 -1
- package/.docs/reference/ai-sdk/network-route.md +1 -1
- package/.docs/reference/auth/fga.md +7 -5
- package/.docs/reference/auth/jwt.md +1 -1
- package/.docs/reference/browser/agent-browser.md +2 -2
- package/.docs/reference/browser/browser-viewer.md +2 -2
- package/.docs/reference/browser/firecrawl-browser.md +1 -1
- package/.docs/reference/browser/mastra-browser.md +1 -1
- package/.docs/reference/browser/stagehand-browser.md +2 -2
- package/.docs/reference/build-with-ai.md +2 -2
- package/.docs/reference/channels/channel-provider.md +1 -1
- package/.docs/reference/channels/slack-provider.md +1 -1
- package/.docs/reference/cli/mastra.md +2 -0
- package/.docs/reference/client-js/agents.md +4 -4
- package/.docs/reference/coding-agent/create-coding-agent.md +142 -13
- package/.docs/reference/configuration.md +6 -6
- package/.docs/reference/core/getEditor.md +1 -1
- package/.docs/reference/core/getMCPServer.md +1 -1
- package/.docs/reference/core/getMCPServerById.md +1 -1
- package/.docs/reference/core/getTool.md +1 -1
- package/.docs/reference/core/getToolById.md +1 -1
- package/.docs/reference/core/listMCPServers.md +1 -1
- package/.docs/reference/core/listTools.md +1 -1
- package/.docs/reference/core/removeWorkspace.md +1 -1
- package/.docs/reference/editor/mastra-editor.md +2 -2
- package/.docs/reference/editor/prompt-blocks.md +2 -2
- package/.docs/reference/editor/tool-provider.md +1 -1
- package/.docs/reference/editor/tools.md +1 -1
- package/.docs/reference/editor/versioning.md +3 -3
- package/.docs/reference/evals/prompt-alignment.md +18 -0
- package/.docs/reference/evals/rubric.md +1 -1
- package/.docs/reference/file-based-agents/memory.md +2 -2
- package/.docs/reference/file-based-agents/server.md +3 -3
- package/.docs/reference/file-based-agents/skills.md +1 -1
- package/.docs/reference/file-based-agents/storage.md +3 -3
- package/.docs/reference/file-based-agents/subagents.md +1 -1
- package/.docs/reference/file-based-agents/workspace.md +3 -3
- package/.docs/reference/index.md +1 -0
- package/.docs/reference/manual-install.md +3 -3
- package/.docs/reference/memory/memory-class.md +1 -0
- package/.docs/reference/memory/settled.md +57 -0
- package/.docs/reference/migrations/network-to-supervisor.md +2 -2
- package/.docs/reference/processors/skill-search-processor.md +1 -1
- package/.docs/reference/processors/tool-call-filter.md +7 -7
- package/.docs/reference/processors/tool-search-processor.md +1 -1
- package/.docs/reference/project-structure.md +1 -1
- package/.docs/reference/pubsub/lease-provider.md +3 -3
- package/.docs/reference/pubsub/redis-streams.md +1 -1
- package/.docs/reference/rag/graph-rag.md +71 -8
- package/.docs/reference/schedules/overview.md +1 -1
- package/.docs/reference/streaming/ChunkType.md +2 -2
- package/.docs/reference/streaming/agents/stream.md +7 -4
- package/.docs/reference/streaming/agents/streamUntilIdle.md +1 -1
- package/.docs/reference/tools/ask-user-tool.md +1 -1
- package/.docs/reference/tools/create-code-mode.md +1 -1
- package/.docs/reference/tools/create-tool.md +4 -4
- package/.docs/reference/tools/mcp-server.md +47 -2
- package/.docs/reference/tools/submit-plan-tool.md +1 -1
- package/.docs/reference/tools/task-tools.md +2 -2
- package/.docs/reference/vectors/vectorize.md +12 -2
- package/.docs/reference/workers/overview.md +2 -2
- package/.docs/reference/workspace/local-filesystem.md +1 -1
- package/.docs/reference/workspace/local-sandbox.md +4 -3
- package/.docs/reference/workspace/process-manager.md +20 -4
- package/.docs/reference/workspace/sandbox.md +1 -1
- package/.docs/reference/workspace/workspace-class.md +5 -5
- package/CHANGELOG.md +15 -0
- package/package.json +4 -4
- /package/.docs/docs/{server/auth → auth}/composite-auth.md +0 -0
- /package/.docs/docs/{server/auth → auth}/jwt.md +0 -0
- /package/.docs/docs/{browser/overview.md → browser.md} +0 -0
- /package/.docs/docs/{getting-started/develop.md → develop.md} +0 -0
- /package/.docs/docs/{long-running-agents → harness}/signals.md +0 -0
- /package/.docs/docs/{editor/overview.md → studio/editor.md} +0 -0
|
@@ -4,9 +4,9 @@
|
|
|
4
4
|
|
|
5
5
|
> **Beta:** Breaking changes may occur without a major version bump until the API is stable.
|
|
6
6
|
|
|
7
|
-
A [workspace](https://mastra.ai/docs/
|
|
7
|
+
A [workspace](https://mastra.ai/docs/sandbox/overview) assembles capabilities such as filesystem access and command execution. The configured backends determine which tools are available. File-based agents get a default workspace automatically when discovered through `mastra dev` or `mastra build`. This default includes filesystem access and command execution, so agents can read and write files and run shell commands without extra configuration.
|
|
8
8
|
|
|
9
|
-
Use this page for the file-based convention. For workspace providers, tools, search, lifecycle, and sandbox details, see [Sandbox](https://mastra.ai/docs/
|
|
9
|
+
Use this page for the file-based convention. For workspace providers, tools, search, lifecycle, and sandbox details, see [Sandbox](https://mastra.ai/docs/sandbox/overview).
|
|
10
10
|
|
|
11
11
|
## Default workspace
|
|
12
12
|
|
|
@@ -65,7 +65,7 @@ Customize the workspace when the default local directory isn't enough. Common re
|
|
|
65
65
|
- Add workspace search with BM25 or vector search.
|
|
66
66
|
- Share one workspace across multiple agents.
|
|
67
67
|
|
|
68
|
-
For provider patterns and runtime behavior, see the [sandbox guide](https://mastra.ai/docs/
|
|
68
|
+
For provider patterns and runtime behavior, see the [sandbox guide](https://mastra.ai/docs/sandbox/overview) and [workspace search](https://mastra.ai/docs/sandbox/search).
|
|
69
69
|
|
|
70
70
|
## Runtime boundary
|
|
71
71
|
|
package/.docs/reference/index.md
CHANGED
|
@@ -211,6 +211,7 @@ The Reference section provides documentation of Mastra's API, including paramete
|
|
|
211
211
|
- [.getThreadById()](https://mastra.ai/reference/memory/getThreadById)
|
|
212
212
|
- [.listThreads()](https://mastra.ai/reference/memory/listThreads)
|
|
213
213
|
- [.recall()](https://mastra.ai/reference/memory/recall)
|
|
214
|
+
- [.settled()](https://mastra.ai/reference/memory/settled)
|
|
214
215
|
- [.summarizeThread()](https://mastra.ai/reference/memory/summarizeThread)
|
|
215
216
|
- [AgentNetwork to .network()](https://mastra.ai/reference/migrations/agentnetwork)
|
|
216
217
|
- [AI SDK v4 to v5](https://mastra.ai/reference/migrations/ai-sdk-v4-to-v5)
|
|
@@ -157,7 +157,7 @@ If you prefer not to use our automatic CLI tool, you can set up your project you
|
|
|
157
157
|
})
|
|
158
158
|
```
|
|
159
159
|
|
|
160
|
-
> **Note:** We've shortened and simplified the `weatherTool` example here. You can see the complete weather tool under [Giving an Agent a Tool](https://mastra.ai/docs/agents/
|
|
160
|
+
> **Note:** We've shortened and simplified the `weatherTool` example here. You can see the complete weather tool under [Giving an Agent a Tool](https://mastra.ai/docs/agents/tools).
|
|
161
161
|
|
|
162
162
|
5. Create a `weather-agent.ts` file:
|
|
163
163
|
|
|
@@ -244,7 +244,7 @@ If you prefer not to use our automatic CLI tool, you can set up your project you
|
|
|
244
244
|
|
|
245
245
|
- [Review the project structure](https://mastra.ai/reference/project-structure): Understand how `src/mastra/` files map to agents, tools, workflows, storage, and configuration.
|
|
246
246
|
- [Test your agent in Studio](https://mastra.ai/docs/studio/overview): Open the local Studio UI and run the weather agent.
|
|
247
|
-
- [Use tools with agents](https://mastra.ai/docs/agents/
|
|
247
|
+
- [Use tools with agents](https://mastra.ai/docs/agents/tools): Replace the example weather tool with a real tool that calls an API or service.
|
|
248
248
|
- [Add memory](https://mastra.ai/docs/memory/overview): Persist conversation history and user-specific context.
|
|
249
|
-
- [Configure storage](https://mastra.ai/docs/storage
|
|
249
|
+
- [Configure storage](https://mastra.ai/docs/storage): Add a persistent storage adapter for memory, workflows, observability, and other runtime state.
|
|
250
250
|
- [Build and deploy](https://mastra.ai/docs/deployment/overview): Build the Mastra server and deploy it to a hosting platform.
|
|
@@ -145,4 +145,5 @@ export const agent = new Agent({
|
|
|
145
145
|
- [listThreads](https://mastra.ai/reference/memory/listThreads)
|
|
146
146
|
- [deleteMessages](https://mastra.ai/reference/memory/deleteMessages)
|
|
147
147
|
- [cloneThread](https://mastra.ai/reference/memory/cloneThread)
|
|
148
|
+
- [settled](https://mastra.ai/reference/memory/settled)
|
|
148
149
|
- [Clone Utility Methods](https://mastra.ai/reference/memory/clone-utilities)
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
> Discover all available pages from the documentation index: https://mastra.ai/llms.txt
|
|
2
|
+
|
|
3
|
+
# Memory.settled()
|
|
4
|
+
|
|
5
|
+
The `.settled()` method resolves once all background work the `Memory` instance started has finished. Some memory work continues after an agent run returns:
|
|
6
|
+
|
|
7
|
+
- Observational memory cycles (buffered observation and reflection, including the nested agent runs they spawn)
|
|
8
|
+
- Vector cleanup started by `deleteThread()` and `deleteMessages()`
|
|
9
|
+
|
|
10
|
+
Await this method before closing a storage connection you own. Without it, background statements can run against a closed connection.
|
|
11
|
+
|
|
12
|
+
The method is declared on the base memory class, so it's also available on the `MastraMemory` instance returned by `agent.getMemory()`.
|
|
13
|
+
|
|
14
|
+
## Usage example
|
|
15
|
+
|
|
16
|
+
```typescript
|
|
17
|
+
await agent.generate('Hello', {
|
|
18
|
+
memory: { thread: 'thread-123', resource: 'user-456' },
|
|
19
|
+
})
|
|
20
|
+
|
|
21
|
+
await memory.settled()
|
|
22
|
+
await store.close()
|
|
23
|
+
```
|
|
24
|
+
|
|
25
|
+
## Parameters
|
|
26
|
+
|
|
27
|
+
This method takes no parameters.
|
|
28
|
+
|
|
29
|
+
## Returns
|
|
30
|
+
|
|
31
|
+
**void** (`Promise<void>`): A promise that resolves when all background memory work has finished. Background work that fails does not reject this promise.
|
|
32
|
+
|
|
33
|
+
## Extended usage example
|
|
34
|
+
|
|
35
|
+
Test suites and short-lived processes are the most common places to need this, since they close the store immediately after a run finishes.
|
|
36
|
+
|
|
37
|
+
```typescript
|
|
38
|
+
import { Memory } from '@mastra/memory'
|
|
39
|
+
import { PostgresStore } from '@mastra/pg'
|
|
40
|
+
|
|
41
|
+
const store = new PostgresStore({ connectionString })
|
|
42
|
+
const memory = new Memory({ storage: store })
|
|
43
|
+
|
|
44
|
+
// ... run your agent ...
|
|
45
|
+
|
|
46
|
+
// Wait for observational memory and vector cleanup to finish before closing.
|
|
47
|
+
await memory.settled()
|
|
48
|
+
await store.close()
|
|
49
|
+
```
|
|
50
|
+
|
|
51
|
+
> **Note:** `settled()` joins the work that had started by the time you called it, plus any work that work enqueues. It does not prevent new work from starting afterwards, so call it once the agent runs you care about have returned.
|
|
52
|
+
|
|
53
|
+
## Related
|
|
54
|
+
|
|
55
|
+
- [Memory Class Reference](https://mastra.ai/reference/memory/memory-class)
|
|
56
|
+
- [Observational Memory](https://mastra.ai/docs/memory/observational-memory)
|
|
57
|
+
- [deleteMessages](https://mastra.ai/reference/memory/deleteMessages)
|
|
@@ -255,9 +255,9 @@ const stream = await supervisorAgent.stream('Research AI in education', {
|
|
|
255
255
|
|
|
256
256
|
## See also
|
|
257
257
|
|
|
258
|
-
- [Supervisor Agents](https://mastra.ai/docs/
|
|
258
|
+
- [Supervisor Agents](https://mastra.ai/docs/subagents)
|
|
259
259
|
- [Agent Networks](https://mastra.ai/docs/agents/networks)
|
|
260
260
|
- [Agent.stream() Reference](https://mastra.ai/reference/streaming/agents/stream)
|
|
261
261
|
- [Agent.generate() Reference](https://mastra.ai/reference/agents/generate)
|
|
262
|
-
- [Agent Approval](https://mastra.ai/docs/agents/
|
|
262
|
+
- [Agent Approval](https://mastra.ai/docs/agents/human-in-the-loop)
|
|
263
263
|
- [Guide: Research Coordinator](https://mastra.ai/blog/build-a-research-coordinator-with-supervisor-agents)
|
|
@@ -112,4 +112,4 @@ Reserve workspace file tools such as `mastra_workspace_read_file` for explicit f
|
|
|
112
112
|
|
|
113
113
|
- [ToolSearchProcessor](https://mastra.ai/reference/processors/tool-search-processor)
|
|
114
114
|
- [Processors](https://mastra.ai/docs/agents/processors)
|
|
115
|
-
- [Workspace Skills](https://mastra.ai/docs/
|
|
115
|
+
- [Workspace Skills](https://mastra.ai/docs/sandbox/skills)
|
|
@@ -2,7 +2,9 @@
|
|
|
2
2
|
|
|
3
3
|
# ToolCallFilter
|
|
4
4
|
|
|
5
|
-
The `ToolCallFilter` is an **input processor** that filters out tool calls and their results from the
|
|
5
|
+
The `ToolCallFilter` is an **input processor** that filters out tool calls and their results from the prompt sent to the model. This is useful when you want to exclude specific tool interactions from context or remove all tool calls entirely.
|
|
6
|
+
|
|
7
|
+
Filtering happens in the `processLLMRequest` hook, which runs after the message list is converted to a model prompt. Changes are transient: they affect only what's sent to the model on that call. Stored messages, memory, and UI history keep their original tool calls and results.
|
|
6
8
|
|
|
7
9
|
## Usage example
|
|
8
10
|
|
|
@@ -44,13 +46,11 @@ const filterWithCompactToolHistory = new ToolCallFilter({
|
|
|
44
46
|
|
|
45
47
|
**name** (`string`): Processor display name set to 'ToolCallFilter'
|
|
46
48
|
|
|
47
|
-
**
|
|
48
|
-
|
|
49
|
-
**processInputStep** (`(args: ProcessInputStepArgs) => Promise<ProcessInputStepResult>`): Processes agent loop step input when filterAfterToolSteps is configured. Returns no changes when step filtering is disabled
|
|
49
|
+
**processLLMRequest** (`(args: ProcessLLMRequestArgs) => Promise<ProcessLLMRequestResult | undefined>`): Filters tool calls and results out of the model prompt before it is sent to the provider. Returns undefined when nothing is filtered. Changes are transient and are not persisted to the message list or memory
|
|
50
50
|
|
|
51
51
|
## Step filtering
|
|
52
52
|
|
|
53
|
-
By default, `ToolCallFilter` filters
|
|
53
|
+
By default, `ToolCallFilter` filters tool calls from history but leaves tool calls made during the current agent loop in place. Set `filterAfterToolSteps` to also filter tool calls produced by the current loop.
|
|
54
54
|
|
|
55
55
|
`filterAfterToolSteps` counts tool-producing steps. For example, `filterAfterToolSteps: 2` keeps tool calls and results from the two most recent tool-producing steps and filters older tool calls and results. Non-tool text remains in context.
|
|
56
56
|
|
|
@@ -64,9 +64,9 @@ const filter = new ToolCallFilter({
|
|
|
64
64
|
|
|
65
65
|
## Preserve compact model output
|
|
66
66
|
|
|
67
|
-
Set `preserveModelOutput: true` to retain compact `toModelOutput` history for
|
|
67
|
+
Set `preserveModelOutput: true` to retain compact `toModelOutput` history for tool results that the filter removes. The removed tool call and result are replaced with a single text part in the prompt, so the model still sees the output while the raw tool arguments are dropped.
|
|
68
68
|
|
|
69
|
-
|
|
69
|
+
Tool results without model output that can be represented as text are removed entirely.
|
|
70
70
|
|
|
71
71
|
```typescript
|
|
72
72
|
const filter = new ToolCallFilter({
|
|
@@ -44,7 +44,7 @@ Mastra recommends organizing your code into the following folders:
|
|
|
44
44
|
|
|
45
45
|
Mastra has two special folder conventions:
|
|
46
46
|
|
|
47
|
-
- `src/mastra/agents/<name>`: You can define an agent by file convention instead of constructing it in code. Learn more in the [File-based Agents](https://mastra.ai/docs/
|
|
47
|
+
- `src/mastra/agents/<name>`: You can define an agent by file convention instead of constructing it in code. Learn more in the [File-based Agents](https://mastra.ai/docs/develop) docs.
|
|
48
48
|
- `src/mastra/public`: Contents are copied into the `.build/output` directory during the build process, making them available for serving at runtime.
|
|
49
49
|
|
|
50
50
|
### Top-level files
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
# LeaseProvider
|
|
4
4
|
|
|
5
|
-
`LeaseProvider` is the distributed leasing contract, separate from event delivery ([`PubSub`](https://mastra.ai/reference/pubsub/base)). Mastra's [signals layer](https://mastra.ai/docs/
|
|
5
|
+
`LeaseProvider` is the distributed leasing contract, separate from event delivery ([`PubSub`](https://mastra.ai/reference/pubsub/base)). Mastra's [signals layer](https://mastra.ai/docs/harness/signals) uses it to elect a single owner across multiple processes (for example, serverless invocations) for a resource, most commonly a thread key. The owner is the process that wakes and runs the agent stream, so other processes route follow-up work to it instead of starting a competing run.
|
|
6
6
|
|
|
7
7
|
Leasing is a distinct concern from pub/sub. A backend implements `LeaseProvider` only when it can actually coordinate a lock, such as Redis via atomic `SET`/Lua, or an in-memory map for single-process. Backends that can't lease omit it; the signals runtime feature-detects the capability and falls back to a no-op provider, preserving single-process behavior.
|
|
8
8
|
|
|
@@ -129,5 +129,5 @@ When the configured pub/sub backend doesn't implement `LeaseProvider`, the runti
|
|
|
129
129
|
|
|
130
130
|
- [PubSub](https://mastra.ai/reference/pubsub/base): The event delivery contract, separate from leasing
|
|
131
131
|
- [RedisStreamsPubSub](https://mastra.ai/reference/pubsub/redis-streams): The built-in backend that implements `LeaseProvider`
|
|
132
|
-
- [Signals](https://mastra.ai/docs/
|
|
133
|
-
- [Channels](https://mastra.ai/docs/
|
|
132
|
+
- [Signals](https://mastra.ai/docs/harness/signals): The runtime that uses leasing to coordinate thread execution across processes
|
|
133
|
+
- [Channels](https://mastra.ai/docs/channels): Uses leasing to coordinate agent runs in serverless and multi-instance deployments
|
|
@@ -131,7 +131,7 @@ When a subscriber calls `nack`, the event is republished with an incremented `de
|
|
|
131
131
|
|
|
132
132
|
## Distributed leasing
|
|
133
133
|
|
|
134
|
-
`RedisStreamsPubSub` implements the [`LeaseProvider`](https://mastra.ai/reference/pubsub/lease-provider) contract on top of the same Redis connection. The [signals runtime](https://mastra.ai/docs/
|
|
134
|
+
`RedisStreamsPubSub` implements the [`LeaseProvider`](https://mastra.ai/reference/pubsub/lease-provider) contract on top of the same Redis connection. The [signals runtime](https://mastra.ai/docs/harness/signals) uses it to elect a single owner (usually per thread key) so that across instances only one process wakes and runs the agent, and others route follow-up work to the holder. This is what makes signals work on serverless and multi-instance deployments; without a shared lease, each instance would start its own competing run.
|
|
135
135
|
|
|
136
136
|
Lease keys are namespaced under the same `keyPrefix` as topics, as `<keyPrefix>:lease:<key>`. All operations are atomic: `acquireLease` uses `SET NX PX` and refreshes its own TTL idempotently, while `releaseLease`, `renewLease`, and `transferLease` use Lua scripts that check ownership before mutating, so a concurrent renewal from another owner is never clobbered.
|
|
137
137
|
|
|
@@ -9,10 +9,7 @@ The `GraphRAG` class implements a graph-based approach to retrieval augmented ge
|
|
|
9
9
|
```typescript
|
|
10
10
|
import { GraphRAG } from '@mastra/rag'
|
|
11
11
|
|
|
12
|
-
const graphRag = new GraphRAG(
|
|
13
|
-
dimension: 1536,
|
|
14
|
-
threshold: 0.7,
|
|
15
|
-
})
|
|
12
|
+
const graphRag = new GraphRAG(1536, 0.7)
|
|
16
13
|
|
|
17
14
|
// Create the graph from chunks and embeddings
|
|
18
15
|
graphRag.createGraph(documentChunks, embeddings)
|
|
@@ -88,13 +85,79 @@ Returns an array of `RankedNode` objects, where each node contains:
|
|
|
88
85
|
|
|
89
86
|
**score** (`number`): Combined relevance score from graph traversal
|
|
90
87
|
|
|
88
|
+
### `serialize`
|
|
89
|
+
|
|
90
|
+
Returns a JSON-safe snapshot of the graph so it can be persisted and restored later instead of rebuilt with `createGraph`.
|
|
91
|
+
|
|
92
|
+
```typescript
|
|
93
|
+
serialize(): GraphRAGSnapshot
|
|
94
|
+
```
|
|
95
|
+
|
|
96
|
+
#### Returns
|
|
97
|
+
|
|
98
|
+
Returns a `GraphRAGSnapshot` object containing:
|
|
99
|
+
|
|
100
|
+
**version** (`number`): Snapshot format version, used to reject snapshots this version of the class can't load
|
|
101
|
+
|
|
102
|
+
**dimension** (`number`): Dimension of the embedding vectors the graph was built with
|
|
103
|
+
|
|
104
|
+
**threshold** (`number`): Similarity threshold the graph was built with
|
|
105
|
+
|
|
106
|
+
**nodes** (`GraphNode[]`): All nodes in the graph, each including its full embedding
|
|
107
|
+
|
|
108
|
+
**edges** (`GraphEdge[]`): All edges in the graph
|
|
109
|
+
|
|
110
|
+
The snapshot is a deep copy, so mutating it doesn't affect the graph it came from. Every node carries its full embedding, so snapshots are large: a 1,000-node graph built with 1536-dimension embeddings serializes to about 20 MB of JSON. Size your storage column accordingly.
|
|
111
|
+
|
|
112
|
+
### `deserialize`
|
|
113
|
+
|
|
114
|
+
Rebuilds a `GraphRAG` instance from a snapshot produced by `serialize`.
|
|
115
|
+
|
|
116
|
+
```typescript
|
|
117
|
+
static deserialize(snapshot: GraphRAGSnapshot): GraphRAG
|
|
118
|
+
```
|
|
119
|
+
|
|
120
|
+
#### Parameters
|
|
121
|
+
|
|
122
|
+
**snapshot** (`GraphRAGSnapshot`): A snapshot previously returned by serialize
|
|
123
|
+
|
|
124
|
+
Throws if the snapshot version is unsupported, if a node embedding doesn't match the snapshot dimension, or if an edge references a node that isn't in the snapshot. A bad snapshot therefore fails at load time instead of during a later query.
|
|
125
|
+
|
|
126
|
+
## Persisting a graph
|
|
127
|
+
|
|
128
|
+
Building a graph is O(n²) in the number of chunks, so rebuilding it on every process start is wasteful. Serialize the graph once and store the snapshot wherever you already keep state. A snapshot is plain JSON, so any store works (a file, a blob column, a key-value cache), and `GraphRAG` doesn't depend on a storage backend.
|
|
129
|
+
|
|
130
|
+
```typescript
|
|
131
|
+
import { readFile, writeFile } from 'node:fs/promises'
|
|
132
|
+
import { GraphRAG } from '@mastra/rag'
|
|
133
|
+
import type { GraphRAGSnapshot } from '@mastra/rag'
|
|
134
|
+
|
|
135
|
+
const SNAPSHOT_PATH = './docs-graph.json'
|
|
136
|
+
|
|
137
|
+
async function loadOrBuildGraph() {
|
|
138
|
+
try {
|
|
139
|
+
const snapshot = JSON.parse(await readFile(SNAPSHOT_PATH, 'utf8')) as GraphRAGSnapshot
|
|
140
|
+
return GraphRAG.deserialize(snapshot)
|
|
141
|
+
} catch {
|
|
142
|
+
// No usable snapshot yet, so build the graph from scratch
|
|
143
|
+
}
|
|
144
|
+
|
|
145
|
+
const graphRag = new GraphRAG(1536, 0.7)
|
|
146
|
+
graphRag.createGraph(documentChunks, embeddings)
|
|
147
|
+
|
|
148
|
+
await writeFile(SNAPSHOT_PATH, JSON.stringify(graphRag.serialize()))
|
|
149
|
+
|
|
150
|
+
return graphRag
|
|
151
|
+
}
|
|
152
|
+
```
|
|
153
|
+
|
|
154
|
+
A snapshot reflects the chunks it was built from and isn't updated incrementally. When the underlying documents change, build the graph again and store a new snapshot.
|
|
155
|
+
|
|
91
156
|
## Advanced example
|
|
92
157
|
|
|
93
158
|
```typescript
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
threshold: 0.8, // Stricter similarity threshold
|
|
97
|
-
})
|
|
159
|
+
// Stricter similarity threshold
|
|
160
|
+
const graphRag = new GraphRAG(1536, 0.8)
|
|
98
161
|
|
|
99
162
|
// Create graph from chunks and embeddings
|
|
100
163
|
graphRag.createGraph(documentChunks, embeddings)
|
|
@@ -8,7 +8,7 @@
|
|
|
8
8
|
|
|
9
9
|
`mastra.schedules` is the CRUD service for persisted cron schedules. Use it to create, list, update, pause, resume, manually run, and delete schedules for agents or workflows.
|
|
10
10
|
|
|
11
|
-
For usage patterns and concepts, see [Schedules](https://mastra.ai/docs/
|
|
11
|
+
For usage patterns and concepts, see [Schedules](https://mastra.ai/docs/harness/schedules).
|
|
12
12
|
|
|
13
13
|
## Usage example
|
|
14
14
|
|
|
@@ -402,7 +402,7 @@ Contains output from workflow step execution, used primarily for usage tracking
|
|
|
402
402
|
|
|
403
403
|
## Background task chunks
|
|
404
404
|
|
|
405
|
-
Emitted when a tool call is dispatched as a [background task](https://mastra.ai/docs/
|
|
405
|
+
Emitted when a tool call is dispatched as a [background task](https://mastra.ai/docs/harness/background-tasks) and `streamUntilIdle()` is used.
|
|
406
406
|
|
|
407
407
|
### background-task-started
|
|
408
408
|
|
|
@@ -614,7 +614,7 @@ Contains monitoring and observability data from agent execution. Can include wor
|
|
|
614
614
|
|
|
615
615
|
### goal
|
|
616
616
|
|
|
617
|
-
Emitted on every evaluation of an agent [goal](https://mastra.ai/docs/
|
|
617
|
+
Emitted on every evaluation of an agent [goal](https://mastra.ai/docs/harness/goals). Consumers use this to render judge progress and the result mid-run. A goal that has no judge model configured produces no `goal` chunk.
|
|
618
618
|
|
|
619
619
|
**type** (`"goal"`): Chunk type identifier
|
|
620
620
|
|
|
@@ -80,7 +80,7 @@ const stream = await agent.stream('message for agent')
|
|
|
80
80
|
|
|
81
81
|
**options.onError** (`({ error }: { error: Error | string }) => Promise<void> | void`): Callback function called when an error occurs during streaming.
|
|
82
82
|
|
|
83
|
-
**options.onAbort** (`(event: any) => Promise<void> | void`): Callback function called when the stream is aborted.
|
|
83
|
+
**options.onAbort** (`(event: { steps: any[]; text?: string }) => Promise<void> | void`): Callback function called when the stream is aborted. steps contains the steps that completed before the abort, and text contains the assistant text streamed so far for the step that was in flight.
|
|
84
84
|
|
|
85
85
|
**options.abortSignal** (`AbortSignal`): Signal object that allows you to abort the agent's execution. When the signal is aborted, all ongoing operations will be terminated, including any in-flight subagent runs the agent delegated to.
|
|
86
86
|
|
|
@@ -178,6 +178,8 @@ const stream = await agent.stream('message for agent')
|
|
|
178
178
|
|
|
179
179
|
**options.savePerStep** (`boolean`): Save messages incrementally after each stream step completes (default: false).
|
|
180
180
|
|
|
181
|
+
**options.persistPartialOnAbort** (`boolean`): Save the assistant text that was streamed before an abort to memory (default: false). Only text emitted before the abort is persisted; output a provider keeps producing after cancellation is discarded, and nothing is saved when no text was streamed.
|
|
182
|
+
|
|
181
183
|
**options.requireToolApproval** (`boolean`): When true, all tool calls require explicit approval before execution. The stream will emit tool-call-approval chunks and pause until approveToolCall() or declineToolCall() is called.
|
|
182
184
|
|
|
183
185
|
**options.autoResumeSuspendedTools** (`boolean`): When true, automatically resumes suspended tools when the user sends a new message on the same thread. The agent extracts resumeData from the user's message based on the tool's resumeSchema. Requires memory to be configured.
|
|
@@ -301,8 +303,9 @@ const stream = await agent.stream('Tell me a story', {
|
|
|
301
303
|
onError: ({ error }) => {
|
|
302
304
|
console.error('Streaming error:', error)
|
|
303
305
|
},
|
|
304
|
-
onAbort:
|
|
305
|
-
console.log('Stream aborted
|
|
306
|
+
onAbort: ({ steps, text }) => {
|
|
307
|
+
console.log('Stream aborted after', steps.length, 'steps')
|
|
308
|
+
console.log('Partial text:', text)
|
|
306
309
|
},
|
|
307
310
|
})
|
|
308
311
|
|
|
@@ -399,4 +402,4 @@ Responses WebSocket connections run one response at a time. Mastra rejects overl
|
|
|
399
402
|
|
|
400
403
|
- [Generating responses](https://mastra.ai/docs/agents/overview)
|
|
401
404
|
- [Streaming responses](https://mastra.ai/docs/agents/overview)
|
|
402
|
-
- [Agent Approval](https://mastra.ai/docs/agents/
|
|
405
|
+
- [Agent Approval](https://mastra.ai/docs/agents/human-in-the-loop)
|
|
@@ -101,7 +101,7 @@ for await (const chunk of stream.fullStream) {
|
|
|
101
101
|
|
|
102
102
|
## Related
|
|
103
103
|
|
|
104
|
-
- [Background tasks](https://mastra.ai/docs/
|
|
104
|
+
- [Background tasks](https://mastra.ai/docs/harness/background-tasks)
|
|
105
105
|
- [`Agent.stream()` reference](https://mastra.ai/reference/streaming/agents/stream)
|
|
106
106
|
- [backgroundTasks configuration reference](https://mastra.ai/reference/configuration)
|
|
107
107
|
- [Stream chunk types](https://mastra.ai/reference/streaming/ChunkType)
|
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
|
|
5
5
|
A built-in, agent-agnostic tool that asks the user a question and waits for their response. The tool supports free-text questions, single-select prompts, and multi-select prompts.
|
|
6
6
|
|
|
7
|
-
The tool pauses through the native [tool suspension](https://mastra.ai/docs/agents/
|
|
7
|
+
The tool pauses through the native [tool suspension](https://mastra.ai/docs/agents/human-in-the-loop) primitive: it calls `suspend()` with the question payload, which makes the agent emit a `tool-call-suspended` event and persist run state. Resume the run with `agent.resumeStream(answer, { runId })`.
|
|
8
8
|
|
|
9
9
|
When executed outside an agent run (no `suspend` available), the tool returns a readable fallback string containing the question and choices.
|
|
10
10
|
|
|
@@ -126,4 +126,4 @@ export const codeModeTool = createCodeModeTool({
|
|
|
126
126
|
|
|
127
127
|
- [Code mode](https://mastra.ai/docs/agents/code-mode)
|
|
128
128
|
- [createTool()](https://mastra.ai/reference/tools/create-tool)
|
|
129
|
-
- [Sandbox](https://mastra.ai/docs/
|
|
129
|
+
- [Sandbox](https://mastra.ai/docs/sandbox/overview)
|
|
@@ -519,8 +519,8 @@ These annotations follow the [MCP specification](https://spec.modelcontextprotoc
|
|
|
519
519
|
|
|
520
520
|
## Related
|
|
521
521
|
|
|
522
|
-
- [MCP Overview](https://mastra.ai/docs/mcp
|
|
523
|
-
- [Using Tools with Agents](https://mastra.ai/docs/agents/
|
|
524
|
-
- [Agent Approval](https://mastra.ai/docs/agents/
|
|
525
|
-
- [Tool Streaming](https://mastra.ai/docs/agents/
|
|
522
|
+
- [MCP Overview](https://mastra.ai/docs/connections/mcp)
|
|
523
|
+
- [Using Tools with Agents](https://mastra.ai/docs/agents/tools)
|
|
524
|
+
- [Agent Approval](https://mastra.ai/docs/agents/human-in-the-loop)
|
|
525
|
+
- [Tool Streaming](https://mastra.ai/docs/agents/tools)
|
|
526
526
|
- [Request Context](https://mastra.ai/docs/server/request-context)
|
|
@@ -168,6 +168,51 @@ const fetchUserData = createTool({
|
|
|
168
168
|
})
|
|
169
169
|
```
|
|
170
170
|
|
|
171
|
+
#### Where `authInfo` comes from
|
|
172
|
+
|
|
173
|
+
When an MCP server is served by a Mastra server, `extra.authInfo` is populated from the principal resolved by `server.auth`. Nothing extra is required:
|
|
174
|
+
|
|
175
|
+
```typescript
|
|
176
|
+
export const mastra = new Mastra({
|
|
177
|
+
mcpServers: { myServer },
|
|
178
|
+
server: {
|
|
179
|
+
auth: new MastraJwtAuth({ secret: process.env.JWT_SECRET! }),
|
|
180
|
+
},
|
|
181
|
+
})
|
|
182
|
+
```
|
|
183
|
+
|
|
184
|
+
The authenticated user is mapped to `authInfo` as:
|
|
185
|
+
|
|
186
|
+
| `authInfo` field | Value |
|
|
187
|
+
| ---------------- | -------------------------------------------------------------------------- |
|
|
188
|
+
| `token` | The bearer token or session cookie value used for the request |
|
|
189
|
+
| `clientId` | The first present of `user.id`, `user.sub`, `user.userId`, `user.email` |
|
|
190
|
+
| `scopes` | `user.scopes`, `user.scope`, or `user.permissions`, normalized to an array |
|
|
191
|
+
| `extra.user` | The full user object returned by the auth provider |
|
|
192
|
+
|
|
193
|
+
If your own middleware performs the verification, set `server.mcpOptions.setRequestAuth` to build `authInfo` yourself. The hook replaces the default mapping and applies to both the streamable HTTP and SSE transports:
|
|
194
|
+
|
|
195
|
+
```typescript
|
|
196
|
+
export const mastra = new Mastra({
|
|
197
|
+
mcpServers: { myServer },
|
|
198
|
+
server: {
|
|
199
|
+
middleware: [verifyBearerToken], // stores the payload on the request context
|
|
200
|
+
mcpOptions: {
|
|
201
|
+
setRequestAuth: (req, requestContext) => {
|
|
202
|
+
const payload = requestContext.get('bearerPayload')
|
|
203
|
+
req.auth = {
|
|
204
|
+
token: payload.token,
|
|
205
|
+
clientId: payload.sub,
|
|
206
|
+
scopes: payload.scope.split(' '),
|
|
207
|
+
}
|
|
208
|
+
},
|
|
209
|
+
},
|
|
210
|
+
},
|
|
211
|
+
})
|
|
212
|
+
```
|
|
213
|
+
|
|
214
|
+
Leaving `req.auth` unset inside the hook opts the request out of auth info entirely.
|
|
215
|
+
|
|
171
216
|
## Methods
|
|
172
217
|
|
|
173
218
|
These are the functions you can call on an `MCPServer` instance to control its behavior and get information.
|
|
@@ -929,7 +974,7 @@ Notification methods (`resources.notifyListChanged()`, `prompts.notifyListChange
|
|
|
929
974
|
|
|
930
975
|
## Examples
|
|
931
976
|
|
|
932
|
-
For a practical example of packaging a stdio server, see [Publish a stdio server package](https://mastra.ai/docs/mcp
|
|
977
|
+
For a practical example of packaging a stdio server, see [Publish a stdio server package](https://mastra.ai/docs/connections/mcp).
|
|
933
978
|
|
|
934
979
|
The example at the beginning of this page also demonstrates how to instantiate `MCPServer` with both tools and agents.
|
|
935
980
|
|
|
@@ -1663,7 +1708,7 @@ const server = new MCPServer({
|
|
|
1663
1708
|
})
|
|
1664
1709
|
```
|
|
1665
1710
|
|
|
1666
|
-
Link a tool to its app resource by setting `mcp._meta.ui.resourceUri` in `createTool()` to the matching `ui://` URI. The server normalizes this metadata for older hosts when listing tools. Visit [MCP Apps](https://mastra.ai/docs/mcp
|
|
1711
|
+
Link a tool to its app resource by setting `mcp._meta.ui.resourceUri` in `createTool()` to the matching `ui://` URI. The server normalizes this metadata for older hosts when listing tools. Visit [MCP Apps](https://mastra.ai/docs/connections/mcp) for the full app bridge API and usage patterns.
|
|
1667
1712
|
|
|
1668
1713
|
## Related information
|
|
1669
1714
|
|
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
|
|
5
5
|
A built-in, agent-agnostic tool that submits an implementation plan for user review. The agent writes a plan to a markdown file and passes the file path to this tool. The tool suspends the run until the user approves or rejects the plan.
|
|
6
6
|
|
|
7
|
-
The tool pauses through the native [tool suspension](https://mastra.ai/docs/agents/
|
|
7
|
+
The tool pauses through the native [tool suspension](https://mastra.ai/docs/agents/human-in-the-loop) primitive: it calls `suspend({ path })`, which makes the agent emit a `tool-call-suspended` event. The host reads the plan file and presents it to the user. It then resumes with an approval or rejection.
|
|
8
8
|
|
|
9
9
|
When executed outside an agent run (no `suspend` available), the tool returns a readable fallback string containing the file path.
|
|
10
10
|
|
|
@@ -2,11 +2,11 @@
|
|
|
2
2
|
|
|
3
3
|
# Task tools
|
|
4
4
|
|
|
5
|
-
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](https://mastra.ai/docs/
|
|
5
|
+
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](https://mastra.ai/docs/harness/signals) lane so it survives [observational-memory](https://mastra.ai/docs/memory/observational-memory) truncation.
|
|
6
6
|
|
|
7
7
|
Task tracking requires a memory-backed thread (`threadId` + `resourceId`). Without memory the tools return an error explaining that task tracking requires agent memory.
|
|
8
8
|
|
|
9
|
-
The recommended setup is [`TaskSignalProvider`](https://mastra.ai/reference/signals/task-signal-provider), which bundles all four tools and the `TaskStateProcessor` in a single registration. See [Built-in tools](https://mastra.ai/docs/agents/
|
|
9
|
+
The recommended setup is [`TaskSignalProvider`](https://mastra.ai/reference/signals/task-signal-provider), which bundles all four tools and the `TaskStateProcessor` in a single registration. See [Built-in tools](https://mastra.ai/docs/agents/tools) for the conceptual guide.
|
|
10
10
|
|
|
11
11
|
## Usage example
|
|
12
12
|
|
|
@@ -90,13 +90,13 @@ Lists all metadata field indexes for an index.
|
|
|
90
90
|
|
|
91
91
|
### `updateVector()`
|
|
92
92
|
|
|
93
|
-
Updates
|
|
93
|
+
Updates the vector and optionally the metadata for a specific ID within an index. Vectorize has no partial-update operation, so `update.vector` is required. Metadata-only updates aren't supported and throw an error.
|
|
94
94
|
|
|
95
95
|
**indexName** (`string`): Name of the index containing the ID to update
|
|
96
96
|
|
|
97
97
|
**id** (`string`): Unique identifier of the vector or metadata to update
|
|
98
98
|
|
|
99
|
-
**update** (`{ vector
|
|
99
|
+
**update** (`{ vector: number[]; metadata?: Record<string, any>; }`): Object containing the new vector values, and optionally the metadata to update. The vector values are required
|
|
100
100
|
|
|
101
101
|
### `deleteVector()`
|
|
102
102
|
|
|
@@ -106,6 +106,16 @@ Deletes a vector and its associated metadata for a specific ID within an index.
|
|
|
106
106
|
|
|
107
107
|
**id** (`string`): Unique identifier of the vector and metadata to delete
|
|
108
108
|
|
|
109
|
+
### `deleteVectors()`
|
|
110
|
+
|
|
111
|
+
Deletes multiple vectors and their associated metadata by ID. Vectorize has no filtered-delete operation, so deleting by metadata filter isn't supported and throws an error.
|
|
112
|
+
|
|
113
|
+
**indexName** (`string`): Name of the index containing the vectors to delete
|
|
114
|
+
|
|
115
|
+
**ids** (`string[]`): Unique identifiers of the vectors to delete. Must contain at least one ID, and cannot be combined with filter
|
|
116
|
+
|
|
117
|
+
**filter** (`Record<string, any>`): Not supported by Vectorize. Passing a filter throws an error
|
|
118
|
+
|
|
109
119
|
## Response types
|
|
110
120
|
|
|
111
121
|
Query results are returned in this format:
|
|
@@ -31,7 +31,7 @@ The base URL of the API server, used by the orchestration worker to execute work
|
|
|
31
31
|
MASTRA_STEP_EXECUTION_URL=http://api:4111/api
|
|
32
32
|
```
|
|
33
33
|
|
|
34
|
-
Use HTTPS URLs in production. See [Security recommendations](https://mastra.ai/docs/
|
|
34
|
+
Use HTTPS URLs in production. See [Security recommendations](https://mastra.ai/docs/auth/workers).
|
|
35
35
|
|
|
36
36
|
The orchestration worker sends step execution requests to:
|
|
37
37
|
|
|
@@ -41,7 +41,7 @@ ${MASTRA_STEP_EXECUTION_URL}/workflows/:workflowId/runs/:runId/steps/execute
|
|
|
41
41
|
|
|
42
42
|
### `MASTRA_WORKER_AUTH_TOKEN`
|
|
43
43
|
|
|
44
|
-
A bearer token sent by the orchestration worker when calling the API's step execution endpoint. The API's configured auth provider must recognize this token. See [Worker authentication](https://mastra.ai/docs/
|
|
44
|
+
A bearer token sent by the orchestration worker when calling the API's step execution endpoint. The API's configured auth provider must recognize this token. See [Worker authentication](https://mastra.ai/docs/auth/workers).
|
|
45
45
|
|
|
46
46
|
```text
|
|
47
47
|
MASTRA_WORKER_AUTH_TOKEN=sk-worker-secret-token
|
|
@@ -356,4 +356,4 @@ Set `WORKSPACE_PATH` in your environment to an absolute path like `/home/user/my
|
|
|
356
356
|
|
|
357
357
|
- [WorkspaceFilesystem interface](https://mastra.ai/reference/workspace/filesystem)
|
|
358
358
|
- [Workspace class](https://mastra.ai/reference/workspace/workspace-class)
|
|
359
|
-
- [Sandbox](https://mastra.ai/docs/
|
|
359
|
+
- [Sandbox](https://mastra.ai/docs/sandbox/overview)
|
|
@@ -123,10 +123,11 @@ await sandbox.start()
|
|
|
123
123
|
// Spawn a background process
|
|
124
124
|
const handle = await sandbox.processes.spawn('node server.js')
|
|
125
125
|
|
|
126
|
-
// Read output, send stdin,
|
|
126
|
+
// Read output, send stdin, signal EOF, and wait for completion
|
|
127
127
|
console.log(handle.stdout)
|
|
128
128
|
await handle.sendStdin('input\n')
|
|
129
|
-
await handle.
|
|
129
|
+
await handle.closeStdin()
|
|
130
|
+
await handle.wait()
|
|
130
131
|
```
|
|
131
132
|
|
|
132
133
|
When native isolation is enabled (`seatbelt` or `bwrap`), spawned processes are also wrapped with the same isolation backend.
|
|
@@ -223,4 +224,4 @@ This separation prevents sandboxed processes from reading or modifying their own
|
|
|
223
224
|
- [SandboxProcessManager reference](https://mastra.ai/reference/workspace/process-manager)
|
|
224
225
|
- [WorkspaceSandbox Interface](https://mastra.ai/reference/workspace/sandbox)
|
|
225
226
|
- [Workspace Class](https://mastra.ai/reference/workspace/workspace-class)
|
|
226
|
-
- [Sandbox](https://mastra.ai/docs/
|
|
227
|
+
- [Sandbox](https://mastra.ai/docs/sandbox/overview)
|