@mastra/libsql 1.20.0 → 1.20.1-alpha.0

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.
Files changed (27) hide show
  1. package/CHANGELOG.md +21 -0
  2. package/dist/docs/SKILL.md +6 -9
  3. package/dist/docs/assets/SOURCE_MAP.json +1 -1
  4. package/dist/docs/references/{docs-agents-agent-approval.md → docs-agents-human-in-the-loop.md} +11 -9
  5. package/dist/docs/references/docs-agents-networks.md +3 -3
  6. package/dist/docs/references/docs-deployment-workers.md +253 -7
  7. package/dist/docs/references/docs-memory-memory-processors.md +1 -1
  8. package/dist/docs/references/docs-memory-message-history.md +3 -3
  9. package/dist/docs/references/docs-memory-overview.md +4 -4
  10. package/dist/docs/references/docs-memory-semantic-recall.md +1 -1
  11. package/dist/docs/references/docs-memory-working-memory.md +3 -3
  12. package/dist/docs/references/{docs-storage-overview.md → docs-storage.md} +8 -7
  13. package/dist/docs/references/{docs-editor-overview.md → docs-studio-editor.md} +3 -1
  14. package/dist/docs/references/docs-workflows-snapshots.md +1 -1
  15. package/dist/docs/references/integrations-channels-github.md +1 -1
  16. package/dist/docs/references/{guides-agent-frameworks-ai-sdk.md → reference-ai-sdk-overview.md} +1 -1
  17. package/dist/docs/references/reference-core-mastra-class.md +1 -1
  18. package/dist/docs/references/reference-file-based-agents-memory.md +2 -2
  19. package/dist/docs/references/reference-file-based-agents-storage.md +3 -3
  20. package/dist/docs/references/reference-memory-memory-class.md +1 -0
  21. package/dist/docs/references/reference-storage-retention.md +1 -1
  22. package/dist/index.cjs +3 -0
  23. package/dist/index.cjs.map +1 -1
  24. package/dist/index.js +3 -0
  25. package/dist/index.js.map +1 -1
  26. package/dist/storage/domains/agents/index.d.ts.map +1 -1
  27. package/package.json +5 -5
package/CHANGELOG.md CHANGED
@@ -1,5 +1,26 @@
1
1
  # @mastra/libsql
2
2
 
3
+ ## 1.20.1-alpha.0
4
+
5
+ ### Patch Changes
6
+
7
+ - Added a `durable` option to stored agents so agents created through the Agents API can run with durable execution — no code deployment required. ([#21715](https://github.com/mastra-ai/mastra/pull/21715))
8
+
9
+ ```typescript
10
+ await mastraClient.createStoredAgent({
11
+ id: 'helper',
12
+ name: 'Helper',
13
+ instructions: 'You are a helpful assistant.',
14
+ model: { provider: 'openai', name: 'gpt-5' },
15
+ durable: true,
16
+ });
17
+ ```
18
+
19
+ Pass `true` for defaults, or `{ maxSteps, cleanupTimeoutMs }` to tune the durable loop. Cache and pubsub are inherited from the server's Mastra instance, so configure distributed backends there for durability across replicas. Automatic recovery is still configured in code via `recovery.durableAgents`.
20
+
21
+ - Updated dependencies [[`6223446`](https://github.com/mastra-ai/mastra/commit/6223446ddce6166e96e0ba5e00d628b615dee8ca), [`583e235`](https://github.com/mastra-ai/mastra/commit/583e23519c13af16c1746f9c49722d011216611b), [`a77f8d4`](https://github.com/mastra-ai/mastra/commit/a77f8d4740d2178a74c41e4bf678b4fcd8fa0bb2), [`40d358e`](https://github.com/mastra-ai/mastra/commit/40d358e29d55543803e64b49241122f598ffabc7), [`e80cd7e`](https://github.com/mastra-ai/mastra/commit/e80cd7e7683e7d732e1cc6784bcac1d2640d2ce3), [`20504b2`](https://github.com/mastra-ai/mastra/commit/20504b2ecebd0e077acda3d457ab57480a98ed3e)]:
22
+ - @mastra/core@1.60.0-alpha.11
23
+
3
24
  ## 1.20.0
4
25
 
5
26
  ### Minor Changes
@@ -3,7 +3,7 @@ name: mastra-libsql
3
3
  description: Documentation for @mastra/libsql. Use when working with @mastra/libsql APIs, configuration, or implementation.
4
4
  metadata:
5
5
  package: "@mastra/libsql"
6
- version: "1.20.0"
6
+ version: "1.20.1-alpha.0"
7
7
  ---
8
8
 
9
9
  ## When to use
@@ -16,23 +16,19 @@ Read the individual reference documents for detailed explanations and code examp
16
16
 
17
17
  ### Docs
18
18
 
19
- - [Agent approval](references/docs-agents-agent-approval.md) - Learn how to require approvals and suspend tool execution, plus automatically resume suspended tools while keeping humans in control of agent workflows.
19
+ - [Human-in-the-loop](references/docs-agents-human-in-the-loop.md) - Learn how to require approvals and suspend tool execution, plus automatically resume suspended tools while keeping humans in control of agent workflows.
20
20
  - [Agent networks](references/docs-agents-networks.md) - Coordinate multiple agents, workflows, and tools using agent networks for complex, non-deterministic task execution.
21
21
  - [Workers](references/docs-deployment-workers.md) - Separate background processing from the API layer by running workflow execution, cron schedules, and background tasks in dedicated worker processes.
22
- - [Editor](references/docs-editor-overview.md) - Let collaborators update an agent in Studio, test their changes, and publish without editing code.
23
22
  - [Memory processors](references/docs-memory-memory-processors.md) - Learn how to use memory processors in Mastra to filter, trim, and transform messages before they're sent to the language model to manage context window limits.
24
23
  - [Message history](references/docs-memory-message-history.md) - Learn how to configure message history in Mastra to store recent messages from the current conversation.
25
24
  - [Multi-user threads](references/docs-memory-multi-user-threads.md) - Share one Mastra thread between multiple users by carrying speaker identity in the message body.
26
- - [Memory overview](references/docs-memory-overview.md) - Learn how Mastra's memory system works with working memory, message history, semantic recall, and observational memory.
25
+ - [Memory](references/docs-memory-overview.md) - Learn how Mastra's memory system works with working memory, message history, semantic recall, and observational memory.
27
26
  - [Semantic recall](references/docs-memory-semantic-recall.md) - Learn how to use semantic recall in Mastra to retrieve relevant messages from past conversations using vector search and embeddings.
28
27
  - [Working memory](references/docs-memory-working-memory.md) - Learn how to configure working memory in Mastra to store persistent user data, preferences.
29
- - [Storage overview](references/docs-storage-overview.md) - Configure storage for Mastra to persist runtime state across agents, workflows, observability, evals, schedules, and memory.
28
+ - [Storage](references/docs-storage.md) - Configure storage for Mastra to persist runtime state across agents, workflows, observability, evals, schedules, and memory.
29
+ - [Editor](references/docs-studio-editor.md) - Let collaborators update an agent in Studio, test their changes, and publish without editing code.
30
30
  - [Snapshots](references/docs-workflows-snapshots.md) - Learn how to save and resume workflow execution state with snapshots in Mastra
31
31
 
32
- ### Guides
33
-
34
- - [AI SDK](references/guides-agent-frameworks-ai-sdk.md) - Use Mastra processors and memory with the Vercel AI SDK
35
-
36
32
  ### Integrations
37
33
 
38
34
  - [GitHub](references/integrations-channels-github.md) - Notify a Mastra agent when subscribed GitHub pull requests change.
@@ -41,6 +37,7 @@ Read the individual reference documents for detailed explanations and code examp
41
37
 
42
38
  ### Reference
43
39
 
40
+ - [AI SDK overview](references/reference-ai-sdk-overview.md) - Use Mastra processors and memory with the Vercel AI SDK
44
41
  - [Reference: Mastra.getMemory()](references/reference-core-getMemory.md) - Documentation for the `Mastra.getMemory()` method in Mastra, which retrieves a registered memory instance by its registry key.
45
42
  - [Reference: Mastra.listMemory()](references/reference-core-listMemory.md) - Documentation for the `Mastra.listMemory()` method in Mastra, which returns all registered memory instances.
46
43
  - [Reference: Mastra class](references/reference-core-mastra-class.md) - Documentation for the `Mastra` class in Mastra, the core entry point for managing agents, workflows, MCP servers, and server endpoints.
@@ -1,5 +1,5 @@
1
1
  {
2
- "version": "1.20.0",
2
+ "version": "1.20.1-alpha.0",
3
3
  "package": "@mastra/libsql",
4
4
  "exports": {},
5
5
  "modules": {}
@@ -1,10 +1,10 @@
1
1
  > Discover all available pages from the documentation index: https://mastra.ai/llms.txt
2
2
 
3
- # Agent approval
3
+ # Human-in-the-loop
4
4
 
5
- Agents sometimes require the same [human-in-the-loop](https://mastra.ai/docs/workflows/human-in-the-loop) oversight used in workflows when calling tools that handle sensitive operations, like deleting resources or running long processes. With agent approval you can suspend a tool call before it executes so a human can approve or decline it, or let tools suspend themselves to request additional context from the user.
5
+ Agents sometimes require the same [human-in-the-loop (HITL)](https://mastra.ai/docs/workflows/human-in-the-loop) oversight used in workflows when calling tools that handle sensitive operations, like deleting resources or running long processes. With human-in-the-loop you can suspend a tool call before it executes so a human can approve or decline it, or let tools suspend themselves to request additional context from the user.
6
6
 
7
- ## When to use agent approval
7
+ ## When to use human-in-the-loop
8
8
 
9
9
  - **Destructive or irreversible actions** such as deleting records or sending emails, or alternatively processing payments.
10
10
  - **Cost-heavy operations** like calling expensive third-party APIs where you want to verify arguments first.
@@ -12,7 +12,7 @@ Agents sometimes require the same [human-in-the-loop](https://mastra.ai/docs/wor
12
12
 
13
13
  ## Quickstart
14
14
 
15
- Mark a tool with `requireApproval: true`, then check for the `tool-call-approval` chunk in the stream to approve or decline:
15
+ Mark a tool with `requireApproval: true`, then check for the `tool-call-approval` chunk in the stream to approve or decline the action:
16
16
 
17
17
  ```typescript
18
18
  import { Agent } from '@mastra/core/agent'
@@ -48,7 +48,7 @@ for await (const chunk of stream.fullStream) {
48
48
  }
49
49
  ```
50
50
 
51
- > **Note:** Agent approval uses snapshots to capture request state. Configure a [storage provider](https://mastra.ai/docs/storage/overview) on your Mastra instance or you'll see a "snapshot not found" error.
51
+ > **Note:** Human-in-the-loop uses snapshots to capture request state. Configure a [storage provider](https://mastra.ai/docs/storage) on your Mastra instance or you'll see a "snapshot not found" error.
52
52
  >
53
53
  > Snapshots for agent runs are minimal resume artifacts: they hold only what's needed to resume the suspended run and are deleted once the run finishes. Use [tracing](https://mastra.ai/docs/observability/overview) for the execution record and [memory](https://mastra.ai/docs/memory/overview) for the conversation history.
54
54
 
@@ -391,6 +391,8 @@ const agent = new Agent({
391
391
 
392
392
  When enabled, the agent detects suspended tools from message history on the next user message. It extracts `resumeData` based on the tool's `resumeSchema`, then automatically resumes the tool.
393
393
 
394
+ Automatic resumption applies to data-bearing `suspend()` flows. It doesn't approve tools that use `requireApproval`; those tools remain suspended until an explicit approval or decline is submitted through `approveToolCall()`, `declineToolCall()`, `resumeStream({ approved: boolean })`, or an equivalent UI or API action.
395
+
394
396
  The following example shows a complete conversational flow:
395
397
 
396
398
  ```typescript
@@ -508,11 +510,11 @@ Each returned run includes the suspended tool calls (`toolCallId`, `toolName`, `
508
510
 
509
511
  The same discovery is available over HTTP as `GET /agents/:agentId/suspended-runs` and in the client SDK as [`agent.listSuspendedRuns()`](https://mastra.ai/reference/client-js/agents), so browser-based approval UIs can rediscover pending runs directly.
510
512
 
511
- > **Note:** Suspended runs only survive restarts when your Mastra instance is configured with a persistent [storage provider](https://mastra.ai/docs/storage/overview). The default in-memory store loses snapshots when the process exits.
513
+ > **Note:** Suspended runs only survive restarts when your Mastra instance is configured with a persistent [storage provider](https://mastra.ai/docs/storage). The default in-memory store loses snapshots when the process exits.
512
514
 
513
515
  ## Tool approval: Supervisor agents
514
516
 
515
- A [supervisor agent](https://mastra.ai/docs/capabilities/subagents) coordinates multiple subagents using `.stream()` or `.generate()`. When a subagent calls a tool that requires approval, the request propagates up through the delegation chain and surfaces at the supervisor level:
517
+ A [supervisor agent](https://mastra.ai/docs/subagents) coordinates multiple subagents using `.stream()` or `.generate()`. When a subagent calls a tool that requires approval, the request propagates up through the delegation chain and surfaces at the supervisor level:
516
518
 
517
519
  1. The supervisor delegates a task to a subagent.
518
520
  2. The subagent calls a tool that has `requireApproval: true` or uses `suspend()`.
@@ -671,8 +673,8 @@ if (output.finishReason === 'suspended') {
671
673
 
672
674
  ## Related
673
675
 
674
- - [Tools](https://mastra.ai/docs/agents/using-tools)
676
+ - [Tools](https://mastra.ai/docs/agents/tools)
675
677
  - [Agent overview](https://mastra.ai/docs/agents/overview)
676
- - [MCP overview](https://mastra.ai/docs/mcp/overview)
678
+ - [MCP overview](https://mastra.ai/docs/connections/mcp)
677
679
  - [Memory](https://mastra.ai/docs/memory/overview)
678
680
  - [Request context](https://mastra.ai/docs/server/request-context)
@@ -2,7 +2,7 @@
2
2
 
3
3
  # Agent networks
4
4
 
5
- > **Deprecated:** Agent networks are deprecated and will be removed in a future major release. [Supervisor agents](https://mastra.ai/docs/capabilities/subagents) using `agent.stream()` or `agent.generate()` are now the recommended approach. It provides the same multi-agent coordination with better control, a simpler API, and easier debugging.
5
+ > **Deprecated:** Agent networks are deprecated and will be removed in a future major release. [Supervisor agents](https://mastra.ai/docs/subagents) using `agent.stream()` or `agent.generate()` are now the recommended approach. It provides the same multi-agent coordination with better control, a simpler API, and easier debugging.
6
6
  >
7
7
  > See the [migration guide](https://mastra.ai/reference/migrations/network-to-supervisor) to upgrade.
8
8
 
@@ -95,7 +95,7 @@ console.log(final?.summary)
95
95
 
96
96
  When a primitive requires approval, the stream emits an `agent-execution-approval` or `tool-execution-approval` chunk. Use `approveNetworkToolCall()` or `declineNetworkToolCall()` to respond.
97
97
 
98
- Network approval uses snapshots to capture execution state. Ensure a [storage provider](https://mastra.ai/docs/storage/overview) is enabled in your Mastra instance.
98
+ Network approval uses snapshots to capture execution state. Ensure a [storage provider](https://mastra.ai/docs/storage) is enabled in your Mastra instance.
99
99
 
100
100
  ```typescript
101
101
  const stream = await routingAgent.network('Perform some sensitive action', {
@@ -180,5 +180,5 @@ Requirements for automatic resumption:
180
180
 
181
181
  ## Related
182
182
 
183
- - [Supervisor agents](https://mastra.ai/docs/capabilities/subagents)
183
+ - [Supervisor agents](https://mastra.ai/docs/subagents)
184
184
  - [Migration: `.network()` to supervisor agents](https://mastra.ai/reference/migrations/network-to-supervisor)
@@ -106,31 +106,277 @@ Run the same build artifact in multiple containers, each with a different [`MAST
106
106
 
107
107
  Split deployments require a distributed PubSub backend ([`RedisStreamsPubSub`](https://mastra.ai/reference/pubsub/redis-streams) or [`GoogleCloudPubSub`](https://mastra.ai/reference/pubsub/google-cloud-pubsub)), a shared [storage backend](https://mastra.ai/reference/workers/overview), and network connectivity between the orchestration worker and the API.
108
108
 
109
- The [worker deployment guide](https://mastra.ai/guides/deployment/mastra-workers) walks through this setup with Docker Compose and Kubernetes examples.
109
+ ### Select workers
110
+
111
+ Set [`MASTRA_WORKERS`](https://mastra.ai/reference/workers/overview) to control which workers run in each process:
112
+
113
+ | Value | Behavior |
114
+ | ------------------------------- | ------------------------------------------------------------------------------ |
115
+ | `false` | Disable all workers. Use this for the API process in a fully split deployment. |
116
+ | `orchestration` | Start the orchestration worker. |
117
+ | `scheduler` | Start the scheduler worker. |
118
+ | `backgroundTasks` | Start the background task worker. |
119
+ | `orchestration,backgroundTasks` | Start multiple workers from a comma-separated allowlist. |
120
+
121
+ You can also pass a worker name to the CLI. The command sets `MASTRA_WORKERS` in the spawned process:
122
+
123
+ ```bash
124
+ mastra worker start orchestration
125
+ ```
110
126
 
111
127
  ## Network architecture
112
128
 
113
- Workers are internal infrastructure. They're not exposed to end users and don't need their own subdomain, public URL, or inbound HTTP route.
129
+ Workers are internal infrastructure. They're not exposed to end users and don't need their own subdomain or public URL, including an inbound HTTP route.
114
130
 
115
131
  In a split deployment:
116
132
 
117
- - **The API server is the only public-facing process**: It serves all client HTTP requests, including REST endpoints, agent interactions, workflow triggers, and any custom routes.
133
+ - **The API server is the only public-facing process**: It serves all client HTTP requests. These requests include REST endpoints and agent interactions, plus workflow triggers and custom routes.
118
134
  - **Workers connect outbound only**: They pull events from the distributed PubSub backend and read/write to the shared storage database. They don't accept inbound traffic from clients.
119
135
  - **The orchestration worker calls the API internally**: It sends step execution requests to the API over the container network using `MASTRA_STEP_EXECUTION_URL`. This is internal service-to-service communication, not a public endpoint.
120
136
 
121
- All three worker types (orchestration, scheduler, background task) sit behind the API on a private network. They share access to the PubSub backend and storage database but never receive traffic directly from clients. If a worker-related feature needs an HTTP route (for example, token minting for a voice integration), that route runs on the API server, not on the worker process.
137
+ All three worker types (orchestration, scheduler, background task) sit behind the API on a private network. They share access to the PubSub backend and storage database but never receive traffic directly from clients. HTTP routes for worker-related features run on the API server rather than the worker process. One example is token minting for a voice integration.
138
+
139
+ ## Deploy split workers
140
+
141
+ Build the API and worker artifacts:
142
+
143
+ ```bash
144
+ mastra build
145
+ mastra worker build --output-dir .mastra/worker
146
+ ```
147
+
148
+ `mastra build` creates the API artifact in `.mastra/output/`. [`mastra worker build`](https://mastra.ai/reference/cli/mastra) creates a worker artifact in `.mastra/worker/`. The following Dockerfile accepts either directory:
149
+
150
+ ```dockerfile
151
+ FROM node:22-alpine
152
+
153
+ ARG MASTRA_OUTPUT=.mastra/output
154
+
155
+ WORKDIR /app
156
+
157
+ COPY ${MASTRA_OUTPUT}/package.json ${MASTRA_OUTPUT}/.npmrc* ./
158
+ RUN npm install --omit=dev
159
+
160
+ COPY ${MASTRA_OUTPUT}/ .
161
+
162
+ EXPOSE 4111
163
+ CMD ["node", "index.mjs"]
164
+ ```
165
+
166
+ See [Deploy a Mastra server](https://mastra.ai/docs/deployment/mastra-server) for more information about the build output.
167
+
168
+ ### Docker Compose
169
+
170
+ The following configuration runs PostgreSQL, Redis, the API, and one process for each worker type. Every process uses shared infrastructure, and the worker processes use the worker artifact.
171
+
172
+ ```yaml
173
+ x-worker: &worker
174
+ build:
175
+ context: .
176
+ args:
177
+ MASTRA_OUTPUT: .mastra/worker
178
+
179
+ x-mastra-environment: &shared-environment
180
+ DATABASE_URL: postgres://mastra:${POSTGRES_PASSWORD}@postgres:5432/mastra
181
+ REDIS_URL: redis://redis:6379
182
+
183
+ services:
184
+ postgres:
185
+ image: postgres:16-alpine
186
+ environment:
187
+ POSTGRES_USER: mastra
188
+ POSTGRES_PASSWORD: ${POSTGRES_PASSWORD}
189
+ POSTGRES_DB: mastra
190
+ volumes:
191
+ - pgdata:/var/lib/postgresql/data
192
+ healthcheck:
193
+ test: ['CMD-SHELL', 'pg_isready -U mastra']
194
+ interval: 5s
195
+ timeout: 3s
196
+ retries: 5
197
+
198
+ redis:
199
+ image: redis:7-alpine
200
+ healthcheck:
201
+ test: ['CMD', 'redis-cli', 'ping']
202
+ interval: 5s
203
+ timeout: 3s
204
+ retries: 5
205
+
206
+ api:
207
+ build:
208
+ context: .
209
+ args:
210
+ MASTRA_OUTPUT: .mastra/output
211
+ ports:
212
+ - '4111:4111'
213
+ environment:
214
+ <<: *shared-environment
215
+ WORKER_TOKEN: ${WORKER_TOKEN}
216
+ MASTRA_WORKERS: 'false'
217
+ depends_on:
218
+ postgres:
219
+ condition: service_healthy
220
+ redis:
221
+ condition: service_healthy
222
+ healthcheck:
223
+ test: ['CMD', 'wget', '-qO-', 'http://localhost:4111/api/agents']
224
+ interval: 5s
225
+ timeout: 3s
226
+ retries: 5
227
+
228
+ orchestration-worker:
229
+ <<: *worker
230
+ environment:
231
+ <<: *shared-environment
232
+ MASTRA_WORKERS: orchestration
233
+ MASTRA_STEP_EXECUTION_URL: http://api:4111/api
234
+ MASTRA_WORKER_AUTH_TOKEN: ${WORKER_TOKEN}
235
+ depends_on:
236
+ api:
237
+ condition: service_healthy
238
+
239
+ scheduler-worker:
240
+ <<: *worker
241
+ environment:
242
+ <<: *shared-environment
243
+ MASTRA_WORKERS: scheduler
244
+ depends_on:
245
+ api:
246
+ condition: service_healthy
247
+
248
+ background-task-worker:
249
+ <<: *worker
250
+ environment:
251
+ <<: *shared-environment
252
+ MASTRA_WORKERS: backgroundTasks
253
+ depends_on:
254
+ api:
255
+ condition: service_healthy
256
+
257
+ volumes:
258
+ pgdata:
259
+ ```
260
+
261
+ Set the secrets next to `docker-compose.yml`, along with any model provider credentials your application needs:
262
+
263
+ ```bash
264
+ POSTGRES_PASSWORD=your-secure-password
265
+ WORKER_TOKEN=your-shared-secret-token
266
+ ```
267
+
268
+ Configure the API auth provider to accept `WORKER_TOKEN` before exposing the deployment. The orchestration worker sends the same value through `MASTRA_WORKER_AUTH_TOKEN`. The scheduler and background task workers don't call the step execution endpoint in this pull-based topology, so they don't need that variable.
269
+
270
+ Start the stack and verify that the containers and API are available:
271
+
272
+ ```bash
273
+ docker compose up -d
274
+ docker compose ps
275
+ curl http://localhost:4111/api/agents
276
+ ```
277
+
278
+ ### Kubernetes
279
+
280
+ Create separate Deployments for the API, orchestration worker, scheduler worker, and background task worker. Use the same image and Secret for each Deployment. Set only the role-specific environment variables directly on each container.
281
+
282
+ The orchestration worker Deployment has the following shape:
283
+
284
+ ```yaml
285
+ apiVersion: apps/v1
286
+ kind: Deployment
287
+ metadata:
288
+ name: orchestration-worker
289
+ spec:
290
+ replicas: 1
291
+ selector:
292
+ matchLabels:
293
+ app: orchestration-worker
294
+ template:
295
+ metadata:
296
+ labels:
297
+ app: orchestration-worker
298
+ spec:
299
+ containers:
300
+ - name: worker
301
+ image: your-registry/mastra-workers:latest
302
+ env:
303
+ - name: MASTRA_WORKERS
304
+ value: orchestration
305
+ - name: MASTRA_STEP_EXECUTION_URL
306
+ value: http://api:4111/api
307
+ envFrom:
308
+ - secretRef:
309
+ name: mastra-secrets
310
+ resources:
311
+ requests:
312
+ cpu: 250m
313
+ memory: 256Mi
314
+ ```
315
+
316
+ Use `MASTRA_WORKERS: scheduler` and `MASTRA_WORKERS: backgroundTasks` for the other worker Deployments. Set `MASTRA_WORKERS: 'false'` on the API Deployment and expose the API with a Service. Give every process access to the same database and PubSub backend. Configure the API auth provider with a worker token, then expose that token to the orchestration worker as `MASTRA_WORKER_AUTH_TOKEN`. See [Deploy Mastra to Kubernetes](https://mastra.ai/integrations/deploy/kubernetes) for the base Kubernetes resources.
317
+
318
+ Apply the manifests, then verify the pods and API:
319
+
320
+ ```bash
321
+ kubectl apply -f k8s/
322
+ kubectl get pods
323
+ kubectl port-forward svc/api 4111:4111
324
+ ```
325
+
326
+ In a separate terminal, request an API route:
327
+
328
+ ```bash
329
+ curl http://localhost:4111/api/agents
330
+ ```
331
+
332
+ ### Step execution URL
333
+
334
+ In a fully split deployment, the orchestration worker delegates workflow step execution to the API over HTTP. Set `MASTRA_STEP_EXECUTION_URL` to the API's internal URL, including the `/api` prefix:
335
+
336
+ ```bash
337
+ MASTRA_STEP_EXECUTION_URL=http://api:4111/api
338
+ ```
339
+
340
+ Without this variable, the orchestration worker attempts to execute steps in its own process, which doesn't have access to the full Mastra runtime in a split deployment.
341
+
342
+ The endpoint uses the server's normal auth pipeline. If the API has an auth provider, set `MASTRA_WORKER_AUTH_TOKEN` to a bearer token that provider accepts. Mastra forwards the value as an `Authorization: Bearer` credential. The configured auth provider validates the token. See [Worker authentication](https://mastra.ai/docs/auth/workers) for server configuration and other credential formats.
343
+
344
+ ### Scale workers
345
+
346
+ The orchestration and background task workers can scale horizontally. PubSub consumer groups distribute events across their instances:
347
+
348
+ ```bash
349
+ docker compose up -d --scale orchestration-worker=3
350
+ docker compose up -d --scale background-task-worker=2
351
+ ```
352
+
353
+ For Kubernetes, change the Deployment replica count manually or use a HorizontalPodAutoscaler:
354
+
355
+ ```bash
356
+ kubectl scale deployment/orchestration-worker --replicas=3
357
+ kubectl scale deployment/background-task-worker --replicas=2
358
+ ```
359
+
360
+ Run exactly one scheduler worker. Multiple schedulers polling the same storage can publish duplicate events for a schedule.
361
+
362
+ ### Crash recovery
363
+
364
+ 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. Because an event can be processed more than once, handlers should be idempotent when possible.
365
+
366
+ 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.
367
+
368
+ If the API crashes while a step is executing, that work can be lost and the workflow run can remain in a `running` state. See [known limitations](#known-limitations) and [durable agent crash recovery](https://mastra.ai/docs/harness/durable-agents).
122
369
 
123
370
  ## Known limitations
124
371
 
125
372
  - **No dead-letter queue**: Failed events are nacked and retried, but there's no DLQ for events that fail after all retries.
126
373
  - **No built-in health endpoint**: Workers don't expose an HTTP health check. Use container-level liveness probes or process monitoring.
127
374
  - **Scheduler is single-instance**: Running multiple scheduler processes causes duplicate schedule fires.
128
- - **Runs stuck in "running" after API crash**: If the API process crashes while executing a workflow step, the run remains in `running` status with no automatic retry. For [durable agents](https://mastra.ai/docs/long-running-agents/durable-agents), set `recovery.durableAgents` to `'auto'` in the Mastra config to automatically re-drive orphaned runs on server restart. See [Crash recovery](https://mastra.ai/docs/long-running-agents/durable-agents) for details.
375
+ - **Runs stuck in "running" after API crash**: If the API process crashes while executing a workflow step, the run remains in `running` status with no automatic retry. For [durable agents](https://mastra.ai/docs/harness/durable-agents), set `recovery.durableAgents` to `'auto'` in the Mastra config to automatically re-drive orphaned runs on server restart. See [Crash recovery](https://mastra.ai/docs/harness/durable-agents) for details.
129
376
 
130
377
  ## Related
131
378
 
132
- - [Worker deployment guide](https://mastra.ai/guides/deployment/mastra-workers): Docker Compose and Kubernetes examples
133
- - [Worker authentication](https://mastra.ai/docs/server/auth/workers): Secure worker-to-API communication
379
+ - [Worker authentication](https://mastra.ai/docs/auth/workers): Secure worker-to-API communication
134
380
  - [Workers reference](https://mastra.ai/reference/workers/overview): Details about worker environment variables and types, with a list of supported storage backends
135
381
  - [CLI reference](https://mastra.ai/reference/cli/mastra): `mastra worker build` and `mastra worker start`
136
382
  - [PubSub](https://mastra.ai/docs/server/pubsub): Event delivery backends
@@ -163,7 +163,7 @@ const agent = new Agent({
163
163
 
164
164
  ## Manual control and deduplication
165
165
 
166
- If you manually add a memory processor to `inputProcessors` or `outputProcessors`, Mastra **won't** automatically add it. This gives you full control over processor ordering:
166
+ If you manually add a memory processor to `inputProcessors` or `outputProcessors`, Mastra **won't** automatically add it. Manual configuration gives you full control over processor ordering:
167
167
 
168
168
  ```typescript
169
169
  import { Agent } from '@mastra/core/agent'
@@ -25,7 +25,7 @@ Studio automatically generates a thread and resource ID for you. When calling `s
25
25
 
26
26
  ## Getting started
27
27
 
28
- Install the Mastra memory module along with a [storage adapter](https://mastra.ai/docs/storage/overview) for your database. The examples below use `@mastra/libsql`, which stores data locally in a `mastra.db` file.
28
+ Install the Mastra memory module along with a [storage adapter](https://mastra.ai/docs/storage) for your database. The examples below use `@mastra/libsql`, which stores data locally in a `mastra.db` file.
29
29
 
30
30
  **npm**:
31
31
 
@@ -117,7 +117,7 @@ await agent.stream('Hello', {
117
117
 
118
118
  You can use this history in two ways:
119
119
 
120
- - **Automatic inclusion**: Mastra automatically fetches and includes recent messages in the context window. By default, it includes the last 10 messages, keeping agents grounded in the conversation. You can adjust this number with `lastMessages`, but in most cases you don't need to think about it.
120
+ - **Automatic inclusion**: Mastra automatically fetches recent messages and includes them in the context window. By default, the last 10 messages keep agents grounded in the conversation. You can adjust this number with `lastMessages`, but in most cases you don't need to think about it.
121
121
  - [**Manual querying**](#querying): For more control, use the `recall()` function to query threads and messages directly. This lets you choose exactly which memories are included in the context window, or fetch messages to render conversation history in your UI.
122
122
 
123
123
  > **Tip:** When memory is enabled, [Studio](https://mastra.ai/docs/studio/overview) uses message history to display past conversations in the chat sidebar.
@@ -339,7 +339,7 @@ const { thread, clonedMessages } = await memory.cloneThread({
339
339
  })
340
340
  ```
341
341
 
342
- You can filter which messages get cloned (by count or date range), specify custom thread IDs, and use utility methods to inspect clone relationships.
342
+ You can filter cloned messages by count or date range and specify custom thread IDs. Utility methods are also available to inspect clone relationships.
343
343
 
344
344
  See [`cloneThread()`](https://mastra.ai/reference/memory/cloneThread) and [clone utilities](https://mastra.ai/reference/memory/clone-utilities) for the full API.
345
345
 
@@ -13,7 +13,7 @@ Mastra agents can be configured to store [message history](https://mastra.ai/doc
13
13
 
14
14
  If the combined memory exceeds the model's context limit, [memory processors](https://mastra.ai/docs/memory/memory-processors) can filter, trim, or prioritize content so the most relevant information is preserved.
15
15
 
16
- Memory results will be stored in one or more of your configured [storage providers](https://mastra.ai/docs/storage/overview).
16
+ Memory results will be stored in one or more of your configured [storage providers](https://mastra.ai/docs/storage).
17
17
 
18
18
  > **📹 Watch:** Watch [Mastra memory concepts](https://www.youtube.com/watch?v=18iIHQtIPmc) for a conceptual overview of the memory layers agents can use.
19
19
 
@@ -77,7 +77,7 @@ Use memory when your agent needs to maintain multi-turn conversations that refer
77
77
  bun add @mastra/libsql@latest
78
78
  ```
79
79
 
80
- For more details on available providers and how storage works in Mastra, visit the [storage](https://mastra.ai/docs/storage/overview) documentation.
80
+ For more details on available providers and how storage works in Mastra, visit the [storage](https://mastra.ai/docs/storage) documentation.
81
81
 
82
82
  3. Add the storage provider to your main Mastra instance to enable memory across all configured agents.
83
83
 
@@ -188,7 +188,7 @@ Conversation messages are ordered by timestamp and deduplicated by message ID, s
188
188
 
189
189
  ## Memory in multi-agent systems
190
190
 
191
- When a [supervisor agent](https://mastra.ai/docs/capabilities/subagents) delegates to a subagent, Mastra isolates subagent memory automatically. No flag enables this as it happens on every delegation. Understanding how this scoping works lets you decide what stays private and what to share intentionally.
191
+ When a [supervisor agent](https://mastra.ai/docs/subagents) delegates to a subagent, Mastra isolates subagent memory automatically. No flag enables this as it happens on every delegation. Understanding how this scoping works lets you decide what stays private and what to share intentionally.
192
192
 
193
193
  ### How delegation scopes memory
194
194
 
@@ -200,7 +200,7 @@ Each delegation creates a fresh `threadId` and a deterministic `resourceId` for
200
200
 
201
201
  > **Note:** Title generation (`generateTitle`) is a top-level thread concern and **isn't** applied to inherited subagent threads. Because each delegation creates an ephemeral thread that no one sees, running title generation for it would waste an LLM call per delegation. To generate titles for a subagent's own threads, give that subagent its own memory configuration.
202
202
 
203
- The supervisor forwards its conversation context to the subagent so it has enough background to complete the task. Only the delegation prompt and the subagent's response are saved, the full parent conversation isn't stored. You can control which messages reach the subagent with the [`messageFilter`](https://mastra.ai/docs/capabilities/subagents) callback.
203
+ The supervisor forwards its conversation context to the subagent so it has enough background to complete the task. Only the delegation prompt and the subagent's response are saved, the full parent conversation isn't stored. You can control which messages reach the subagent with the [`messageFilter`](https://mastra.ai/docs/subagents) callback.
204
204
 
205
205
  > **Note:** Subagent resource IDs are always suffixed with the agent name (`{parentResourceId}-{agentName}`). Different subagents under the same supervisor never share a resource ID through delegation.
206
206
 
@@ -270,7 +270,7 @@ Supported embedding models:
270
270
 
271
271
  - **OpenAI**: `text-embedding-3-small`, `text-embedding-3-large`, `text-embedding-ada-002`
272
272
  - **Google**: `gemini-embedding-001`
273
- - **OpenRouter**: Access embedding models from various providers
273
+ - **OpenRouter**: Access embedding models from multiple providers
274
274
 
275
275
  ```ts
276
276
  import { Agent } from '@mastra/core/agent'
@@ -1,6 +1,6 @@
1
1
  > Discover all available pages from the documentation index: https://mastra.ai/llms.txt
2
2
 
3
- # Working Memory
3
+ # Working memory
4
4
 
5
5
  While [message history](https://mastra.ai/docs/memory/message-history) and [semantic recall](https://mastra.ai/docs/memory/semantic-recall) help agents remember conversations, working memory allows them to maintain persistent information about users across interactions.
6
6
 
@@ -213,7 +213,7 @@ const paragraphMemory = new Memory({
213
213
 
214
214
  ## Structured working memory
215
215
 
216
- Working memory can also be defined using a structured schema instead of a Markdown template. This allows you to specify the exact fields and types that should be tracked, using a [Standard JSON Schema](https://standardschema.dev/json-schema) ([Zod](https://zod.dev/), [Valibot](https://valibot.dev/), [ArkType](https://arktype.io/), etc.). When using a schema, the agent will see and update working memory as a JSON object matching your schema.
216
+ Working memory can also be defined using a structured schema instead of a Markdown template. A [Standard JSON Schema](https://standardschema.dev/json-schema) ([Zod](https://zod.dev/), [Valibot](https://valibot.dev/), [ArkType](https://arktype.io/), etc.). When using a schema, the agent will see and update working memory as a JSON object matching your schema.
217
217
 
218
218
  **Requirement:** You must specify either `template` or `schema`, but not both.
219
219
 
@@ -400,7 +400,7 @@ const response = await agent.generate('What do you know about me?', {
400
400
 
401
401
  ## Opt in to state signals (experimental)
402
402
 
403
- By default, working memory reaches the model as part of the system message. You can opt into delivering it as a [state signal](https://mastra.ai/docs/long-running-agents/signals) instead by setting `useStateSignals: true`:
403
+ By default, working memory reaches the model as part of the system message. You can opt into delivering it as a [state signal](https://mastra.ai/docs/harness/signals) instead by setting `useStateSignals: true`:
404
404
 
405
405
  ```typescript
406
406
  const memory = new Memory({
@@ -1,6 +1,6 @@
1
1
  > Discover all available pages from the documentation index: https://mastra.ai/llms.txt
2
2
 
3
- # Storage overview
3
+ # Storage
4
4
 
5
5
  Storage is the persistence layer for the Mastra runtime. It keeps memory, workflow state, observability data, eval results, schedules, and long-running agent state available after a process restarts.
6
6
 
@@ -10,7 +10,7 @@ Storage powers:
10
10
  - [Workflows](https://mastra.ai/docs/workflows/overview): Durable snapshots for suspended and resumed workflow runs.
11
11
  - [Observability](https://mastra.ai/docs/observability/overview): Traces, spans, metrics, logs, and feedback.
12
12
  - [Evals](https://mastra.ai/docs/evals/overview): Scores, datasets, experiments, and evaluation results.
13
- - [Long-running agents](https://mastra.ai/docs/long-running-agents/durable-agents): Background tasks, schedules, goals, and thread state.
13
+ - [Long-running agents](https://mastra.ai/docs/harness/durable-agents): Background tasks, schedules, goals, and thread state.
14
14
 
15
15
  ## When to configure storage
16
16
 
@@ -188,25 +188,26 @@ You can also route `observability` to a dedicated analytics backend. See the [ob
188
188
 
189
189
  ## Supported providers
190
190
 
191
- Each provider page includes installation instructions, configuration parameters, and usage examples:
191
+ Each provider page includes installation instructions, configuration parameters, and usage examples. libSQL is the fastest path for local development because it doesn't require running a separate database server.
192
192
 
193
+ - [Aurora DSQL](https://mastra.ai/integrations/databases/aurora-dsql)
194
+ - [ClickHouse](https://mastra.ai/integrations/databases/clickhouse)
193
195
  - [Cloudflare D1](https://mastra.ai/integrations/databases/cloudflare-d1)
194
- - [Cloudflare KV & Durable Objects](https://mastra.ai/integrations/databases/cloudflare-kv)
196
+ - [Cloudflare KV](https://mastra.ai/integrations/databases/cloudflare-kv)
195
197
  - [Convex](https://mastra.ai/integrations/databases/convex)
198
+ - [DuckDB](https://mastra.ai/integrations/databases/duckdb)
196
199
  - [DynamoDB](https://mastra.ai/integrations/databases/dynamodb)
197
200
  - [Google Cloud Spanner](https://mastra.ai/integrations/databases/spanner)
198
201
  - [LanceDB](https://mastra.ai/integrations/databases/lancedb)
199
202
  - [libSQL](https://mastra.ai/integrations/databases/libsql)
200
- - [Microsoft SQL Server](https://mastra.ai/integrations/databases/mssql)
201
203
  - [MongoDB](https://mastra.ai/integrations/databases/mongodb)
204
+ - [MSSQL](https://mastra.ai/integrations/databases/mssql)
202
205
  - [Neon Postgres](https://mastra.ai/integrations/databases/neon)
203
206
  - [OracleDB](https://mastra.ai/integrations/databases/oracledb)
204
207
  - [PostgreSQL](https://mastra.ai/integrations/databases/postgresql)
205
208
  - [Redis](https://mastra.ai/integrations/databases/redis)
206
209
  - [Upstash](https://mastra.ai/integrations/databases/upstash)
207
210
 
208
- > **Tip:** libSQL is the fastest path for local development because it doesn't require running a separate database server.
209
-
210
211
  ## Next steps
211
212
 
212
213
  - [Composite storage](https://mastra.ai/reference/storage/composite)
@@ -14,6 +14,8 @@ A [deployed Studio](https://mastra.ai/docs/studio/deployment) makes Editor avail
14
14
 
15
15
  Use Editor when an agent is defined in code but the people responsible for its behavior shouldn't edit the codebase. It works well when instructions or tools change often and need testing before they reach users. If developers own every change and release agent configuration with the application, keep the [agent configuration in code](https://mastra.ai/docs/agents/overview) instead.
16
16
 
17
+ Use [Agent Builder](https://agent-builder.mastra.ai) instead when collaborators need to create and manage fully stored agents in a browser rather than start from agents defined in code.
18
+
17
19
  ## Quickstart
18
20
 
19
21
  Install `@mastra/editor`. This quickstart uses LibSQL to store Editor changes:
@@ -304,7 +306,7 @@ Version selection supports:
304
306
  - Compare two versions in an A/B test.
305
307
  - Give a draft to a small group before publishing it for everyone.
306
308
  - Keep production on the published version while staging uses the latest draft.
307
- - Pin a customer to a particular version.
309
+ - Pin a customer to a specific version.
308
310
 
309
311
  The same version controls work when a supervisor calls sub-agents. Developers can test a draft sub-agent without changing the rest of the system.
310
312