@mastra/mcp-docs-server 1.2.16-alpha.3 → 1.2.16-alpha.4
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/docs/agents/a2a.md +1 -1
- package/.docs/docs/agents/overview.md +2 -0
- package/.docs/docs/agents/processors.md +4 -4
- package/.docs/docs/agents/structured-output.md +1 -1
- package/.docs/docs/agents/using-tools.md +15 -11
- package/.docs/docs/browser/overview.md +22 -3
- package/.docs/docs/capabilities/subagents.md +2 -2
- package/.docs/docs/datasets/running-experiments.md +2 -2
- package/.docs/docs/deployment/overview.md +3 -3
- package/.docs/docs/deployment/sandbox.md +1 -1
- package/.docs/docs/deployment/workers.md +5 -5
- package/.docs/docs/deployment/workflow-runners.md +1 -1
- package/.docs/docs/editor/overview.md +3 -1
- package/.docs/docs/evals/custom-scorers.md +1 -1
- package/.docs/docs/evals/multi-turn.md +1 -1
- package/.docs/docs/evals/overview.md +3 -3
- package/.docs/docs/getting-started/develop.md +1 -1
- package/.docs/docs/harness/agent-controller.md +2 -2
- package/.docs/docs/harness/overview.md +1 -1
- package/.docs/docs/long-running-agents/background-tasks.md +2 -2
- package/.docs/docs/long-running-agents/goals.md +3 -2
- package/.docs/docs/long-running-agents/signals.md +2 -2
- package/.docs/docs/mastra-platform/deploy.md +1 -1
- package/.docs/docs/mastra-platform/github.md +1 -1
- package/.docs/docs/mastra-platform/observability.md +1 -1
- package/.docs/docs/mastra-platform/overview.md +3 -3
- package/.docs/docs/mastra-platform/server.md +2 -2
- package/.docs/docs/mastra-platform/trace-intelligence.md +3 -3
- package/.docs/docs/memory/memory-processors.md +1 -1
- package/.docs/docs/memory/message-history.md +2 -2
- package/.docs/docs/memory/observational-memory.md +13 -13
- package/.docs/docs/memory/semantic-recall.md +1 -1
- package/.docs/docs/memory/working-memory.md +1 -1
- package/.docs/docs/observability/logging.md +1 -1
- package/.docs/docs/observability/metrics/querying.md +1 -1
- package/.docs/docs/observability/tracing/overview.md +3 -3
- package/.docs/docs/server/custom-adapters.md +2 -2
- package/.docs/docs/server/custom-api-routes.md +1 -1
- package/.docs/docs/server/mastra-client.md +1 -1
- package/.docs/docs/server/server-adapters.md +1 -1
- package/.docs/docs/studio/deployment.md +2 -2
- package/.docs/docs/studio/observability.md +1 -1
- package/.docs/docs/studio/overview.md +2 -0
- package/.docs/docs/workflows/dynamic-workflows.md +1 -1
- package/.docs/docs/workflows/scheduled-workflows.md +1 -1
- package/.docs/docs/workflows/suspend-and-resume.md +1 -1
- package/.docs/docs/workspace/overview.md +2 -1
- package/.docs/docs/workspace/search.md +1 -1
- package/.docs/docs/workspace/skills.md +1 -1
- package/.docs/integrations/browsers/agent-browser.md +2 -3
- package/.docs/integrations/browsers/firecrawl.md +0 -1
- package/.docs/integrations/browsers/stagehand.md +2 -3
- package/.docs/models/gateways/openrouter.md +1 -2
- package/.docs/models/index.md +1 -1
- package/.docs/models/providers/kilo.md +6 -7
- package/.docs/models/providers/nano-gpt.md +2 -1
- package/.docs/reference/acp/acp-agent.md +1 -1
- package/.docs/reference/agent-controller/session.md +1 -1
- package/.docs/reference/agents/channels.md +1 -1
- package/.docs/reference/agents/inngest-agent.md +1 -1
- package/.docs/reference/ai-sdk/overview.md +1 -1
- package/.docs/reference/auth/auth0.md +1 -1
- package/.docs/reference/auth/google.md +1 -1
- package/.docs/reference/browser/agent-browser.md +2 -2
- package/.docs/reference/browser/browser-viewer.md +1 -1
- package/.docs/reference/browser/stagehand-browser.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 +5 -5
- package/.docs/reference/code-sdk/mount-agent-controller.md +1 -1
- package/.docs/reference/coding-agent/build-base-prompt.md +2 -1
- package/.docs/reference/configuration.md +3 -3
- package/.docs/reference/core/getAgentById.md +1 -1
- package/.docs/reference/core/getWorkflow.md +2 -2
- package/.docs/reference/core/mastra-class.md +1 -1
- package/.docs/reference/deployer/netlify.md +1 -1
- package/.docs/reference/deployer.md +1 -1
- package/.docs/reference/editor/prompt-blocks.md +1 -1
- package/.docs/reference/editor/tools.md +1 -1
- package/.docs/reference/evals/completeness.md +1 -1
- package/.docs/reference/evals/noise-sensitivity.md +1 -1
- package/.docs/reference/evals/summarization.md +1 -1
- package/.docs/reference/file-based-agents/config.md +1 -1
- package/.docs/reference/file-based-agents/skills.md +5 -5
- package/.docs/reference/file-based-agents/workspace.md +1 -1
- package/.docs/reference/logging/pino-logger.md +1 -1
- package/.docs/reference/memory/observational-memory.md +12 -4
- package/.docs/reference/migrations/upgrade-to-v1/agent.md +3 -3
- package/.docs/reference/migrations/upgrade-to-v1/client.md +1 -1
- package/.docs/reference/migrations/upgrade-to-v1/evals.md +1 -1
- package/.docs/reference/migrations/upgrade-to-v1/mastra.md +1 -1
- package/.docs/reference/migrations/upgrade-to-v1/mcp.md +1 -1
- package/.docs/reference/migrations/upgrade-to-v1/overview.md +1 -1
- package/.docs/reference/migrations/upgrade-to-v1/processors.md +1 -1
- package/.docs/reference/migrations/upgrade-to-v1/storage.md +5 -5
- package/.docs/reference/migrations/upgrade-to-v1/tools.md +1 -1
- package/.docs/reference/observability/tracing/bridges/datadog.md +1 -1
- package/.docs/reference/observability/tracing/bridges/otel.md +1 -1
- package/.docs/reference/observability/tracing/exporters/arize.md +1 -1
- package/.docs/reference/observability/tracing/exporters/cloud-exporter.md +2 -2
- package/.docs/reference/observability/tracing/exporters/mastra-platform-exporter.md +1 -1
- package/.docs/reference/observability/tracing/exporters/otel.md +1 -1
- package/.docs/reference/observability/tracing/exporters/sentry.md +1 -1
- package/.docs/reference/observability/tracing/processors/sensitive-data-filter.md +27 -3
- package/.docs/reference/processors/batch-parts-processor.md +1 -1
- package/.docs/reference/processors/language-detector.md +1 -2
- package/.docs/reference/processors/processor-interface.md +16 -16
- package/.docs/reference/processors/stream-error-retry-processor.md +2 -2
- package/.docs/reference/rag/chunking-and-embedding.md +1 -1
- package/.docs/reference/rag/metadata-filters.md +1 -1
- package/.docs/reference/server/koa-adapter.md +1 -1
- package/.docs/reference/signals/webhook-signal-provider.md +1 -1
- package/.docs/reference/storage/retention.md +1 -1
- package/.docs/reference/tools/bedrock-kb-tool.md +1 -1
- package/.docs/reference/tools/mcp-client.md +3 -3
- package/.docs/reference/tools/mcp-server.md +5 -5
- package/.docs/reference/tools/task-tools.md +1 -1
- package/.docs/reference/tools/vector-query-tool.md +1 -1
- package/.docs/reference/vectors/chroma.md +1 -1
- package/.docs/reference/vectors/convex.md +1 -1
- package/.docs/reference/vectors/couchbase.md +1 -1
- package/.docs/reference/vectors/mongodb.md +2 -2
- package/.docs/reference/vectors/pg.md +1 -1
- package/.docs/reference/vectors/qdrant.md +2 -2
- package/.docs/reference/voice/overview.md +1 -1
- package/.docs/reference/voice/speech-to-speech.md +1 -1
- package/.docs/reference/voice/speech-to-text.md +1 -1
- package/.docs/reference/voice/voice.on.md +1 -1
- package/.docs/reference/voice/voice.updateConfig.md +1 -1
- package/.docs/reference/workspace/local-sandbox.md +1 -1
- package/.docs/reference/workspace/workspace-class.md +1 -1
- package/CHANGELOG.md +7 -0
- package/package.json +4 -4
- package/.docs/docs/browser/recording.md +0 -120
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
# ChannelProvider
|
|
4
4
|
|
|
5
|
-
`ChannelProvider` is the interface that platform integrations implement to connect agents to a messaging platform. A provider owns the full lifecycle
|
|
5
|
+
`ChannelProvider` is the interface that platform integrations implement to connect agents to a messaging platform. A provider owns the full integration lifecycle. This includes app provisioning with OAuth, webhook routing with event handling, adapter creation and agent wiring, and credential management.
|
|
6
6
|
|
|
7
7
|
Register providers on the `Mastra` constructor under `channels`, keyed by an id you choose. Each provider's routes are merged into the server's API routes automatically, and `initialize()` runs during Mastra startup.
|
|
8
8
|
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
# SlackProvider
|
|
4
4
|
|
|
5
|
-
`SlackProvider` is the managed path for connecting agents to Slack. Register it on `Mastra.channels` and it provisions Slack apps
|
|
5
|
+
`SlackProvider` is the managed path for connecting agents to Slack. Register it on `Mastra.channels` and it provisions Slack apps through the Manifest API and runs the OAuth install flow. It also rotates configuration tokens and routes Slack events to your agents. Use it when you want Mastra to own app creation and installation. For the lower-level path where you create the Slack app and configure scopes and webhooks yourself, use [`createSlackAdapter`](https://mastra.ai/integrations/channels/slack) on the agent's `channels.adapters` instead.
|
|
6
6
|
|
|
7
7
|
## Usage example
|
|
8
8
|
|
|
@@ -226,7 +226,7 @@ The content digest excludes `experiment-worker-manifest.json` to avoid a self-re
|
|
|
226
226
|
|
|
227
227
|
The worker implements the pinned experiment companion-worker protocol version `1`. It reads strict UTF-8 NDJSON frames from standard input and requires every frame, including the last one, to end with a newline. Frames larger than 1 MiB, malformed or truncated frames, unsupported protocol or canonicalization versions, and messages that don't match the active experiment correlation are rejected as protocol failures.
|
|
228
228
|
|
|
229
|
-
A run request must match the artifact's embedded build ID and include the ordered dataset item count and SHA-256 attestation. The worker emits contiguous sequence numbers starting at `0`, timer-driven heartbeats, awaited experiment lifecycle events, and exactly one terminal event. Cancellation must match the active protocol version
|
|
229
|
+
A run request must match the artifact's embedded build ID and include the ordered dataset item count and SHA-256 attestation. The worker emits contiguous sequence numbers starting at `0`, timer-driven heartbeats, awaited experiment lifecycle events, and exactly one terminal event. Cancellation must match the active protocol version and experiment ID, plus the job ID, attempt, and idempotency key.
|
|
230
230
|
|
|
231
231
|
Protocol exit codes are:
|
|
232
232
|
|
|
@@ -528,7 +528,7 @@ Emit machine-readable JSON.
|
|
|
528
528
|
|
|
529
529
|
Provisions and attaches a managed database, then polls until it's ready. Provisioning errors are printed with the provider's error detail.
|
|
530
530
|
|
|
531
|
-
By default the database is scoped to a single environment
|
|
531
|
+
By default, the database is scoped to a single environment. Pass an environment argument to select it. If you omit the argument, the CLI uses the project's only environment or prompts you when several are available. In non-interactive contexts (CI, `--json`) an environment argument is required. Pass `--shared` to attach a project-scoped database that's shared by every environment instead.
|
|
532
532
|
|
|
533
533
|
Environment-scoped databases inherit their provider region from the environment. Shared databases accept `--region`.
|
|
534
534
|
|
|
@@ -797,7 +797,7 @@ Lists all environment variables for the linked project. Values are partially mas
|
|
|
797
797
|
|
|
798
798
|
### `mastra server env set`
|
|
799
799
|
|
|
800
|
-
Sets an environment variable. The CLI reads the current map
|
|
800
|
+
Sets an environment variable. The CLI reads the current map and applies the change before uploading the result.
|
|
801
801
|
|
|
802
802
|
```bash
|
|
803
803
|
mastra server env set <key> <value>
|
|
@@ -1226,7 +1226,7 @@ mastra api agent get <agentId>
|
|
|
1226
1226
|
|
|
1227
1227
|
#### `mastra api agent run`
|
|
1228
1228
|
|
|
1229
|
-
Runs an agent with JSON input. Use command help to see examples for text prompts
|
|
1229
|
+
Runs an agent with JSON input. Use command help to see examples for text prompts and chat messages, including memory thread options.
|
|
1230
1230
|
|
|
1231
1231
|
```bash
|
|
1232
1232
|
mastra api agent run <agentId> <input>
|
|
@@ -1370,7 +1370,7 @@ mastra api thread get <threadId>
|
|
|
1370
1370
|
|
|
1371
1371
|
#### `mastra api thread create`
|
|
1372
1372
|
|
|
1373
|
-
Creates a memory thread. Pass one JSON input object
|
|
1373
|
+
Creates a memory thread. Pass one JSON input object. The CLI splits fields such as `agentId` into query parameters when required by the server route.
|
|
1374
1374
|
|
|
1375
1375
|
```bash
|
|
1376
1376
|
mastra api thread create <input>
|
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
|
|
5
5
|
> **Beta:** Breaking changes may occur without a major version bump until the API is stable.
|
|
6
6
|
|
|
7
|
-
The `mountAgentControllerOnMastra()` function builds the Mastra Code agent controller (the coding agent behind
|
|
7
|
+
The `mountAgentControllerOnMastra()` function builds the Mastra Code agent controller (the coding agent behind [Mastra Code](https://code.mastra.ai), with its modes, tools, memory, and thread management) and registers it on a server-owned [Mastra](https://mastra.ai/reference/core/mastra-class) instance. Use it to serve the Mastra Code agent to your own UI (web app, editor, bot): each client creates or resumes its own isolated session through the returned [`AgentController`](https://mastra.ai/reference/agent-controller/agent-controller-class).
|
|
8
8
|
|
|
9
9
|
To construct the `Mastra` instance yourself (for example in a deployable entry file), use `prepareAgentControllerMount()` from the same package, which returns the constructor args plus a `finalize()` callback.
|
|
10
10
|
|
|
@@ -74,4 +74,5 @@ const prompt = buildBasePrompt({
|
|
|
74
74
|
|
|
75
75
|
## Related
|
|
76
76
|
|
|
77
|
-
- [`createCodingAgent()`](https://mastra.ai/reference/coding-agent/create-coding-agent)
|
|
77
|
+
- [`createCodingAgent()`](https://mastra.ai/reference/coding-agent/create-coding-agent)
|
|
78
|
+
- [Mastra Code](https://code.mastra.ai)
|
|
@@ -801,7 +801,7 @@ export const mastra = new Mastra({
|
|
|
801
801
|
|
|
802
802
|
**Type:** `(err: Error, c: Context) => Response | Promise<Response>`
|
|
803
803
|
|
|
804
|
-
Custom error handler called when an unhandled error occurs. Use this to customize error responses
|
|
804
|
+
Custom error handler called when an unhandled error occurs. Use this to customize error responses or log errors to external services such as Sentry. You can also implement custom error formatting.
|
|
805
805
|
|
|
806
806
|
This hook is supported by all server adapters. The `c` parameter provides a Hono-compatible context object: for non-Hono adapters (Koa, Express, Fastify), a shim is provided with commonly used methods like `c.json()` and `c.req.path`.
|
|
807
807
|
|
|
@@ -830,7 +830,7 @@ export const mastra = new Mastra({
|
|
|
830
830
|
|
|
831
831
|
**Type:** `(error: ZodError, context: 'query' | 'body' | 'path') => { status: number; body: unknown } | undefined`
|
|
832
832
|
|
|
833
|
-
Custom handler called when a request fails Zod schema validation. Use this to customize validation error responses
|
|
833
|
+
Custom handler called when a request fails Zod schema validation. Use this to customize validation error responses and change the status code, or to format errors to match your API standards.
|
|
834
834
|
|
|
835
835
|
Return a `{ status, body }` object to override the default `400` response, or `undefined` to use the default behavior. This hook is supported by all server adapters (Hono, Express, Fastify, Koa).
|
|
836
836
|
|
|
@@ -886,7 +886,7 @@ export const mastra = new Mastra({
|
|
|
886
886
|
|
|
887
887
|
Base path for hosting [Studio](https://mastra.ai/docs/studio/overview). Use this to host the Studio on a sub-path of your existing application instead of the root.
|
|
888
888
|
|
|
889
|
-
This is useful when integrating with existing applications
|
|
889
|
+
This is useful when integrating with existing applications or authentication tools such as Cloudflare Zero Trust that benefit from shared domains. It also supports managing multiple services under one domain.
|
|
890
890
|
|
|
891
891
|
```typescript
|
|
892
892
|
import { Mastra } from '@mastra/core'
|
|
@@ -8,7 +8,7 @@ Use `mastra.getAgentById(id)` to retrieve the code-defined agent. Use `await mas
|
|
|
8
8
|
|
|
9
9
|
## Usage example
|
|
10
10
|
|
|
11
|
-
The following example registers an agent
|
|
11
|
+
The following example registers an agent and retrieves it by ID before using the returned agent.
|
|
12
12
|
|
|
13
13
|
```typescript
|
|
14
14
|
import { Agent } from '@mastra/core/agent'
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
# Mastra.getWorkflow()
|
|
4
4
|
|
|
5
|
-
The `.getWorkflow()` method is used to retrieve a workflow by its registration key.
|
|
5
|
+
The `.getWorkflow()` method is used to retrieve a workflow by its registration key. The method provides full TypeScript type inference for workflow input and output schemas.
|
|
6
6
|
|
|
7
7
|
## Usage example
|
|
8
8
|
|
|
@@ -19,7 +19,7 @@ await run.startAsync({
|
|
|
19
19
|
|
|
20
20
|
## Type inference
|
|
21
21
|
|
|
22
|
-
For best TypeScript support, use `getWorkflow()` with the workflow's **registration key** (the key used when adding the workflow to Mastra).
|
|
22
|
+
For best TypeScript support, use `getWorkflow()` with the workflow's **registration key** (the key used when adding the workflow to Mastra). The registration key provides full type inference for:
|
|
23
23
|
|
|
24
24
|
- Input data schemas
|
|
25
25
|
- Output data schemas
|
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
|
|
5
5
|
The `Mastra` class is the central orchestrator in any Mastra application, managing agents, workflows, storage, logging, observability, and more. Typically, you create a single instance of `Mastra` to coordinate your application.
|
|
6
6
|
|
|
7
|
-
|
|
7
|
+
`Mastra` is the top-level registry where you register agents, workflows, tools, and other components that need to be accessible throughout your application.
|
|
8
8
|
|
|
9
9
|
## Usage example
|
|
10
10
|
|
|
@@ -50,7 +50,7 @@ export const mastra = new Mastra({
|
|
|
50
50
|
- `target?: 'serverless' | 'edge'`: Deploy target for Netlify. Defaults to `'serverless'`.
|
|
51
51
|
|
|
52
52
|
- `'serverless'`: Standard [Netlify Functions](https://docs.netlify.com/functions/overview/) (Node.js runtime, 60s default timeout).
|
|
53
|
-
- `'edge'`: [Netlify Edge Functions](https://docs.netlify.com/build/edge-functions/overview/) (Deno-based runtime
|
|
53
|
+
- `'edge'`: [Netlify Edge Functions](https://docs.netlify.com/build/edge-functions/overview/) (Deno-based runtime that runs at the edge closest to users without a fixed timeout).
|
|
54
54
|
|
|
55
55
|
### Edge functions example
|
|
56
56
|
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
# Deployer
|
|
4
4
|
|
|
5
|
-
The Deployer handles the deployment of standalone Mastra applications by packaging code
|
|
5
|
+
The Deployer handles the deployment of standalone Mastra applications by packaging code and managing environment files while serving applications through the Hono framework. Concrete implementations must define the deploy method for specific deployment targets.
|
|
6
6
|
|
|
7
7
|
## Usage example
|
|
8
8
|
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
# Prompt blocks
|
|
4
4
|
|
|
5
|
-
Prompt blocks are reusable instruction templates managed by Editor. An agent's instructions can combine inline text
|
|
5
|
+
Prompt blocks are reusable instruction templates managed by Editor. An agent's instructions can combine inline text with embedded prompt blocks and references to independently versioned prompt blocks.
|
|
6
6
|
|
|
7
7
|
See [Prompt blocks](https://mastra.ai/docs/editor/overview) for the Studio workflow and common uses.
|
|
8
8
|
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
# Tool configuration
|
|
4
4
|
|
|
5
|
-
Editor stores tool selections as part of an agent version. A stored configuration can add registered tools
|
|
5
|
+
Editor stores tool selections as part of an agent version. A stored configuration can add registered tools and tools from integration providers, as well as tools from Model Context Protocol (MCP) clients.
|
|
6
6
|
|
|
7
7
|
See [Editor tools](https://mastra.ai/docs/editor/overview) for the Studio workflow and common uses.
|
|
8
8
|
|
|
@@ -177,7 +177,7 @@ Include in your test harness to:
|
|
|
177
177
|
|
|
178
178
|
- Benchmark different models' noise resistance before deployment
|
|
179
179
|
- Identify agents vulnerable to manipulation during development
|
|
180
|
-
- Create detailed test coverage for
|
|
180
|
+
- Create detailed test coverage for multiple noise types
|
|
181
181
|
- Ensure consistent behavior across updates
|
|
182
182
|
|
|
183
183
|
### Security Testing
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
# Summarization scorer
|
|
4
4
|
|
|
5
|
-
The `createSummarizationScorer()` function creates a scorer that evaluates a summary on two axes: whether every claim
|
|
5
|
+
The `createSummarizationScorer()` function creates a scorer that evaluates a summary on two axes: whether every claim has source-text support and whether the summary preserves the source information. The final score is the lower of the two. A summary can't pass by being faithful but empty or by being thorough but wrong.
|
|
6
6
|
|
|
7
7
|
The summary is the agent's last message that carries text, and the source text defaults to the first user message of the run input. Pass `source` or `sourceExtractor` when the text being summarized lives somewhere else, such as a tool result.
|
|
8
8
|
|
|
@@ -101,7 +101,7 @@ Missing `instructions.md`, `instructions.ts`, and `config.instructions` fails th
|
|
|
101
101
|
|
|
102
102
|
## Discovery lifecycle
|
|
103
103
|
|
|
104
|
-
File-based primitives are discovered by the Mastra bundler under `mastra dev` and `mastra build`. During discovery, Mastra reads supported files under `src/mastra
|
|
104
|
+
File-based primitives are discovered by the Mastra bundler under `mastra dev` and `mastra build`. During discovery, Mastra reads supported files under `src/mastra/` and imports TypeScript and JavaScript modules. It also reads markdown instructions and skills. The bundler then copies workspace seed files and registers the assembled primitives with your Mastra app.
|
|
105
105
|
|
|
106
106
|
After discovery, a file-based agent runs as a normal [`Agent`](https://mastra.ai/reference/agents/agent). Calling it from the Agent API, Studio, workflows, or your application code uses the same runtime as a code-defined agent.
|
|
107
107
|
|
|
@@ -22,11 +22,11 @@ Always report temperatures in Celsius and Fahrenheit. Include the user's preferr
|
|
|
22
22
|
|
|
23
23
|
## Skills vs tools vs instructions
|
|
24
24
|
|
|
25
|
-
| Need | Use | Why
|
|
26
|
-
| ---------------------------------------------------- | ------------------------------------------------------------------------------- |
|
|
27
|
-
| Always-on identity, tone, or rules | [`instructions.md`](https://mastra.ai/reference/file-based-agents/instructions) | The model should see the guidance every turn.
|
|
28
|
-
| Callable action with inputs and outputs | [`tools/`](https://mastra.ai/reference/file-based-agents/tools) | The model needs to execute code
|
|
29
|
-
| Detailed reference or procedure loaded when relevant | `skills/` | The model only needs the full guidance for specific tasks.
|
|
25
|
+
| Need | Use | Why |
|
|
26
|
+
| ---------------------------------------------------- | ------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------- |
|
|
27
|
+
| Always-on identity, tone, or rules | [`instructions.md`](https://mastra.ai/reference/file-based-agents/instructions) | The model should see the guidance every turn. |
|
|
28
|
+
| Callable action with inputs and outputs | [`tools/`](https://mastra.ai/reference/file-based-agents/tools) | The model needs to execute code or call APIs, including operations that perform side effects. |
|
|
29
|
+
| Detailed reference or procedure loaded when relevant | `skills/` | The model only needs the full guidance for specific tasks. |
|
|
30
30
|
|
|
31
31
|
## Skill formats
|
|
32
32
|
|
|
@@ -15,7 +15,7 @@ Without `workspace.ts`, a file-based agent gets a default [`Workspace`](https://
|
|
|
15
15
|
- [`LocalFilesystem`](https://mastra.ai/reference/workspace/local-filesystem) rooted at the agent's bundled workspace directory.
|
|
16
16
|
- [`LocalSandbox`](https://mastra.ai/reference/workspace/local-sandbox) with the same working directory.
|
|
17
17
|
|
|
18
|
-
This gives the agent file tools and shell tools automatically. The default workspace is per agent
|
|
18
|
+
This gives the agent file tools and shell tools automatically. The default workspace is per agent. Subagents get nested workspace directories under their parent agent's workspace path.
|
|
19
19
|
|
|
20
20
|
## Quickstart
|
|
21
21
|
|
|
@@ -149,7 +149,7 @@ You can create custom transports using the `createCustomTransport` utility to in
|
|
|
149
149
|
|
|
150
150
|
### Sentry transport example
|
|
151
151
|
|
|
152
|
-
Creates a custom transport using `createCustomTransport` and integrates it with a third-party logging stream such as `pino-sentry-transport`.
|
|
152
|
+
Creates a custom transport using `createCustomTransport` and integrates it with a third-party logging stream such as `pino-sentry-transport`. The custom transport forwards logs to an external system such as Sentry for advanced monitoring and observability.
|
|
153
153
|
|
|
154
154
|
```typescript
|
|
155
155
|
import { createCustomTransport } from '@mastra/core/loggers'
|
|
@@ -87,7 +87,7 @@ OM performs thresholding with fast local token estimation. Text uses `tokenx`, a
|
|
|
87
87
|
|
|
88
88
|
**observation.activateOnProviderChange** (`boolean`): Force buffered observations to activate when the actor provider or model changes. If unset, the top-level activateOnProviderChange value is used for observations. Currently only applied when using the standalone ObservationalMemory class; new Memory(...) applies the top-level activateOnProviderChange only.
|
|
89
89
|
|
|
90
|
-
**observation.blockAfter** (`number`): Safety net
|
|
90
|
+
**observation.blockAfter** (`number`): Safety net for when background buffering can't keep up. Values from 1 up to (but not including) 100 are multipliers of messageTokens: 1.2 resolves to 120% of the threshold (36k tokens with the default 30k). Values of 100 or more are absolute token counts and must be greater than messageTokens. Above this point, activation uses the smallest set of buffered chunks that reaches the retention target, even when that overshoots the target by more than the usual safeguard allows. It never activates more chunks than are needed to reach the retention target, so it removes only slightly more history than a normal activation. It changes the result only when the retention floor is above roughly 20,000 tokens; with the default bufferActivation (a 6k floor) it has no observable effect. Activation usually keeps a minimum remaining context (the smaller of 1000 tokens or the retention floor), but a single buffered chunk that covers the whole pending window still activates and can leave less. Crossing blockAfter does not trigger a blocking observation. A synchronous (blocking) observation runs when the messageTokens threshold is reached and buffered activation did not happen. Only relevant when bufferTokens is set. Defaults to 1.2 when async buffering is enabled.
|
|
91
91
|
|
|
92
92
|
**observation.previousObserverTokens** (`number | false`): Optional token budget for the observer's previous-observations context. When set to a number, the observations passed to the Observer agent are tail-truncated to fit within this budget while keeping the newest observations and preserving highlighted 🔴 items when possible. When a buffered reflection is pending, the already-reflected observation lines are automatically replaced with the reflection summary before truncation. Set to 0 to omit previous observations entirely, or false to disable truncation explicitly.
|
|
93
93
|
|
|
@@ -353,7 +353,7 @@ export const agent = new Agent({
|
|
|
353
353
|
|
|
354
354
|
Async buffering is **enabled by default**. It pre-computes observations in the background as the conversation grows: when the `messageTokens` threshold is reached, buffered observations activate instantly with no blocking LLM call.
|
|
355
355
|
|
|
356
|
-
The lifecycle follows **buffer → activate → remove messages → repeat**. Background Observer calls run at `bufferTokens` intervals, each producing a chunk of observations. At threshold, chunks activate: observations move into the log, raw messages are removed from context.
|
|
356
|
+
The lifecycle follows **buffer → activate → remove messages → repeat**. Background Observer calls run at `bufferTokens` intervals, each producing a chunk of observations. At threshold, chunks activate: observations move into the log, raw messages are removed from context. Above the `blockAfter` threshold, activation may overshoot the retention target instead of activating fewer chunks. If the threshold is reached and no buffered chunk activates, a synchronous observation runs instead.
|
|
357
357
|
|
|
358
358
|
Default settings:
|
|
359
359
|
|
|
@@ -383,7 +383,7 @@ export const agent = new Agent({
|
|
|
383
383
|
bufferTokens: 5_000,
|
|
384
384
|
// Activate to retain 30% of threshold
|
|
385
385
|
bufferActivation: 0.7,
|
|
386
|
-
//
|
|
386
|
+
// Above 1.5x the threshold, let activation overshoot the retention target
|
|
387
387
|
blockAfter: 1.5,
|
|
388
388
|
},
|
|
389
389
|
reflection: {
|
|
@@ -787,6 +787,8 @@ Mastra also injects scope-aware usage instructions into the agent's context. For
|
|
|
787
787
|
|
|
788
788
|
**partIndex** (`number`): Fetch a single message part at full detail by its positional index. Use this when a low-detail recall shows an interesting part at \[p1] — call again with partIndex: 1 to see the full content without loading every part.
|
|
789
789
|
|
|
790
|
+
**charOffset** (`number`): Character position to continue reading a truncated single part. Only applies with cursor and partIndex. When a part is larger than the token budget, the result includes nextCharOffset — pass that exact value here in the next call to read the following chunk. The chunks concatenate to the original part text. (Default: `0`)
|
|
791
|
+
|
|
790
792
|
**before** (`string`): For mode: "threads" only. Filter to threads created before this date. Accepts ISO 8601 format (e.g. "2026-03-15", "2026-03-10T00:00:00Z").
|
|
791
793
|
|
|
792
794
|
**after** (`string`): For mode: "threads" only. Filter to threads created after this date. Accepts ISO 8601 format (e.g. "2026-03-01", "2026-03-10T00:00:00Z").
|
|
@@ -809,10 +811,16 @@ Mastra also injects scope-aware usage instructions into the agent's context. For
|
|
|
809
811
|
|
|
810
812
|
**hasPrevPage** (`boolean`): Whether more messages exist before this page.
|
|
811
813
|
|
|
812
|
-
**truncated** (`boolean`): Present and true when the output was capped by the token budget. The agent can paginate or use partIndex to access remaining content.
|
|
814
|
+
**truncated** (`boolean`): Present and true when the output was capped by the token budget. The agent can paginate or use partIndex to access remaining content. When a single part is itself too large, the partIndex result includes nextCharOffset for continuing within the part.
|
|
813
815
|
|
|
814
816
|
**tokenOffset** (`number`): Approximate number of tokens that were trimmed when truncated is true.
|
|
815
817
|
|
|
818
|
+
**charOffset** (`number`): On single-part results (partIndex), the character position this chunk starts at. 0 unless the call passed a charOffset.
|
|
819
|
+
|
|
820
|
+
**nextCharOffset** (`number`): On single-part results, present when the part was truncated and more content remains. Pass this value as charOffset in the next call to continue reading from where this chunk ended.
|
|
821
|
+
|
|
822
|
+
**note** (`string`): On truncated single-part results, the exact follow-up call for retrieving the next chunk.
|
|
823
|
+
|
|
816
824
|
### Returns (threads mode)
|
|
817
825
|
|
|
818
826
|
**threads** (`string`): Formatted thread listing. Each thread shows its title, ID, and dates. The current thread is marked with ← current.
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
# Agent class
|
|
4
4
|
|
|
5
|
-
The Agent class has been updated with reorganized voice methods
|
|
5
|
+
The Agent class has been updated with reorganized voice methods and property access patterns, plus streamlined streaming APIs.
|
|
6
6
|
|
|
7
7
|
## Changed
|
|
8
8
|
|
|
@@ -70,7 +70,7 @@ To migrate, update all imports and parameter names from `RuntimeContext`/`runtim
|
|
|
70
70
|
|
|
71
71
|
### Direct property access to getter methods
|
|
72
72
|
|
|
73
|
-
Direct property access to `agent.llm`, `agent.tools`, and `agent.instructions` is deprecated.
|
|
73
|
+
Direct property access to `agent.llm`, `agent.tools`, and `agent.instructions` is deprecated. The accessors improve encapsulation and align with the broader API design.
|
|
74
74
|
|
|
75
75
|
To migrate, replace property access with the corresponding getter methods.
|
|
76
76
|
|
|
@@ -146,7 +146,7 @@ To migrate, update processor method names.
|
|
|
146
146
|
|
|
147
147
|
Mastra v1 continues to accept both Zod v3 and Zod v4 schemas in public agent APIs that take structured output schemas. This includes methods such as `agent.generateLegacy()` and `agent.streamLegacy()` and the related option types.
|
|
148
148
|
|
|
149
|
-
|
|
149
|
+
Existing Zod schemas passed to agent APIs don't require migration for Zod version compatibility. Keep your existing schema imports:
|
|
150
150
|
|
|
151
151
|
```ts
|
|
152
152
|
import { z as z3 } from 'zod/v3'
|
|
@@ -148,7 +148,7 @@ client.memory.listMessages({
|
|
|
148
148
|
|
|
149
149
|
### `getMemoryThread` parameter structure
|
|
150
150
|
|
|
151
|
-
The `getMemoryThread` method parameter structure has been updated.
|
|
151
|
+
The `getMemoryThread` method parameter structure has been updated. The new structure aligns the API across memory methods.
|
|
152
152
|
|
|
153
153
|
To migrate, update the method call with the new parameter structure. Check the updated API documentation for the specific changes.
|
|
154
154
|
|
|
@@ -74,7 +74,7 @@ const scorer = createScorer({
|
|
|
74
74
|
|
|
75
75
|
### Scorer configuration from `name` to `id`
|
|
76
76
|
|
|
77
|
-
Scorers now require an `id` field instead of `name`. The `name` field is now optional.
|
|
77
|
+
Scorers now require an `id` field instead of `name`. The `name` field is now optional. The new field aligns scorers with other Mastra entities.
|
|
78
78
|
|
|
79
79
|
To migrate, update scorer definitions to use `id` as the required field.
|
|
80
80
|
|
|
@@ -49,7 +49,7 @@ const mastra = new Mastra({
|
|
|
49
49
|
|
|
50
50
|
### Required `id` parameter for all mastra primitives
|
|
51
51
|
|
|
52
|
-
All storages, vector stores, agents, workflows, mcpServers, processors, scorers, and tools now require an `id` parameter during initialization.
|
|
52
|
+
All storages, vector stores, agents, workflows, mcpServers, processors, scorers, and tools now require an `id` parameter during initialization. Required IDs standardize the Mastra API and prevent ID conflicts.
|
|
53
53
|
|
|
54
54
|
All these primitives also now have `get`, `list`, and `add` functions.
|
|
55
55
|
|
|
@@ -59,7 +59,7 @@ To migrate, replace all calls to `mcp.getToolsets()` with `mcp.listToolsets()`.
|
|
|
59
59
|
|
|
60
60
|
### MCP tool context properties organization
|
|
61
61
|
|
|
62
|
-
Context properties in MCP tools are now organized under the `context.mcp` namespace.
|
|
62
|
+
Context properties in MCP tools are now organized under the `context.mcp` namespace. The namespace organizes MCP-specific functionality under a clear API surface.
|
|
63
63
|
|
|
64
64
|
To migrate, access MCP-specific properties like `elicitation` and `extra` through `context.mcp` instead of directly from the context parameter.
|
|
65
65
|
|
|
@@ -108,7 +108,7 @@ Work through this checklist in order, starting with high-impact changes that aff
|
|
|
108
108
|
- Update storage methods from `get*` to `list*` pattern - [Storage](https://mastra.ai/reference/migrations/upgrade-to-v1/storage)
|
|
109
109
|
- Replace direct property access with getter methods - [Mastra Class](https://mastra.ai/reference/migrations/upgrade-to-v1/mastra), [Agent Class](https://mastra.ai/reference/migrations/upgrade-to-v1/agent)
|
|
110
110
|
- Update memory scope if relying on default `thread` scope - [Memory](https://mastra.ai/reference/migrations/upgrade-to-v1/memory)
|
|
111
|
-
- Update vector store calls to use
|
|
111
|
+
- Update vector store calls to use arguments by name - [Storage](https://mastra.ai/reference/migrations/upgrade-to-v1/storage)
|
|
112
112
|
- Remove `format` parameter from agent methods - [Agent Class](https://mastra.ai/reference/migrations/upgrade-to-v1/agent)
|
|
113
113
|
- Update voice methods to use `agent.voice` namespace - [Agent Class](https://mastra.ai/reference/migrations/upgrade-to-v1/agent)
|
|
114
114
|
- Rename configuration property `processors` to `spanOutputProcessors` (if using custom processors) - [Tracing](https://mastra.ai/reference/migrations/upgrade-to-v1/tracing)
|
|
@@ -8,7 +8,7 @@ Processor interfaces have been updated to use consistent naming patterns and dat
|
|
|
8
8
|
|
|
9
9
|
### Processor configuration from `name` to `id`
|
|
10
10
|
|
|
11
|
-
Processors now require an `id` field instead of `name`. The `name` field is now optional.
|
|
11
|
+
Processors now require an `id` field instead of `name`. The `name` field is now optional. The new field aligns processors with other Mastra entities such as scorers and agents.
|
|
12
12
|
|
|
13
13
|
To migrate, update processor definitions to use `id` as the required field.
|
|
14
14
|
|
|
@@ -93,7 +93,7 @@ USING snapshot::jsonb;
|
|
|
93
93
|
|
|
94
94
|
### Storage composition in `MastraCompositeStore`
|
|
95
95
|
|
|
96
|
-
`MastraCompositeStore` can now compose storage domains from different adapters. Use it when
|
|
96
|
+
`MastraCompositeStore` can now compose storage domains from different adapters. Use it when different purposes require different databases, such as PostgreSQL for memory and workflows with a specialized database for observability.
|
|
97
97
|
|
|
98
98
|
```typescript
|
|
99
99
|
import { MastraCompositeStore } from '@mastra/core/storage'
|
|
@@ -386,7 +386,7 @@ To migrate, use the memory store, remove format parameters, and update code to w
|
|
|
386
386
|
+ const saved = saveResult?.messages; // MastraDBMessage[]
|
|
387
387
|
```
|
|
388
388
|
|
|
389
|
-
### Vector store API from positional to
|
|
389
|
+
### Vector store API from positional arguments to arguments by name
|
|
390
390
|
|
|
391
391
|
All vector store methods now use an arguments object instead of positional arguments. This makes each value's purpose visible at the call site and lets method signatures evolve without relying on argument order.
|
|
392
392
|
|
|
@@ -430,7 +430,7 @@ To migrate, rename the methods and pass an arguments object.
|
|
|
430
430
|
|
|
431
431
|
### PGVector constructor from connection string to object
|
|
432
432
|
|
|
433
|
-
The PGVector constructor now requires object parameters instead of a connection string.
|
|
433
|
+
The PGVector constructor now requires object parameters instead of a connection string. Object parameters align the API across storage adapters.
|
|
434
434
|
|
|
435
435
|
To migrate, pass the connection string as an object property.
|
|
436
436
|
|
|
@@ -484,7 +484,7 @@ const pgStore = new PostgresStore({
|
|
|
484
484
|
|
|
485
485
|
### Score storage methods to `listScoresBy*` pattern
|
|
486
486
|
|
|
487
|
-
Score storage APIs have been renamed to follow the `listScoresBy*` pattern.
|
|
487
|
+
Score storage APIs have been renamed to follow the `listScoresBy*` pattern. The new names follow the broader API naming conventions.
|
|
488
488
|
|
|
489
489
|
To migrate, update method names from `getScores` to `listScoresByScorerId` and related variants.
|
|
490
490
|
|
|
@@ -500,7 +500,7 @@ To migrate, update method names from `getScores` to `listScoresByScorerId` and r
|
|
|
500
500
|
|
|
501
501
|
### Non-paginated storage functions
|
|
502
502
|
|
|
503
|
-
Non-paginated storage functions have been removed in favor of paginated versions. All list operations now use pagination, though you can fetch all records with `perPage: false`.
|
|
503
|
+
Non-paginated storage functions have been removed in favor of paginated versions. All list operations now use pagination, though you can fetch all records with `perPage: false`. Pagination aligns list operations across the API and prevents accidental loading of large datasets.
|
|
504
504
|
|
|
505
505
|
To migrate, use paginated methods via domain stores. For fetching all records, use `perPage: false`.
|
|
506
506
|
|
|
@@ -32,7 +32,7 @@ createTool({
|
|
|
32
32
|
|
|
33
33
|
### `createTool` context properties organization
|
|
34
34
|
|
|
35
|
-
Context properties in `createTool` are now organized into namespaces. Agent-specific properties are under `context.agent`, workflow-specific properties are under `context.workflow`, and MCP-specific properties are under `context.mcp`.
|
|
35
|
+
Context properties in `createTool` are now organized into namespaces. Agent-specific properties are under `context.agent`, workflow-specific properties are under `context.workflow`, and MCP-specific properties are under `context.mcp`. The namespaces organize these properties under a clearer API surface.
|
|
36
36
|
|
|
37
37
|
For tools that are executed inside an agent, access agent-specific properties through `context.agent`.
|
|
38
38
|
|
|
@@ -78,7 +78,7 @@ Force-flushes any buffered LLM Observability data to Datadog without shutting do
|
|
|
78
78
|
async shutdown(): Promise<void>
|
|
79
79
|
```
|
|
80
80
|
|
|
81
|
-
Force-finishes any APM spans that weren't properly closed
|
|
81
|
+
Force-finishes any APM spans that weren't properly closed and flushes pending LLM Observability data. It then disables the integration and clears all internal state.
|
|
82
82
|
|
|
83
83
|
## Usage examples
|
|
84
84
|
|
|
@@ -146,7 +146,7 @@ Tags are stored as a JSON-stringified array in the `mastra.tags` span attribute:
|
|
|
146
146
|
}
|
|
147
147
|
```
|
|
148
148
|
|
|
149
|
-
|
|
149
|
+
The format is compatible with all OTEL-compatible backends and collectors.
|
|
150
150
|
|
|
151
151
|
## Related
|
|
152
152
|
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
# ArizeExporter
|
|
4
4
|
|
|
5
|
-
Sends Tracing data to Arize Phoenix
|
|
5
|
+
Sends Tracing data to Arize Phoenix or Arize AX, as well as any OpenTelemetry-compatible observability platform that supports OpenInference semantic conventions.
|
|
6
6
|
|
|
7
7
|
## Constructor
|
|
8
8
|
|
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
|
|
5
5
|
**Added in:** `@mastra/observability@1.8.0`. **Deprecated in `1.12.0`** in favor of [`MastraPlatformExporter`](https://mastra.ai/reference/observability/tracing/exporters/mastra-platform-exporter).
|
|
6
6
|
|
|
7
|
-
> **Deprecated:** `CloudExporter` is retained for backward compatibility and will be removed in a future major version. Use [`MastraPlatformExporter`](https://mastra.ai/reference/observability/tracing/exporters/mastra-platform-exporter) for new projects. Both classes share the same constructor, environment variables, and runtime behavior
|
|
7
|
+
> **Deprecated:** `CloudExporter` is retained for backward compatibility and will be removed in a future major version. Use [`MastraPlatformExporter`](https://mastra.ai/reference/observability/tracing/exporters/mastra-platform-exporter) for new projects. Both classes share the same constructor, environment variables, and runtime behavior. `CloudExporter` keeps its original `mastra-cloud-observability-exporter` exporter `name` and `CLOUD_EXPORTER_*` error IDs so monitoring rules built against it keep working.
|
|
8
8
|
|
|
9
9
|
Sends tracing spans, logs, metrics, scores, and feedback to the Mastra platform for online visualization and monitoring.
|
|
10
10
|
|
|
@@ -183,7 +183,7 @@ The exporter batches tracing spans, logs, metrics, scores, and feedback for effi
|
|
|
183
183
|
### Signal Processing
|
|
184
184
|
|
|
185
185
|
- `exportTracingEvent()` only exports `SPAN_ENDED` tracing events
|
|
186
|
-
- `onLogEvent()`, `onMetricEvent()`, `onScoreEvent()`, and `onFeedbackEvent()` buffer every event they receive for
|
|
186
|
+
- `onLogEvent()`, `onMetricEvent()`, `onScoreEvent()`, and `onFeedbackEvent()` buffer every event they receive for that signal type
|
|
187
187
|
- All supported signal batches are uploaded to their matching Cloud publish endpoints during `flush()` and `shutdown()`
|
|
188
188
|
|
|
189
189
|
## `MastraCloudSpanRecord`
|
|
@@ -199,7 +199,7 @@ The probe timer doesn't keep the Node.js process alive, so short-lived and serve
|
|
|
199
199
|
### Signal Processing
|
|
200
200
|
|
|
201
201
|
- `exportTracingEvent()` only exports `SPAN_ENDED` tracing events
|
|
202
|
-
- `onLogEvent()`, `onMetricEvent()`, `onScoreEvent()`, and `onFeedbackEvent()` buffer every event they receive for
|
|
202
|
+
- `onLogEvent()`, `onMetricEvent()`, `onScoreEvent()`, and `onFeedbackEvent()` buffer every event they receive for that signal type
|
|
203
203
|
- All supported signal batches are uploaded to their matching publish endpoints during `flush()` and `shutdown()`
|
|
204
204
|
|
|
205
205
|
## Span wire format
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
# OtelExporter
|
|
4
4
|
|
|
5
|
-
Sends traces and logs to any OpenTelemetry-compatible observability platform. Traces use the standardized GenAI semantic conventions
|
|
5
|
+
Sends traces and logs to any OpenTelemetry-compatible observability platform. Traces use the standardized GenAI semantic conventions. Logs carry their original severity and message body and are correlated to traces via both the OTEL log record's native trace context and `mastra.traceId` / `mastra.spanId` attributes.
|
|
6
6
|
|
|
7
7
|
## Constructor
|
|
8
8
|
|
|
@@ -51,7 +51,7 @@ Force flushes any pending spans to Sentry without shutting down the exporter. Wa
|
|
|
51
51
|
async shutdown(): Promise<void>
|
|
52
52
|
```
|
|
53
53
|
|
|
54
|
-
Ends all active spans
|
|
54
|
+
Ends all active spans and clears internal state before closing the Sentry connection. Waits up to 2 seconds for pending data to be sent.
|
|
55
55
|
|
|
56
56
|
## Usage
|
|
57
57
|
|