@mastra/mcp-docs-server 1.3.13-alpha.5 → 1.3.13-alpha.6
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/resumable-streams.md +3 -3
- package/.docs/docs/agents/tools.md +1 -0
- package/.docs/docs/deployment/mastra-server.md +10 -2
- package/.docs/docs/deployment/workers.md +3 -1
- package/.docs/docs/harness/durable-agents.md +64 -2
- package/.docs/docs/memory/semantic-recall.md +24 -1
- package/.docs/docs/sandbox/skills.md +32 -3
- package/.docs/docs/server/custom-adapters.md +40 -11
- package/.docs/docs/server/middleware.md +1 -1
- package/.docs/docs/workflows/overview.md +12 -0
- package/.docs/docs/workflows/suspend-and-resume.md +1 -1
- package/.docs/models/gateways/merge-gateway.md +2 -1
- package/.docs/models/gateways/netlify.md +4 -2
- package/.docs/models/gateways/openrouter.md +5 -3
- package/.docs/models/gateways/vercel.md +4 -1
- package/.docs/models/index.md +1 -1
- package/.docs/models/providers/anthropic.md +2 -1
- package/.docs/models/providers/chutes.md +5 -4
- package/.docs/models/providers/cloudflare-workers-ai.md +0 -13
- package/.docs/models/providers/deepinfra.md +2 -1
- package/.docs/models/providers/edenai.md +6 -7
- package/.docs/models/providers/google.md +2 -2
- package/.docs/models/providers/kilo.md +20 -18
- package/.docs/models/providers/llmgateway-providers.md +439 -433
- package/.docs/models/providers/llmgateway.md +4 -1
- package/.docs/models/providers/meta.md +5 -4
- package/.docs/models/providers/nano-gpt.md +27 -35
- package/.docs/models/providers/opencode-go.md +2 -2
- package/.docs/models/providers/opencode.md +8 -5
- package/.docs/models/providers/prime.md +4 -4
- package/.docs/models/providers/wandb.md +1 -1
- package/.docs/reference/agent-controller/session.md +1 -1
- package/.docs/reference/agents/channels.md +79 -0
- package/.docs/reference/agents/durable-agent.md +5 -3
- package/.docs/reference/build-with-ai.md +12 -2
- package/.docs/reference/code-sdk/mount-agent-controller.md +5 -1
- package/.docs/reference/connect/credential.md +2 -1
- package/.docs/reference/core/mastra-class.md +1 -1
- package/.docs/reference/file-based-agents/tools.md +3 -3
- package/.docs/reference/index.md +1 -0
- package/.docs/reference/memory/memory-class.md +1 -1
- package/.docs/reference/observability/tracing/exporters/mastra-platform-exporter.md +33 -0
- package/.docs/reference/observability/tracing/exporters/mastra-storage-exporter.md +26 -0
- package/.docs/reference/processors/processor-interface.md +1 -1
- package/.docs/reference/processors/semantic-recall-processor.md +5 -3
- package/.docs/reference/processors/skill-search-processor.md +3 -0
- package/.docs/reference/processors/skills-processor.md +84 -0
- package/.docs/reference/pubsub/lease-provider.md +4 -2
- package/.docs/reference/pubsub/redis-streams.md +1 -1
- package/.docs/reference/rag/graph-rag.md +1 -1
- package/.docs/reference/streaming/agents/MastraModelOutput.md +7 -8
- package/.docs/reference/workers/overview.md +2 -2
- package/.docs/reference/workflows/run-methods/resume.md +1 -1
- package/.docs/reference/workflows/run.md +1 -1
- package/.docs/reference/workspace/factory-sandbox.md +7 -7
- package/.docs/reference/workspace/platform-sandbox.md +21 -6
- package/.docs/reference/workspace/workspace-class.md +5 -5
- package/package.json +4 -4
|
@@ -119,9 +119,9 @@ With streams on, a closed reader doesn't stop the run. When a client disconnects
|
|
|
119
119
|
|
|
120
120
|
Stop a run explicitly with one of these:
|
|
121
121
|
|
|
122
|
-
- `observe(runId)` returns an `abort()` function that asks a running run to stop wherever it executes. The request is best effort. It doesn't wait for confirmation, and a failed publish is only logged. Use the abort route below when you need confirmation. A run parked on an approval no longer listens for it, so stop a parked run with
|
|
123
|
-
- `agent.abortRunStream(runId)` stops a run in this process, and asks other processes on the same bus to stop it. It returns `true` for a running run stopped in this process. A run parked on an approval outside a memory thread is cancelled here too, but the call returns `false`. A later approval in this process fails. The cancellation fence is process-local and leaves the shared snapshot intact. Another process can still approve that snapshot. For a run elsewhere the request is best effort.
|
|
124
|
-
- The server's `POST /agents/:agentId/runs/:runId/abort` route stops a run on any server that shares the PubSub and cache, after checking the caller owns it. It returns `{ aborted: true }`
|
|
122
|
+
- `observe(runId)` returns an `abort()` function that asks a running run to stop wherever it executes. The request is best effort. It doesn't wait for confirmation, and a failed publish is only logged. Use the abort route below when you need confirmation. A run parked on an approval no longer listens for it, so stop a parked run with the abort route below, or with `POST /agents/:agentId/threads/abort` for a run in a memory thread.
|
|
123
|
+
- `agent.abortRunStream(runId)` stops a run in this process, and asks other processes on the same bus to stop it. It returns `true` for a running run stopped in this process. A run parked on an approval outside a memory thread is cancelled here too, but the call returns `false`. A later approval in this process fails. The cancellation fence is process-local and leaves the shared snapshot intact. Another process can still approve that snapshot, so use the abort route below to stop a parked run in an app with more than one server. For a run elsewhere the request is best effort.
|
|
124
|
+
- The server's `POST /agents/:agentId/runs/:runId/abort` route stops a run on any server that shares the PubSub and cache, after checking the caller owns it. It returns `{ aborted: true }` once the process executing the run confirms it stopped. For a run of a durable agent (`DurableAgent` or `createDurableAgent`, including evented agents) parked on an approval, the route also records the cancellation in storage and returns `{ aborted: true }` after that write is saved. A later approval or resume of that run is then refused with `409 Conflict` (`AGENT_RESUME_ABORTED_RUN`) on every server that shares the storage. If a resume claims the run first, no cancellation is recorded, and the route stops the resumed run like any running run. On storage adapters without concurrent updates, such as Redis, Valkey and LanceDB, an abort and an approval that arrive at the same moment aren't serialized, so an approval that overlaps the abort can still run its tool even though the abort returns `{ aborted: true }`. Wait for that response before relying on the recorded cancellation, which Inngest agents don't write. The route returns `{ aborted: false }` for a finished run, and when nothing stopped the run and no process answers in time. Runs in a memory thread can also be stopped with `POST /agents/:agentId/threads/abort`, but that route doesn't record the cancellation in storage, so use the run abort route to stop a parked durable run in an app with more than one server.
|
|
125
125
|
|
|
126
126
|
With `durable: false` on a non-durable agent, closing the HTTP request aborts the run, as before.
|
|
127
127
|
|
|
@@ -702,6 +702,7 @@ The [AgentController](https://mastra.ai/docs/harness/agent-controller) automatic
|
|
|
702
702
|
- [`createTool` reference](https://mastra.ai/reference/tools/create-tool)
|
|
703
703
|
- [`Agent.generate()` reference](https://mastra.ai/reference/agents/generate): Runtime options for tool selection, steps, and callbacks
|
|
704
704
|
- [Background tasks](https://mastra.ai/docs/harness/background-tasks): Run long-running tools without blocking the agent loop
|
|
705
|
+
- [Make tools safe to repeat](https://mastra.ai/docs/harness/durable-agents): Keep side effects from running twice in durable agents
|
|
705
706
|
- [MCP overview](https://mastra.ai/docs/connections/mcp)
|
|
706
707
|
- [Connect tools](https://mastra.ai/docs/mastra-platform/connect): Ready-made tools for providers connected to a Mastra platform project
|
|
707
708
|
- [Dynamic tool search](https://mastra.ai/reference/processors/tool-search-processor): Load tools on demand for agents with large tool libraries
|
|
@@ -149,7 +149,15 @@ To add your own endpoints, see [Custom API Routes](https://mastra.ai/docs/server
|
|
|
149
149
|
|
|
150
150
|
By default, the generated server handles `SIGINT` and `SIGTERM`. It stops accepting connections, waits up to [`server.drainTimeout`](https://mastra.ai/reference/configuration) for active requests and streams, then runs `mastra.shutdown()`. Shutdown gives in-flight workflow runs (including durable agent runs) the same drain window to finish before workers and pub/sub subscriptions are torn down. A durable agent run still executing after the window stops and releases its claim on the run, so the next boot can recover it right away. The drain timeout defaults to 5 seconds. A second signal terminates the process immediately. See [`server.handleShutdownSignals`](https://mastra.ai/reference/configuration) if you need to manage signals yourself.
|
|
151
151
|
|
|
152
|
-
|
|
152
|
+
Shutdown then hands back the agent thread runs the process still holds:
|
|
153
|
+
|
|
154
|
+
- A run still executing is aborted, so it starts no further steps. Clients watching the thread from other processes see it end, and its partial response isn't saved.
|
|
155
|
+
- A run waiting on a tool approval or suspension stays suspended and can be resumed from another process. A tool call from the same step that's still executing is aborted first, like a run still executing.
|
|
156
|
+
- The thread lease is released right away, so another process can start a run on the thread without waiting for the lease to expire. Release is best-effort: if an aborted run doesn't stop in time (for example, a tool call that ignores the abort), or the lease backend doesn't answer or fails the release, the lease is kept until it expires.
|
|
157
|
+
|
|
158
|
+
Handing runs back can take up to about 1.5 seconds past the drain timeout.
|
|
159
|
+
|
|
160
|
+
Increase `drainTimeout` when your hosting platform's termination grace period can accommodate longer turns. The HTTP drain and the workflow drain run one after the other, so keep enough time for both, plus about 1.5 seconds to hand back thread runs, plus shutdown cleanup.
|
|
153
161
|
|
|
154
162
|
If you call `mastra.shutdown()` yourself, pass `drainTimeout` to control how long it waits for in-flight workflow runs:
|
|
155
163
|
|
|
@@ -167,7 +175,7 @@ export const mastra = new Mastra({
|
|
|
167
175
|
})
|
|
168
176
|
```
|
|
169
177
|
|
|
170
|
-
A plain `agent.stream()` call can't resume after its server process exits. If a stream ends without its expected terminal event, treat the turn as interrupted and let the client retry or reconcile it. Use [durable agents](https://mastra.ai/docs/harness/durable-agents) when turns must survive process replacement. [Crash recovery](https://mastra.ai/docs/harness/durable-agents) requires shared persistent run storage and idempotent tools. Replaying missed events after a restart also requires a shared persistent cache such as Redis because the default event cache is in-memory. Recovering from multiple replicas requires a storage adapter that supports run fencing or a PubSub backend whose lease every replica shares. See [multi-instance deployments](https://mastra.ai/docs/harness/durable-agents).
|
|
178
|
+
A plain `agent.stream()` call can't resume after its server process exits. If a stream ends without its expected terminal event, treat the turn as interrupted and let the client retry or reconcile it. Use [durable agents](https://mastra.ai/docs/harness/durable-agents) when turns must survive process replacement. [Crash recovery](https://mastra.ai/docs/harness/durable-agents) requires shared persistent run storage and [idempotent tools](https://mastra.ai/docs/harness/durable-agents). Replaying missed events after a restart also requires a shared persistent cache such as Redis because the default event cache is in-memory. Recovering from multiple replicas requires a storage adapter that supports run fencing or a PubSub backend whose lease every replica shares. See [multi-instance deployments](https://mastra.ai/docs/harness/durable-agents).
|
|
171
179
|
|
|
172
180
|
## Troubleshooting
|
|
173
181
|
|
|
@@ -382,7 +382,9 @@ Worker build artifacts expose `GET /health` on `PORT`, or port `4111` when `PORT
|
|
|
382
382
|
|
|
383
383
|
### Crash recovery
|
|
384
384
|
|
|
385
|
-
A distributed PubSub backend persists unacknowledged events, which lets orchestration and background task workers resume after a restart. When the API is unavailable, a failed step-execution request causes the event to be delivered again.
|
|
385
|
+
A distributed PubSub backend persists unacknowledged events, which lets orchestration and background task workers resume after a restart. When the API is unavailable, a failed step-execution request causes the event to be delivered again.
|
|
386
|
+
|
|
387
|
+
A step can run more than once. If a worker stops during a step, or after the step finishes but before it publishes the result, the step runs again when its event is redelivered. Make steps with side effects idempotent. See [restarting active workflow runs](https://mastra.ai/docs/workflows/overview) for how to build an idempotency key for a step, and [make tools safe to repeat](https://mastra.ai/docs/harness/durable-agents) for agent tools.
|
|
386
388
|
|
|
387
389
|
The scheduler calculates the next fire time from the current time after it restarts. It doesn't replay schedules that elapsed while it was unavailable.
|
|
388
390
|
|
|
@@ -284,7 +284,7 @@ Under the default persistence policy, these `running` checkpoints are written wh
|
|
|
284
284
|
|
|
285
285
|
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 claims each orphaned run and registers its thread runtimes before re-driving it. See [run ownership](#run-ownership).
|
|
286
286
|
|
|
287
|
-
> **Warning:** Automatic and manual recovery
|
|
287
|
+
> **Warning:** Automatic and manual recovery continue the run from the last persisted snapshot. Any tool call whose result isn't in that snapshot runs again. Any model response that wasn't saved is requested again, and the model provider bills it again. Make tools idempotent before you rely on recovery. See [make tools safe to repeat](#make-tools-safe-to-repeat).
|
|
288
288
|
|
|
289
289
|
Delegation hooks passed per call are closures and can't be restored in a new process. A resumed run falls back to default delegation behavior. Hooks configured on the supervisor's `defaultOptions.delegation` are merged back in when recovery rebuilds the delegation tools. Put hooks that must survive a restart there instead of passing them to `stream()` or `generate()`.
|
|
290
290
|
|
|
@@ -407,12 +407,74 @@ Durable and evented agents request cancellation of in-flight tool and model call
|
|
|
407
407
|
|
|
408
408
|
Cancellation is cooperative. Use the tool execution context's `abortSignal` for cancellable operations, and check it before starting another side effect. A tool that ignores the signal can keep running. Work already completed outside Mastra isn't rolled back.
|
|
409
409
|
|
|
410
|
-
Recovery can start the same tool call before the
|
|
410
|
+
Recovery can start the same tool call before the previous execution detects ownership loss, so cancellation reduces overlapping work but doesn't stop a tool from running twice. See [make tools safe to repeat](#make-tools-safe-to-repeat).
|
|
411
411
|
|
|
412
412
|
### Multi-instance deployments
|
|
413
413
|
|
|
414
414
|
Every replica can start with `recovery.durableAgents: 'auto'`. Replicas that boot together race to recover the same orphaned runs, but only one claim succeeds per run and the other replicas skip it. This requires a claim that every replica shares: a workflows store that supports run fencing, or a PubSub backend whose lease every replica shares. Without either, gate recovery behind your own leader election or run it from a single replica.
|
|
415
415
|
|
|
416
|
+
## Make tools safe to repeat
|
|
417
|
+
|
|
418
|
+
A durable or evented agent can run the same tool call more than once. A tool call is one request from the model to run a tool. A repeat happens in these situations:
|
|
419
|
+
|
|
420
|
+
- The process stops while the tool runs, or after the tool returns but before Mastra saves its result. When the run is [recovered](#crash-recovery), the tool runs again.
|
|
421
|
+
- With Postgres storage and Redis Streams PubSub, an evented worker stops before it publishes the tool's result. Another worker [reclaims the step](https://mastra.ai/reference/pubsub/redis-streams) and runs the tool again.
|
|
422
|
+
- Recovery takes over a run while the previous execution is still running the tool, for example with [`recover()` and `force: true`](#manual-recovery). Both executions can run the tool concurrently. See [stop work after ownership loss](#stop-work-after-ownership-loss).
|
|
423
|
+
|
|
424
|
+
[Inngest agents](#inngest-powered-with-createinngestagent) configured with `retries` also run an interrupted tool step again.
|
|
425
|
+
|
|
426
|
+
Mastra can't undo work a tool already did in another system. A tool that sends an email, charges a card, or deletes a record can do it twice. Make these tools idempotent. An idempotent tool has no additional effect when it runs a second time for the same call.
|
|
427
|
+
|
|
428
|
+
### Use the tool call ID as an idempotency key
|
|
429
|
+
|
|
430
|
+
When an agent runs a tool, `context.agent.toolCallId` identifies the tool call. Mastra saves the model's response before it runs any tool in that response, so a tool that runs again for the same call receives the same `toolCallId`.
|
|
431
|
+
|
|
432
|
+
Pass the ID to services that accept an idempotency key. This tool refunds a Stripe payment and sends the tool call ID as Stripe's [idempotency key](https://docs.stripe.com/api/idempotent_requests). When the tool runs again for the same call, Stripe returns the first refund instead of creating a second one:
|
|
433
|
+
|
|
434
|
+
```typescript
|
|
435
|
+
import { createTool } from '@mastra/core/tools'
|
|
436
|
+
import Stripe from 'stripe'
|
|
437
|
+
import { z } from 'zod'
|
|
438
|
+
|
|
439
|
+
const stripe = new Stripe(process.env.STRIPE_SECRET_KEY!)
|
|
440
|
+
|
|
441
|
+
export const refundPayment = createTool({
|
|
442
|
+
id: 'refund-payment',
|
|
443
|
+
description: 'Refunds a customer payment',
|
|
444
|
+
inputSchema: z.object({
|
|
445
|
+
paymentIntentId: z.string(),
|
|
446
|
+
}),
|
|
447
|
+
outputSchema: z.object({
|
|
448
|
+
refundId: z.string(),
|
|
449
|
+
status: z.string().nullable(),
|
|
450
|
+
}),
|
|
451
|
+
execute: async ({ paymentIntentId }, context) => {
|
|
452
|
+
const toolCallId = context.agent?.toolCallId
|
|
453
|
+
if (!toolCallId) throw new Error('refund-payment must be called by an agent')
|
|
454
|
+
|
|
455
|
+
const refund = await stripe.refunds.create(
|
|
456
|
+
{ payment_intent: paymentIntentId },
|
|
457
|
+
{ idempotencyKey: `refund-payment:${paymentIntentId}:${toolCallId}` },
|
|
458
|
+
)
|
|
459
|
+
|
|
460
|
+
return { refundId: refund.id, status: refund.status }
|
|
461
|
+
},
|
|
462
|
+
})
|
|
463
|
+
```
|
|
464
|
+
|
|
465
|
+
`context.agent` is only set when an agent runs the tool, which is why the example checks for it. The tool call ID comes from the model provider, and some providers reuse IDs across responses. Adding the payment ID keeps two different refunds from sharing a key. Stripe can remove an idempotency key once it's 24 hours old, so a run recovered after that can create a second refund.
|
|
466
|
+
|
|
467
|
+
If a service doesn't accept idempotency keys, build the key the same way and record it together with the change:
|
|
468
|
+
|
|
469
|
+
- In a database, write the key to a column with a unique constraint in the same transaction as the change, and skip the change when the key already exists, for example with `INSERT ... ON CONFLICT DO NOTHING` in Postgres. Store the tool's result with the key so a repeated call can return the same result to the model.
|
|
470
|
+
- With other services, attach the key to the request and check for it before you perform the action, for example by searching for an email that carries the key in a header. When executions overlap, each one can pass this check before the other sends its request.
|
|
471
|
+
|
|
472
|
+
### Protect tools inside subagents
|
|
473
|
+
|
|
474
|
+
A [subagent](https://mastra.ai/docs/subagents) delegation is one `agent-<name>` tool call. Recovery doesn't save the model and tool calls inside it, so when the delegation runs again, the subagent starts over and its tools receive new `toolCallId` values. A key built from the tool call ID doesn't detect these repeats.
|
|
475
|
+
|
|
476
|
+
For tools a subagent uses, build the key from data that identifies the intended effect. For a refund, that could be the payment ID combined with an order line ID from the tool's input. Avoid a key that would also block a legitimate second action, such as a key built from the payment ID alone when partial refunds are allowed.
|
|
477
|
+
|
|
416
478
|
## Related
|
|
417
479
|
|
|
418
480
|
- [DurableAgent reference](https://mastra.ai/reference/agents/durable-agent)
|
|
@@ -246,6 +246,29 @@ const options = {
|
|
|
246
246
|
}
|
|
247
247
|
```
|
|
248
248
|
|
|
249
|
+
### Long messages
|
|
250
|
+
|
|
251
|
+
Embedding models accept a limited number of tokens per input. Memory splits longer messages into chunks and stores each chunk as its own vector row, so every part of the message can be recalled. `maxChunkChars` sets the largest chunk in characters:
|
|
252
|
+
|
|
253
|
+
```typescript
|
|
254
|
+
const agent = new Agent({
|
|
255
|
+
id: 'agent',
|
|
256
|
+
memory: new Memory({
|
|
257
|
+
options: {
|
|
258
|
+
semanticRecall: { topK: 3, messageRange: 2, maxChunkChars: 6000 },
|
|
259
|
+
},
|
|
260
|
+
}),
|
|
261
|
+
})
|
|
262
|
+
```
|
|
263
|
+
|
|
264
|
+
The default is 16,384 characters, about 4,096 tokens of English text, which fits `openai/text-embedding-3-small` and its 8,191-token limit. The limit is in characters because each embedding provider uses its own tokenizer. Chinese, Japanese, and Korean text, and code, use more tokens per character than English, so lower `maxChunkChars` when that kind of text makes up most of your messages.
|
|
265
|
+
|
|
266
|
+
When you don't set `maxChunkChars` and the embedder declares its input limit, Memory derives the chunk size from that limit. [FastEmbed](#using-fastembed-local) models declare their 512-token window, so they need no configuration.
|
|
267
|
+
|
|
268
|
+
Each chunk row's ID comes from the message ID, so saving a message again replaces its rows. If you save a message again with shorter text through `memory.saveMessages()`, rows for chunks past the new end stay searchable until the message is updated with `memory.updateMessages()` or deleted.
|
|
269
|
+
|
|
270
|
+
Set `maxChunkChars` on the `Memory` constructor. Memory options passed per request, such as `memory.options` in `agent.stream()`, don't change it, so API callers can't force many small chunks.
|
|
271
|
+
|
|
249
272
|
## Server-side embeddings
|
|
250
273
|
|
|
251
274
|
Some vector stores generate the embeddings themselves. With one of those, semantic recall runs without an `embedder`: the database embeds each message on write and the search string on arrival. The embedding provider stays out of your application entirely.
|
|
@@ -407,7 +430,7 @@ Memory uses a single embedder for both storing and recalling messages, so pick o
|
|
|
407
430
|
|
|
408
431
|
Multilingual E5 produces 1024-dimensional vectors. Your vector index must be created with matching dimensions, and E5 vectors can't be mixed with vectors from another embedder in the same index.
|
|
409
432
|
|
|
410
|
-
FastEmbed models embed at most 512 tokens per input (roughly 2,000 to 2,500 characters of English text). Longer inputs are truncated, so text past the limit doesn't affect the embedding
|
|
433
|
+
FastEmbed models embed at most 512 tokens per input (roughly 2,000 to 2,500 characters of English text). Longer inputs are truncated, so text past the limit doesn't affect the embedding. Semantic recall sizes its message chunks to fit this window automatically (see [Long messages](#long-messages)). Outside of memory, the AI SDK v3 FastEmbed models return a warning when an input is truncated. The legacy v1 and v2 models don't. If you embed long documents with FastEmbed, chunk them to fit the window, for example with `maxSize: 1500` in `MDocument.chunk()`.
|
|
411
434
|
|
|
412
435
|
### Setting the embedding dimension
|
|
413
436
|
|
|
@@ -76,10 +76,35 @@ Mastra also gives the agent three tools:
|
|
|
76
76
|
| -------------- | ----------------------------------------------------------------------------------------- |
|
|
77
77
|
| `skill` | Loads a skill's `SKILL.md` instructions and lists its reference, script, and asset files. |
|
|
78
78
|
| `skill_read` | Reads all or part of any file under the selected skill directory. |
|
|
79
|
-
| `skill_search` | Searches skill instructions and reference files.
|
|
79
|
+
| `skill_search` | Searches skill names, descriptions, instructions, and reference files. |
|
|
80
80
|
|
|
81
81
|
Loading is stateless. The instructions remain in the conversation as a tool result, and the agent can call `skill` again if they leave the context after compaction.
|
|
82
82
|
|
|
83
|
+
### Turn off the skills list
|
|
84
|
+
|
|
85
|
+
With many skills, listing all of them in the system message costs tokens on every request. Add `SkillsProcessor` with `injectCatalog: false` to replace the list with a short instruction to find skills with `skill_search` and load them with `skill`:
|
|
86
|
+
|
|
87
|
+
```typescript
|
|
88
|
+
import { Agent } from '@mastra/core/agent'
|
|
89
|
+
import { SkillsProcessor } from '@mastra/core/processors'
|
|
90
|
+
import { workspace } from '../workspaces'
|
|
91
|
+
|
|
92
|
+
export const supportAgent = new Agent({
|
|
93
|
+
id: 'support-agent',
|
|
94
|
+
name: 'Support Agent',
|
|
95
|
+
instructions: 'You help customers with support requests.',
|
|
96
|
+
model: 'openai/gpt-6.1-sol',
|
|
97
|
+
workspace,
|
|
98
|
+
inputProcessors: [new SkillsProcessor({ injectCatalog: false })],
|
|
99
|
+
})
|
|
100
|
+
```
|
|
101
|
+
|
|
102
|
+
The agent keeps the `skill`, `skill_read`, and `skill_search` tools for both filesystem-backed and [agent skills](https://mastra.ai/docs/skills). `skill_search` works without any search setup: it matches query words against skill names, descriptions, and content. For larger collections, configure [BM25 or vector search](#search-skill-content) on the workspace to improve ranking. Agent skills are always indexed.
|
|
103
|
+
|
|
104
|
+
Keep the default list when you have a few dozen skills: the agent sees every option at once, and the list is a stable prefix that providers can cache. Turn it off when you have around a hundred skills or more, or when the size of the system message matters. The search instruction stays the same size however many skills you add.
|
|
105
|
+
|
|
106
|
+
[`SkillSearchProcessor`](https://mastra.ai/reference/processors/skill-search-processor) also hides the list, but replaces the standard tools with its own `search_skills` and `load_skill` tools and only covers workspace skills. Configure one or the other, not both: together, the agent gets both sets of tools. See the [`SkillsProcessor`](https://mastra.ai/reference/processors/skills-processor) reference for all options.
|
|
107
|
+
|
|
83
108
|
## Configure skill paths
|
|
84
109
|
|
|
85
110
|
The `skills` array accepts several path forms:
|
|
@@ -114,9 +139,13 @@ Direct [agent skills](https://mastra.ai/docs/skills) are resolved before filesys
|
|
|
114
139
|
|
|
115
140
|
## Search skill content
|
|
116
141
|
|
|
117
|
-
When [BM25 or vector search](https://mastra.ai/docs/sandbox/search) is configured alongside skills, Mastra automatically indexes each skill's `SKILL.md` instructions and reference files. Scripts and assets aren't indexed.
|
|
142
|
+
When [BM25 or vector search](https://mastra.ai/docs/sandbox/search) is configured alongside skills, Mastra automatically indexes each skill's name, description, `SKILL.md` instructions, and reference files. Scripts and assets aren't indexed.
|
|
143
|
+
|
|
144
|
+
Without BM25 or vector search, `skill_search` falls back to case-insensitive text matching across the name, description, instructions, and references. Results are ranked by how many query words they contain, and words found in a skill's name or description count more. This keeps skill search available without a separate search configuration, while indexed search provides ranking and semantic retrieval for larger collections.
|
|
145
|
+
|
|
146
|
+
A result from a reference file includes the file path, such as `references/style-guide.md`, so the agent can pass it to `skill_read`.
|
|
118
147
|
|
|
119
|
-
|
|
148
|
+
When the agent asks for a skill name that doesn't exist, `skill` and `skill_read` list every available skill if there are 20 or fewer. With more skills, they suggest up to five close matches and point the agent to `skill_search`, so a mistyped name doesn't add the whole skill list to the conversation.
|
|
120
149
|
|
|
121
150
|
## Dynamic skill paths
|
|
122
151
|
|
|
@@ -262,24 +262,38 @@ async sendResponse(
|
|
|
262
262
|
|
|
263
263
|
Handle streaming responses for agent generation. When an agent generates a response, it produces a stream of chunks that should be sent to the client as they become available. This method reads from the stream and optionally applies redaction to hide sensitive data before writing chunks to the response in the appropriate format (SSE or newline-delimited JSON).
|
|
264
264
|
|
|
265
|
+
Cancel the stream when the client disconnects. For agents with resumable streams, such as durable agents, the cancel is the only signal that the client left. Without it, the run isn't kept for replay and the server keeps reading a stream nobody receives. The client can also leave before your route handler returns, so a `close` listener added afterward never fires.
|
|
266
|
+
|
|
267
|
+
If your framework writes to a Node.js `ServerResponse`, use the helpers from `@mastra/server/server-adapter`:
|
|
268
|
+
|
|
269
|
+
- `cancelReaderOnResponseClose(reader, res)` cancels the reader when the response closes, or right away if it's already closed. Call `dispose()` before ending the response so a normal end doesn't cancel.
|
|
270
|
+
- `writeWithBackpressure(res, chunk)` waits for the client to catch up when the socket buffer is full, so a slow client doesn't make the server buffer the whole stream.
|
|
271
|
+
|
|
265
272
|
```typescript
|
|
273
|
+
import type { ServerResponse } from 'node:http';
|
|
274
|
+
import { cancelReaderOnResponseClose, writeWithBackpressure } from '@mastra/server/server-adapter';
|
|
275
|
+
|
|
266
276
|
async stream(
|
|
267
277
|
route: ServerRoute,
|
|
268
|
-
|
|
278
|
+
res: ServerResponse,
|
|
269
279
|
result: unknown
|
|
270
280
|
): Promise<unknown> {
|
|
271
281
|
const isSSE = route.streamFormat === 'sse';
|
|
272
282
|
|
|
273
283
|
// Set streaming headers based on format
|
|
274
|
-
|
|
275
|
-
|
|
284
|
+
res.setHeader('Content-Type', isSSE ? 'text/event-stream' : 'text/plain');
|
|
285
|
+
res.setHeader('Transfer-Encoding', 'chunked');
|
|
276
286
|
|
|
277
287
|
const reader = result.fullStream.getReader();
|
|
288
|
+
const readerCancel = cancelReaderOnResponseClose(reader, res);
|
|
278
289
|
|
|
279
290
|
try {
|
|
280
291
|
while (true) {
|
|
281
292
|
const { done, value } = await reader.read();
|
|
282
|
-
|
|
293
|
+
|
|
294
|
+
if (done) {
|
|
295
|
+
break;
|
|
296
|
+
}
|
|
283
297
|
|
|
284
298
|
// Apply redaction if enabled
|
|
285
299
|
const chunk = this.streamOptions.redact
|
|
@@ -288,24 +302,25 @@ async stream(
|
|
|
288
302
|
|
|
289
303
|
// Format based on stream format
|
|
290
304
|
if (isSSE) {
|
|
291
|
-
|
|
305
|
+
await writeWithBackpressure(res, `data: ${JSON.stringify(chunk)}\n\n`);
|
|
292
306
|
} else {
|
|
293
|
-
|
|
307
|
+
await writeWithBackpressure(res, JSON.stringify(chunk) + '\x1E');
|
|
294
308
|
}
|
|
295
309
|
}
|
|
296
310
|
|
|
297
311
|
// Send completion marker (SSE uses data: [DONE], other formats use record separator)
|
|
298
312
|
if (isSSE) {
|
|
299
|
-
|
|
313
|
+
await writeWithBackpressure(res, 'data: [DONE]\n\n');
|
|
300
314
|
}
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
throw error;
|
|
315
|
+
} finally {
|
|
316
|
+
readerCancel.dispose();
|
|
317
|
+
res.end();
|
|
305
318
|
}
|
|
306
319
|
}
|
|
307
320
|
```
|
|
308
321
|
|
|
322
|
+
If your framework returns a fetch `Response` instead, wrap the stream in a `ReadableStream` that reads one chunk per `pull()` and cancels the reader in its `cancel()`. Also cancel the reader when the request's `abortSignal` aborts: some runtimes never read or cancel the body of a request that closed while the route handler ran.
|
|
323
|
+
|
|
309
324
|
## Helper methods
|
|
310
325
|
|
|
311
326
|
The base class provides helper methods you can use in your implementation. These handle common tasks like parameter validation and route registration, so you don't need to reimplement them:
|
|
@@ -468,6 +483,20 @@ createRouteAdapterTestSuite({
|
|
|
468
483
|
})
|
|
469
484
|
```
|
|
470
485
|
|
|
486
|
+
Run the stream disconnect suite to check that your adapter cancels a route's stream when the client disconnects and waits for a slow client. `startServer` serves the route over real HTTP and returns its URL. When the suite passes `beforeContext`, run it as async middleware before your context middleware:
|
|
487
|
+
|
|
488
|
+
```typescript
|
|
489
|
+
import { createStreamDisconnectTestSuite } from '@mastra/server-adapters-test-suite'
|
|
490
|
+
import { startMyFrameworkServer } from './adapter-test-helpers'
|
|
491
|
+
|
|
492
|
+
createStreamDisconnectTestSuite({
|
|
493
|
+
startServer: async (route, { beforeContext } = {}) => {
|
|
494
|
+
const { url, close } = await startMyFrameworkServer(route, { beforeContext })
|
|
495
|
+
return { url, close }
|
|
496
|
+
},
|
|
497
|
+
})
|
|
498
|
+
```
|
|
499
|
+
|
|
471
500
|
The package also provides root exports for Model Context Protocol (MCP), multipart request, HTTP logging, and body limit tests. See the [package README](https://github.com/mastra-ai/mastra/tree/main/server-adapters/server-adapters-test-suite) for the supported peer dependency versions.
|
|
472
501
|
|
|
473
502
|
> **Tip:** The existing [@mastra/hono](https://github.com/mastra-ai/mastra/blob/main/server-adapters/hono/src/index.ts) and [@mastra/express](https://github.com/mastra-ai/mastra/blob/main/server-adapters/express/src/index.ts) implementations are good references when building your custom adapter. They show how to handle framework-specific patterns for context storage and middleware registration, plus response handling.
|
|
@@ -283,7 +283,7 @@ This is useful when you want to restrict operations to a specific thread that yo
|
|
|
283
283
|
}
|
|
284
284
|
```
|
|
285
285
|
|
|
286
|
-
|
|
286
|
+
## Related
|
|
287
287
|
|
|
288
288
|
- [Request Context](https://mastra.ai/docs/server/request-context)
|
|
289
289
|
- [Reserved Keys](https://mastra.ai/docs/server/request-context)
|
|
@@ -502,6 +502,18 @@ To exclude a workflow from automatic boot-time restarts triggered by `Mastra.res
|
|
|
502
502
|
|
|
503
503
|
While a run executes, Mastra holds a storage lease on it and renews it in the background. `restart()` refuses to take over a run whose lease hasn't expired: it throws a `WORKFLOW_RESTART_RUN_OWNED` error and the sweep skips the run. The lease is advisory and doesn't fence writes. If a process stops renewing its lease but keeps executing a step, for example because its event loop is blocked for longer than the lease TTL, recovery can run that step a second time. The boot-time sweep, `mastra.restartAllActiveWorkflowRuns()`, rechecks a skipped run once its lease could have expired, so a run whose process crashed is still recovered. `workflow.restartAllActiveWorkflowRuns()` skips the run without a recheck, so call it after the lease expires if you need to recover that run. Storage adapters without run-ownership support keep the previous behavior and restart every active run.
|
|
504
504
|
|
|
505
|
+
A restarted run runs the interrupted step again, even if that step finished before the process stopped but its result wasn't saved. On the evented engine, a step also runs again when its event is redelivered to a worker. Make steps with side effects idempotent, so a repeated step has no additional effect.
|
|
506
|
+
|
|
507
|
+
A step's `execute` function receives `runId` and `workflowId`. Combine them with the `id` you gave the step in `createStep()`, plus a name for each side effect when the step performs more than one, to build an idempotency key.
|
|
508
|
+
|
|
509
|
+
Some steps need part of the key to come from their input:
|
|
510
|
+
|
|
511
|
+
- A nested workflow can receive a new `runId` when it's recovered or redelivered. Pass the parent's `runId` into the nested workflow's input and use it in place of the nested `runId`.
|
|
512
|
+
- `foreach` runs the same step once per item. Add an ID from the step's input that identifies the item.
|
|
513
|
+
- A loop runs the same step on every iteration. Return an iteration number from the step and read it from the input on the next iteration. A repeated or resumed iteration receives the same input, so the number doesn't change.
|
|
514
|
+
|
|
515
|
+
For tools that agents call, see [make tools safe to repeat](https://mastra.ai/docs/harness/durable-agents).
|
|
516
|
+
|
|
505
517
|
### Restarting an active workflow run with `restart()`
|
|
506
518
|
|
|
507
519
|
Use `restart()` to restart an active workflow run from the last active step. This will resume execution from the last active step, and the workflow will continue from there.
|
|
@@ -188,7 +188,7 @@ if (result.status === 'suspended') {
|
|
|
188
188
|
|
|
189
189
|
### Example output
|
|
190
190
|
|
|
191
|
-
The `suspended` array contains the
|
|
191
|
+
The `suspended` array contains one path for each suspended step in the run. Each path is an array of step IDs that leads from the top-level workflow to the suspended step, passing through any nested workflows. Pass a path to the `step` parameter of `resume()` to target and resume that execution path. With the default engine, a nested workflow contributes only one path at a time, even if several of its parallel steps suspended. After resuming, check the returned `suspended` array for remaining paths. Treat each path as opaque and pass it back unchanged: depending on the engine, it can include repeated IDs or numeric `.foreach()` indexes. A path to a suspended `.foreach()` step targets every suspended iteration, so pass [`forEachIndex`](https://mastra.ai/reference/workflows/run-methods/resume) to resume one iteration at a time. For a step suspended inside a nested workflow, `result.suspended[0]` is:
|
|
192
192
|
|
|
193
193
|
```typescript
|
|
194
194
|
['nested-workflow', 'step-1']
|
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
|
|
5
5
|
# Merge Gateway
|
|
6
6
|
|
|
7
|
-
Merge Gateway aggregates models from multiple providers with enhanced features like rate limiting and failover. Access
|
|
7
|
+
Merge Gateway aggregates models from multiple providers with enhanced features like rate limiting and failover. Access 204 models through Mastra's model router.
|
|
8
8
|
|
|
9
9
|
Learn more in the [Merge Gateway documentation](https://docs.merge.dev/merge-gateway).
|
|
10
10
|
|
|
@@ -40,6 +40,7 @@ ANTHROPIC_API_KEY=ant-...
|
|
|
40
40
|
| ------------------------------------------------ |
|
|
41
41
|
| `anthropic/claude-fable-5` |
|
|
42
42
|
| `anthropic/claude-fable-5-1` |
|
|
43
|
+
| `anthropic/claude-fable-5-2` |
|
|
43
44
|
| `anthropic/claude-haiku-4-5-20251001` |
|
|
44
45
|
| `anthropic/claude-haiku-5-5` |
|
|
45
46
|
| `anthropic/claude-opus-4-1-20250805` |
|
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
|
|
5
5
|
# Netlify
|
|
6
6
|
|
|
7
|
-
Netlify AI Gateway provides unified access to multiple providers with built-in caching and observability. Access
|
|
7
|
+
Netlify AI Gateway provides unified access to multiple providers with built-in caching and observability. Access 285 models through Mastra's model router.
|
|
8
8
|
|
|
9
9
|
Learn more in the [Netlify documentation](https://docs.netlify.com/build/ai-gateway/overview/).
|
|
10
10
|
|
|
@@ -41,6 +41,7 @@ ANTHROPIC_API_KEY=ant-...
|
|
|
41
41
|
| --------------------------------------------------------------------- |
|
|
42
42
|
| `anthropic/claude-fable-5` |
|
|
43
43
|
| `anthropic/claude-fable-5-1` |
|
|
44
|
+
| `anthropic/claude-fable-5-2` |
|
|
44
45
|
| `anthropic/claude-haiku-4-5` |
|
|
45
46
|
| `anthropic/claude-haiku-4-5-20251001` |
|
|
46
47
|
| `anthropic/claude-haiku-5-5` |
|
|
@@ -73,6 +74,7 @@ ANTHROPIC_API_KEY=ant-...
|
|
|
73
74
|
| `gemini/gemini-flash-latest` |
|
|
74
75
|
| `gemini/gemini-flash-lite-latest` |
|
|
75
76
|
| `gemini/gemini-nano-banana-2.1` |
|
|
77
|
+
| `meta/muse-ember-1.0` |
|
|
76
78
|
| `meta/muse-spark-1.1` |
|
|
77
79
|
| `meta/muse-spark-1.2` |
|
|
78
80
|
| `meta/muse-spark-1.3` |
|
|
@@ -183,7 +185,6 @@ ANTHROPIC_API_KEY=ant-...
|
|
|
183
185
|
| `openrouter/meta/muse-glimmer-30b` |
|
|
184
186
|
| `openrouter/meta/muse-spark-open` |
|
|
185
187
|
| `openrouter/microsoft/phi-4` |
|
|
186
|
-
| `openrouter/minimax/minimax-m1` |
|
|
187
188
|
| `openrouter/minimax/minimax-m2.5` |
|
|
188
189
|
| `openrouter/minimax/minimax-m2.7` |
|
|
189
190
|
| `openrouter/minimax/minimax-m3` |
|
|
@@ -273,6 +274,7 @@ ANTHROPIC_API_KEY=ant-...
|
|
|
273
274
|
| `openrouter/rekaai/reka-flash-3` |
|
|
274
275
|
| `openrouter/relace/relace-apply-3` |
|
|
275
276
|
| `openrouter/relace/relace-search` |
|
|
277
|
+
| `openrouter/ricursiveai/ripple-65b-preview` |
|
|
276
278
|
| `openrouter/sao10k/l3-lunaris-8b` |
|
|
277
279
|
| `openrouter/sao10k/l3.1-euryale-70b` |
|
|
278
280
|
| `openrouter/scaledown/extract` |
|
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
|
|
5
5
|
# OpenRouter
|
|
6
6
|
|
|
7
|
-
OpenRouter aggregates models from multiple providers with enhanced features like rate limiting and failover. Access
|
|
7
|
+
OpenRouter aggregates models from multiple providers with enhanced features like rate limiting and failover. Access 376 models through Mastra's model router.
|
|
8
8
|
|
|
9
9
|
Learn more in the [OpenRouter documentation](https://openrouter.ai/models).
|
|
10
10
|
|
|
@@ -71,6 +71,7 @@ ANTHROPIC_API_KEY=ant-...
|
|
|
71
71
|
| `anthracite-org/magnum-v4-72b` |
|
|
72
72
|
| `anthropic/claude-fable-5` |
|
|
73
73
|
| `anthropic/claude-fable-5.1` |
|
|
74
|
+
| `anthropic/claude-fable-5.2` |
|
|
74
75
|
| `anthropic/claude-haiku-4.5` |
|
|
75
76
|
| `anthropic/claude-haiku-5.5` |
|
|
76
77
|
| `anthropic/claude-opus-4.1` |
|
|
@@ -172,6 +173,7 @@ ANTHROPIC_API_KEY=ant-...
|
|
|
172
173
|
| `meta-llama/llama-4-maverick` |
|
|
173
174
|
| `meta-llama/llama-4-scout` |
|
|
174
175
|
| `meta-llama/llama-guard-4-12b` |
|
|
176
|
+
| `meta/muse-ember` |
|
|
175
177
|
| `meta/muse-glimmer-30b` |
|
|
176
178
|
| `meta/muse-spark-1.1` |
|
|
177
179
|
| `meta/muse-spark-1.2` |
|
|
@@ -181,7 +183,6 @@ ANTHROPIC_API_KEY=ant-...
|
|
|
181
183
|
| `meta/muse-spark-open` |
|
|
182
184
|
| `meta/muse-wonder` |
|
|
183
185
|
| `microsoft/phi-4` |
|
|
184
|
-
| `minimax/minimax-m1` |
|
|
185
186
|
| `minimax/minimax-m2.5` |
|
|
186
187
|
| `minimax/minimax-m2.7` |
|
|
187
188
|
| `minimax/minimax-m3` |
|
|
@@ -220,6 +221,7 @@ ANTHROPIC_API_KEY=ant-...
|
|
|
220
221
|
| `morph/morph-v3-large` |
|
|
221
222
|
| `nex-agi/nex-n2.5-mini` |
|
|
222
223
|
| `nex-agi/nex-n2.5-pro` |
|
|
224
|
+
| `nex-agi/nex-n2.6` |
|
|
223
225
|
| `nousresearch/hermes-4-405b` |
|
|
224
226
|
| `nvidia/nemotron-3-nano-30b-a3b` |
|
|
225
227
|
| `nvidia/nemotron-3-nano-omni-30b-a3b-reasoning:free` |
|
|
@@ -359,7 +361,6 @@ ANTHROPIC_API_KEY=ant-...
|
|
|
359
361
|
| `sao10k/l3.1-euryale-70b` |
|
|
360
362
|
| `scaledown/extract` |
|
|
361
363
|
| `scaledown/summarize` |
|
|
362
|
-
| `stealth/crouton-alpha` |
|
|
363
364
|
| `stepfun/step-3.5-flash` |
|
|
364
365
|
| `stepfun/step-3.7-flash` |
|
|
365
366
|
| `stepfun/step-5-preview` |
|
|
@@ -375,6 +376,7 @@ ANTHROPIC_API_KEY=ant-...
|
|
|
375
376
|
| `thedrummer/skyfall-36b-v2` |
|
|
376
377
|
| `thedrummer/unslopnemo-12b` |
|
|
377
378
|
| `thinkingmachines/inkling` |
|
|
379
|
+
| `thinkingmachines/inkling-2-small:free` |
|
|
378
380
|
| `thinkingmachines/inkling-small` |
|
|
379
381
|
| `unbiased/pareto-26.10` |
|
|
380
382
|
| `unbiased/pareto-26.9` |
|
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
|
|
5
5
|
# Vercel
|
|
6
6
|
|
|
7
|
-
Vercel aggregates models from multiple providers with enhanced features like rate limiting and failover. Access
|
|
7
|
+
Vercel aggregates models from multiple providers with enhanced features like rate limiting and failover. Access 419 models through Mastra's model router.
|
|
8
8
|
|
|
9
9
|
Learn more in the [Vercel documentation](https://ai-sdk.dev/providers/ai-sdk-providers).
|
|
10
10
|
|
|
@@ -83,6 +83,8 @@ ANTHROPIC_API_KEY=ant-...
|
|
|
83
83
|
| `amazon/titan-embed-text-v2` |
|
|
84
84
|
| `anthropic/claude-fable-5` |
|
|
85
85
|
| `anthropic/claude-fable-5.1` |
|
|
86
|
+
| `anthropic/claude-fable-5.2` |
|
|
87
|
+
| `anthropic/claude-fable-5.2-fast` |
|
|
86
88
|
| `anthropic/claude-haiku-4.5` |
|
|
87
89
|
| `anthropic/claude-haiku-5.5` |
|
|
88
90
|
| `anthropic/claude-opus-4.5` |
|
|
@@ -220,6 +222,7 @@ ANTHROPIC_API_KEY=ant-...
|
|
|
220
222
|
| `meta/llama-3.3-70b` |
|
|
221
223
|
| `meta/llama-4-maverick` |
|
|
222
224
|
| `meta/llama-4-scout` |
|
|
225
|
+
| `meta/muse-ember` |
|
|
223
226
|
| `meta/muse-glimmer-30b` |
|
|
224
227
|
| `meta/muse-image-1.0` |
|
|
225
228
|
| `meta/muse-spark-1.1` |
|
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 8261 models from 223 providers through a single API.
|
|
8
8
|
|
|
9
9
|
## Features
|
|
10
10
|
|
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
|
|
5
5
|
# Anthropic
|
|
6
6
|
|
|
7
|
-
Access
|
|
7
|
+
Access 18 Anthropic models through Mastra's model router. Authentication is handled automatically using the `ANTHROPIC_API_KEY` environment variable.
|
|
8
8
|
|
|
9
9
|
Learn more in the [Anthropic documentation](https://docs.anthropic.com/en/docs/about-claude/models).
|
|
10
10
|
|
|
@@ -38,6 +38,7 @@ for await (const chunk of stream) {
|
|
|
38
38
|
| -------------------------------------- | ------- | ----- | --------- | ----- | ----- | ----- | ---------- | ----------- |
|
|
39
39
|
| `anthropic/claude-fable-5` | 1.0M | | | | | | $10 | $50 |
|
|
40
40
|
| `anthropic/claude-fable-5-1` | 1.0M | | | | | | $10 | $50 |
|
|
41
|
+
| `anthropic/claude-fable-5-2` | 1.0M | | | | | | $8 | $40 |
|
|
41
42
|
| `anthropic/claude-haiku-4-5` | 200K | | | | | | $1 | $5 |
|
|
42
43
|
| `anthropic/claude-haiku-4-5-20251001` | 200K | | | | | | $1 | $5 |
|
|
43
44
|
| `anthropic/claude-haiku-5-5` | 1.0M | | | | | | $0.10 | $0.50 |
|
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
|
|
5
5
|
# Chutes
|
|
6
6
|
|
|
7
|
-
Access
|
|
7
|
+
Access 19 Chutes models through Mastra's model router. Authentication is handled automatically using the `CHUTES_API_KEY` environment variable.
|
|
8
8
|
|
|
9
9
|
Learn more in the [Chutes documentation](https://llm.chutes.ai).
|
|
10
10
|
|
|
@@ -19,7 +19,7 @@ const agent = new Agent({
|
|
|
19
19
|
id: "my-agent",
|
|
20
20
|
name: "My Agent",
|
|
21
21
|
instructions: "You are a helpful assistant",
|
|
22
|
-
model: "chutes/Qwen/Qwen3.5-
|
|
22
|
+
model: "chutes/Qwen/Qwen3.5-27B-TEE"
|
|
23
23
|
});
|
|
24
24
|
|
|
25
25
|
// Generate a response
|
|
@@ -46,6 +46,7 @@ for await (const chunk of stream) {
|
|
|
46
46
|
| `chutes/moonshotai/Kimi-K2.6-TEE` | 262K | | | | | | $0.39 | $2 |
|
|
47
47
|
| `chutes/moonshotai/Kimi-K2.7-Code` | — | | | | | | — | — |
|
|
48
48
|
| `chutes/moonshotai/Kimi-K3-TEE` | 1.0M | | | | | | $2 | $10 |
|
|
49
|
+
| `chutes/Qwen/Qwen3.5-27B-TEE` | 262K | | | | | | $0.20 | $2 |
|
|
49
50
|
| `chutes/Qwen/Qwen3.5-397B-A17B-TEE` | 262K | | | | | | $0.45 | $3 |
|
|
50
51
|
| `chutes/Qwen/Qwen3.6-27B-TEE` | 262K | | | | | | $0.25 | $2 |
|
|
51
52
|
| `chutes/Qwen/Qwen3.8-2.4T-A95B` | — | | | | | | — | — |
|
|
@@ -71,7 +72,7 @@ const agent = new Agent({
|
|
|
71
72
|
name: "custom-agent",
|
|
72
73
|
model: {
|
|
73
74
|
url: "https://llm.chutes.ai/v1",
|
|
74
|
-
id: "chutes/Qwen/Qwen3.5-
|
|
75
|
+
id: "chutes/Qwen/Qwen3.5-27B-TEE",
|
|
75
76
|
apiKey: process.env.CHUTES_API_KEY,
|
|
76
77
|
headers: {
|
|
77
78
|
"X-Custom-Header": "value"
|
|
@@ -92,7 +93,7 @@ const agent = new Agent({
|
|
|
92
93
|
const useAdvanced = requestContext.task === "complex";
|
|
93
94
|
return useAdvanced
|
|
94
95
|
? "chutes/zai-org/GLM-5.3"
|
|
95
|
-
: "chutes/Qwen/Qwen3.5-
|
|
96
|
+
: "chutes/Qwen/Qwen3.5-27B-TEE";
|
|
96
97
|
}
|
|
97
98
|
});
|
|
98
99
|
```
|