@mastra/mcp-docs-server 1.2.26 → 1.2.27-alpha.1
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/harness/durable-agents.md +27 -2
- package/.docs/integrations/observability/opentelemetry.md +14 -6
- package/.docs/models/index.md +1 -1
- package/.docs/models/providers/nano-gpt.md +1 -2
- package/.docs/reference/agents/durable-agent.md +9 -1
- package/.docs/reference/agents/inngest-agent.md +2 -0
- package/.docs/reference/core/mastra-class.md +1 -1
- package/package.json +5 -5
|
@@ -134,7 +134,7 @@ await mastraClient.createStoredAgent({
|
|
|
134
134
|
})
|
|
135
135
|
```
|
|
136
136
|
|
|
137
|
-
`durable` also accepts `{ maxSteps, cleanupTimeoutMs }`. Cache and pubsub are inherited from the server's `Mastra` instance, so configure distributed backends there if you need durability across replicas. Automatic recovery is still configured in code through `recovery.durableAgents`.
|
|
137
|
+
`durable` also accepts `{ maxSteps, cleanupTimeoutMs }`. Only serializable options are accepted here, so snapshot persistence for API-created agents follows the server's `recovery.durableAgents` setting. Cache and pubsub are inherited from the server's `Mastra` instance, so configure distributed backends there if you need durability across replicas. Automatic recovery is still configured in code through `recovery.durableAgents`.
|
|
138
138
|
|
|
139
139
|
### Inngest-powered with `createInngestAgent()`
|
|
140
140
|
|
|
@@ -254,10 +254,33 @@ await durableAgent.resume(runId, { approved: true })
|
|
|
254
254
|
|
|
255
255
|
## Crash recovery
|
|
256
256
|
|
|
257
|
-
|
|
257
|
+
Durable agents can checkpoint each run's state to storage while it executes. If the server process crashes mid-run, the run remains in `running` status in storage with no automatic retry, and on the next server start you can re-drive these orphaned runs so they pick up where they left off. For orderly shutdowns such as rolling deploys, the generated server can also drain in-flight turns before exiting. See [graceful shutdown and rolling deploys](https://mastra.ai/docs/deployment/mastra-server).
|
|
258
|
+
|
|
259
|
+
Under the default persistence policy, these `running` checkpoints are only written when crash recovery is enabled. With `recovery.durableAgents: 'off'` (the default), durable agents persist snapshots only for `pending`, `paused`, and `suspended` runs (the artifacts human-in-the-loop resume depends on) and skip the per-step `running` writes entirely. A custom `shouldPersistSnapshot` predicate can keep `running` checkpoints even with recovery off. See [snapshot persistence](#snapshot-persistence) for the full policy and how to override it.
|
|
258
260
|
|
|
259
261
|
Durable agent runs are excluded from the generic boot-time restart of active workflow runs. The only automatic recovery path for durable agent runs is `recovery.durableAgents: 'auto'`, which holds a recovery lease and registers thread runtimes before re-driving each run.
|
|
260
262
|
|
|
263
|
+
### Snapshot persistence
|
|
264
|
+
|
|
265
|
+
The `shouldPersistSnapshot` option on `createDurableAgent()` (also accepted in the agent-level `durable` config) controls which workflow snapshots a durable agent writes. The default policy:
|
|
266
|
+
|
|
267
|
+
- Always persists `pending`, `paused`, and `suspended` snapshots. These are what `resume()` and tool approval read, so human-in-the-loop flows work without configuration.
|
|
268
|
+
- Persists `running` checkpoints only when `recovery.durableAgents` is `'auto'`. These per-step writes exist solely to make in-flight runs recoverable after a crash, so they're skipped when nothing consumes them.
|
|
269
|
+
|
|
270
|
+
To keep crash-recovery checkpoints without enabling automatic recovery (for example, when you call `recoverActiveRuns()` yourself behind a leader election), pass a predicate that includes `running`:
|
|
271
|
+
|
|
272
|
+
```typescript
|
|
273
|
+
export const durableResearcher = createDurableAgent({
|
|
274
|
+
agent,
|
|
275
|
+
shouldPersistSnapshot: ({ workflowStatus }) =>
|
|
276
|
+
['pending', 'paused', 'suspended', 'running'].includes(workflowStatus),
|
|
277
|
+
})
|
|
278
|
+
```
|
|
279
|
+
|
|
280
|
+
Mastra logs a warning when a custom predicate excludes `suspended` or `paused`, which breaks human-in-the-loop resume, or excludes `running` while `recovery.durableAgents` is `'auto'`, which makes the agent invisible to automatic recovery.
|
|
281
|
+
|
|
282
|
+
Evented agents always persist the full snapshot set: the evented engine coordinates workers through storage, so the `running` row is part of its execution model. Inngest agents always persist only `suspended` snapshots, because Inngest's own replay provides durability. Both accept `shouldPersistSnapshot` for API symmetry but log a warning and ignore it.
|
|
283
|
+
|
|
261
284
|
### Automatic recovery
|
|
262
285
|
|
|
263
286
|
Set `recovery.durableAgents` to `'auto'` in the Mastra config. The deployer calls `recoverAllDurableAgents()` on boot, right after restarting active workflow runs:
|
|
@@ -290,6 +313,8 @@ const agentResult = await durableAgent.recoverActiveRuns()
|
|
|
290
313
|
await durableAgent.recoverActiveRuns({ runId: 'run-abc-123' })
|
|
291
314
|
```
|
|
292
315
|
|
|
316
|
+
Manual recovery reads the same `running` checkpoints as automatic recovery. If `recovery.durableAgents` is `'off'` and you haven't set a custom `shouldPersistSnapshot` that includes `running`, in-flight runs are never checkpointed, so `listActiveRuns()` and `recoverActiveRuns()` find nothing after a crash. See [snapshot persistence](#snapshot-persistence).
|
|
317
|
+
|
|
293
318
|
### Multi-instance deployments
|
|
294
319
|
|
|
295
320
|
Mastra doesn't provide a distributed lease or lock yet. In multi-replica deployments, every replica that starts with `recovery.durableAgents: 'auto'` will race to recover the same runs. For now, either gate recovery behind your own leader election or run it from a single replica.
|
|
@@ -571,11 +571,14 @@ The exporter follows [OpenTelemetry Semantic Conventions for GenAI v1.38.0](http
|
|
|
571
571
|
|
|
572
572
|
#### Span Naming
|
|
573
573
|
|
|
574
|
-
- **
|
|
574
|
+
- **Model calls**: `chat {model}`
|
|
575
|
+
- **Generation loop**: `model_generation {model}`, with one `agent_step {agent_id}` per turn
|
|
575
576
|
- **Tool Execution**: `execute_tool {tool_name}`
|
|
576
577
|
- **Agent Runs**: `invoke_agent {agent_id}`
|
|
577
578
|
- **Workflow Runs**: `invoke_workflow {workflow_id}`
|
|
578
579
|
|
|
580
|
+
Each agent turn calls the model once. The `chat` span is that call and is the only span that carries `gen_ai.request.model`, the messages, and `gen_ai.usage.*`, so backends that sum usage across spans count each call once. The `model_generation` span wraps the whole loop and `agent_step` wraps one turn (model call plus tool execution); neither carries usage.
|
|
581
|
+
|
|
579
582
|
#### Key Attributes
|
|
580
583
|
|
|
581
584
|
- `gen_ai.operation.name` - Operation type (chat, tool.execute, etc.)
|
|
@@ -805,10 +808,13 @@ With the `OtelBridge`, your traces maintain proper hierarchy across OTEL and Mas
|
|
|
805
808
|
```text
|
|
806
809
|
HTTP POST /api/chat (from Hono middleware)
|
|
807
810
|
└── agent.assistant (from Mastra via OtelBridge)
|
|
808
|
-
|
|
809
|
-
|
|
810
|
-
|
|
811
|
-
|
|
811
|
+
└── model_generation gpt-5 (generation loop)
|
|
812
|
+
├── agent_step assistant (turn 1)
|
|
813
|
+
│ ├── chat gpt-5 (LLM call)
|
|
814
|
+
│ └── execute_tool search (tool execution)
|
|
815
|
+
│ └── HTTP GET api.example.com (from OTEL auto-instrumentation)
|
|
816
|
+
└── agent_step assistant (turn 2)
|
|
817
|
+
└── chat gpt-5 (follow-up LLM call)
|
|
812
818
|
```
|
|
813
819
|
|
|
814
820
|
### Multi-service distributed tracing
|
|
@@ -821,7 +827,9 @@ Service A: HTTP POST /api/process
|
|
|
821
827
|
|
|
822
828
|
Service B: HTTP POST /api/analyze (incoming call - same trace!)
|
|
823
829
|
└── agent.analyzer (Mastra agent inherits trace context)
|
|
824
|
-
└──
|
|
830
|
+
└── model_generation gpt-5
|
|
831
|
+
└── agent_step analyzer
|
|
832
|
+
└── chat gpt-5
|
|
825
833
|
```
|
|
826
834
|
|
|
827
835
|
Both services must have:
|
package/.docs/models/index.md
CHANGED
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
|
|
5
5
|
# Model Providers
|
|
6
6
|
|
|
7
|
-
Mastra provides a unified interface for working with LLMs across multiple providers, giving you access to
|
|
7
|
+
Mastra provides a unified interface for working with LLMs across multiple providers, giving you access to 7314 models from 204 providers through a single API.
|
|
8
8
|
|
|
9
9
|
## Features
|
|
10
10
|
|
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
|
|
5
5
|
# NanoGPT
|
|
6
6
|
|
|
7
|
-
Access
|
|
7
|
+
Access 579 NanoGPT models through Mastra's model router. Authentication is handled automatically using the `NANO_GPT_API_KEY` environment variable.
|
|
8
8
|
|
|
9
9
|
Learn more in the [NanoGPT documentation](https://docs.nano-gpt.com).
|
|
10
10
|
|
|
@@ -113,7 +113,6 @@ for await (const chunk of stream) {
|
|
|
113
113
|
| `nano-gpt/claw-medium` | 1.0M | | | | | | $1 | $3 |
|
|
114
114
|
| `nano-gpt/cohere/command-r-plus-08-2024` | 128K | | | | | | $3 | $14 |
|
|
115
115
|
| `nano-gpt/command-a-reasoning-08-2025` | 256K | | | | | | $3 | $10 |
|
|
116
|
-
| `nano-gpt/deepclaude` | 128K | | | | | | $3 | $15 |
|
|
117
116
|
| `nano-gpt/deepcogito/cogito-v1-preview-qwen-32B` | 128K | | | | | | $2 | $2 |
|
|
118
117
|
| `nano-gpt/deepseek-ai/DeepSeek-R1-0528` | 164K | | | | | | $0.40 | $2 |
|
|
119
118
|
| `nano-gpt/deepseek-ai/DeepSeek-V3.1` | 128K | | | | | | $0.20 | $0.70 |
|
|
@@ -43,7 +43,7 @@ cleanup()
|
|
|
43
43
|
|
|
44
44
|
### Using the `durable` config flag
|
|
45
45
|
|
|
46
|
-
Set `durable: true` on `AgentConfig` and the agent is automatically wrapped with `createDurableAgent` when it's attached to a `Mastra` instance. Use an object to forward advanced options such as `cache`, `pubsub`, `maxSteps`, `cleanupTimeoutMs`, or `
|
|
46
|
+
Set `durable: true` on `AgentConfig` and the agent is automatically wrapped with `createDurableAgent` when it's attached to a `Mastra` instance. Use an object to forward advanced options such as `cache`, `pubsub`, `maxSteps`, `cleanupTimeoutMs`, `shouldCache`, or `shouldPersistSnapshot`.
|
|
47
47
|
|
|
48
48
|
```typescript
|
|
49
49
|
import { Mastra } from '@mastra/core'
|
|
@@ -92,6 +92,8 @@ Returns: `DurableAgent`
|
|
|
92
92
|
|
|
93
93
|
**shouldCache** (`(topic: string) => boolean`): Per-topic opt-out of the replay cache. Return false to publish a topic straight to the underlying PubSub without recording it; subscribers of that topic receive live events only and cannot resume from an offset. Useful for trading replay for minimum publish latency on hot topics when the cache is remote (for example, cross-region Redis). Run-local topics are always excluded, regardless of this option.
|
|
94
94
|
|
|
95
|
+
**shouldPersistSnapshot** (`(params: { stepResults, workflowStatus }) => boolean`): Predicate controlling which workflow snapshots the durable run persists. The default always persists pending, paused, and suspended (required for human-in-the-loop resume) and persists running checkpoints only when the Mastra instance is configured with recovery.durableAgents: 'auto'. Pass a predicate that includes running to keep crash-recovery checkpoints for manual listActiveRuns() / recoverActiveRuns() without enabling automatic recovery. Mastra logs a warning when a predicate excludes suspended or paused, or excludes running while recovery.durableAgents is 'auto'.
|
|
96
|
+
|
|
95
97
|
## `createEventedAgent(options)`
|
|
96
98
|
|
|
97
99
|
Wraps an `Agent` with fire-and-forget durable execution on the built-in workflow engine. Like `createDurableAgent`, it returns a result you stream from, but the underlying workflow runs non-blocking (via `startAsync`) instead of running to completion before the stream is wired up. Use it when you want the run to progress independently of the caller. It doesn't accept `id` or `name` overrides.
|
|
@@ -116,6 +118,8 @@ Returns: `EventedAgent` (a subclass of `DurableAgent`)
|
|
|
116
118
|
|
|
117
119
|
**shouldCache** (`(topic: string) => boolean`): Per-topic opt-out of the replay cache. Return false to publish a topic straight to the underlying PubSub without recording it; subscribers of that topic receive live events only and cannot resume from an offset. Useful for trading replay for minimum publish latency on hot topics when the cache is remote (for example, cross-region Redis). Run-local topics are always excluded, regardless of this option.
|
|
118
120
|
|
|
121
|
+
**shouldPersistSnapshot** (`(params: { stepResults, workflowStatus }) => boolean`): Accepted for API symmetry with createDurableAgent, but ignored: the evented engine requires the full snapshot set (pending, paused, suspended, running) because the initial running write creates the base row that suspend-merges and multi-worker coordination build on. A warning is logged if set.
|
|
122
|
+
|
|
119
123
|
## Constructor parameters
|
|
120
124
|
|
|
121
125
|
The `DurableAgent` class accepts the same options as `createDurableAgent`, plus `cleanupTimeoutMs`. Prefer the factory unless you need to subclass.
|
|
@@ -134,6 +138,8 @@ The `DurableAgent` class accepts the same options as `createDurableAgent`, plus
|
|
|
134
138
|
|
|
135
139
|
**shouldCache** (`(topic: string) => boolean`): Per-topic opt-out of the replay cache. Return false to publish a topic straight to the underlying PubSub without recording it; subscribers of that topic receive live events only and cannot resume from an offset. Useful for trading replay for minimum publish latency on hot topics when the cache is remote (for example, cross-region Redis). Run-local topics are always excluded, regardless of this option.
|
|
136
140
|
|
|
141
|
+
**shouldPersistSnapshot** (`(params: { stepResults, workflowStatus }) => boolean`): Predicate controlling which workflow snapshots the durable run persists. The default always persists pending, paused, and suspended (required for human-in-the-loop resume) and persists running checkpoints only when the Mastra instance is configured with recovery.durableAgents: 'auto'.
|
|
142
|
+
|
|
137
143
|
**cleanupTimeoutMs** (`number`): Grace period in milliseconds before registry entries are cleaned up automatically after a stream finishes or errors. Set to 0 to disable auto-cleanup and require a manual cleanup() call. Auto-cleanup does not fire on suspended events. (Default: `30000`)
|
|
138
144
|
|
|
139
145
|
## Methods
|
|
@@ -260,6 +266,8 @@ Returns: `boolean`. `false` when this process has no active run recorded for the
|
|
|
260
266
|
|
|
261
267
|
Lists this agent's runs whose persisted snapshot is in `running` status: runs whose agentic loop was mid-execution when the workflow engine last saved state. On a live process they transition to `suspended` or a terminal status. After a crash or restart they stay `running` with nothing driving them, which is what `recoverActiveRuns()` re-drives. Runs started by other durable agents on the same storage aren't included.
|
|
262
268
|
|
|
269
|
+
`running` snapshots are only written when `recovery.durableAgents` is `'auto'` or a custom `shouldPersistSnapshot` includes `running`. Without one of those, this method returns no runs. See [snapshot persistence](https://mastra.ai/docs/harness/durable-agents).
|
|
270
|
+
|
|
263
271
|
```typescript
|
|
264
272
|
const { runs, total } = await durableAgent.listActiveRuns({ resourceId: 'user-1' })
|
|
265
273
|
|
|
@@ -83,6 +83,8 @@ Returns: [`InngestAgent`](#inngestagent-interface)
|
|
|
83
83
|
|
|
84
84
|
**mastra** (`Mastra`): Mastra instance for observability. Set automatically when the agent is registered with Mastra.
|
|
85
85
|
|
|
86
|
+
**shouldPersistSnapshot** (`(params: { stepResults, workflowStatus }) => boolean`): Accepted for API symmetry with createDurableAgent, but ignored: Inngest's step memoization and replay own durability, so InngestAgent always persists suspended snapshots only (for human-in-the-loop resume). A warning is logged if set.
|
|
87
|
+
|
|
86
88
|
## `InngestAgent` interface
|
|
87
89
|
|
|
88
90
|
The object returned by `createInngestAgent()`. It provides the durable execution methods below. Any property or method not explicitly defined (e.g., `listTools()` and `getMemory()`) is forwarded to the underlying agent via a Proxy. Thread APIs such as `sendSignal()`, `sendStateSignal()`, `sendNotificationSignal()`, and `subscribeToThread()` are forwarded too, but a signal that wakes an idle thread starts the run through the durable `stream()`.
|
|
@@ -131,7 +131,7 @@ Visit the [Configuration reference](https://mastra.ai/reference/configuration) f
|
|
|
131
131
|
|
|
132
132
|
**recovery** (`MastraRecoveryConfig`): Boot-time recovery behavior for orphaned agent and workflow runs. See Crash recovery. (Default: `{ durableAgents: 'off' }`)
|
|
133
133
|
|
|
134
|
-
**recovery.durableAgents** (`'auto' | 'off'`): Set to 'auto' to automatically re-drive orphaned RUNNING durable agent runs on server boot. Recovery re-issues LLM calls and re-executes tool calls, so tools must be idempotent. See Crash recovery.
|
|
134
|
+
**recovery.durableAgents** (`'auto' | 'off'`): Set to 'auto' to automatically re-drive orphaned RUNNING durable agent runs on server boot. This also controls the default snapshot-persistence policy for durable agents: running checkpoints are only written when set to 'auto' (or when an agent sets a custom shouldPersistSnapshot that includes running). Recovery re-issues LLM calls and re-executes tool calls, so tools must be idempotent. See Crash recovery.
|
|
135
135
|
|
|
136
136
|
## Methods
|
|
137
137
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@mastra/mcp-docs-server",
|
|
3
|
-
"version": "1.2.
|
|
3
|
+
"version": "1.2.27-alpha.1",
|
|
4
4
|
"description": "MCP server for accessing Mastra.ai documentation, changelogs, and news.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "dist/index.js",
|
|
@@ -27,8 +27,8 @@
|
|
|
27
27
|
"jsdom": "^26.1.0",
|
|
28
28
|
"local-pkg": "^1.1.2",
|
|
29
29
|
"zod": "^4.4.3",
|
|
30
|
-
"@mastra/
|
|
31
|
-
"@mastra/
|
|
30
|
+
"@mastra/core": "1.68.0-alpha.0",
|
|
31
|
+
"@mastra/mcp": "^1.18.0"
|
|
32
32
|
},
|
|
33
33
|
"devDependencies": {
|
|
34
34
|
"@hono/node-server": "^2.0.0",
|
|
@@ -44,9 +44,9 @@
|
|
|
44
44
|
"tsx": "^4.23.1",
|
|
45
45
|
"typescript": "^7.0.2",
|
|
46
46
|
"vitest": "4.1.10",
|
|
47
|
+
"@internal/lint": "0.0.133",
|
|
47
48
|
"@internal/types-builder": "0.0.108",
|
|
48
|
-
"@mastra/core": "1.
|
|
49
|
-
"@internal/lint": "0.0.133"
|
|
49
|
+
"@mastra/core": "1.68.0-alpha.0"
|
|
50
50
|
},
|
|
51
51
|
"homepage": "https://mastra.ai",
|
|
52
52
|
"repository": {
|