@mastra/mcp-docs-server 1.3.11-alpha.2 → 1.3.11-alpha.3
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/human-in-the-loop.md +25 -0
- package/.docs/docs/auth/fga.md +1 -1
- package/.docs/docs/harness/background-tasks.md +85 -1
- package/.docs/docs/license.md +20 -0
- package/.docs/docs/mastra-platform/observability.md +32 -5
- package/.docs/docs/memory/semantic-recall.md +20 -20
- package/.docs/docs/studio/auth.md +2 -4
- package/.docs/docs/studio/observability.md +1 -1
- package/.docs/integrations/agentic-ui/ai-sdk-ui.md +2 -0
- package/.docs/integrations/auth/google.md +2 -0
- package/.docs/integrations/auth/okta.md +2 -0
- package/.docs/integrations/auth/workos.md +2 -0
- package/.docs/integrations/databases/convex.md +1 -1
- package/.docs/integrations/databases/duckdb.md +2 -2
- package/.docs/integrations/databases/libsql.md +1 -1
- package/.docs/integrations/databases/mongodb.md +1 -1
- package/.docs/integrations/databases/neon.md +1 -1
- package/.docs/integrations/databases/oracledb.md +1 -1
- package/.docs/integrations/deploy/kubernetes-helm.md +1 -1
- package/.docs/integrations/observability/braintrust.md +6 -0
- package/.docs/integrations/sandboxes/daytona.md +1 -1
- package/.docs/{reference → integrations}/vectors/astra.md +4 -0
- package/.docs/{reference → integrations}/vectors/chroma.md +13 -9
- package/.docs/{reference → integrations}/vectors/convex.md +12 -0
- package/.docs/{reference → integrations}/vectors/elasticsearch.md +5 -1
- package/.docs/{reference → integrations}/vectors/lance.md +1 -1
- package/.docs/{reference → integrations}/vectors/libsql.md +16 -0
- package/.docs/{reference → integrations}/vectors/mongodb.md +2 -0
- package/.docs/{reference → integrations}/vectors/pg.md +12 -0
- package/.docs/{reference → integrations}/vectors/qdrant.md +2 -0
- package/.docs/{reference → integrations}/vectors/s3vectors.md +10 -0
- package/.docs/{reference → integrations}/vectors/turbopuffer.md +2 -0
- package/.docs/{reference → integrations}/vectors/upstash.md +12 -0
- package/.docs/integrations.md +24 -1
- package/.docs/models/embeddings.md +1 -1
- package/.docs/models/environment-variables.md +1 -0
- package/.docs/models/gateways/merge-gateway.md +2 -1
- package/.docs/models/gateways/vercel.md +1 -1
- package/.docs/models/index.md +2 -1
- package/.docs/models/providers/aiand.md +15 -13
- package/.docs/models/providers/anthropic.md +1 -1
- package/.docs/models/providers/edenai.md +10 -9
- package/.docs/models/providers/empiriolabs.md +5 -5
- package/.docs/models/providers/hopper.md +82 -0
- package/.docs/models/providers/inceptron.md +5 -5
- package/.docs/models/providers/kilo.md +12 -11
- package/.docs/models/providers/llmgateway-providers.md +4 -4
- package/.docs/models/providers/llmgateway.md +9 -6
- package/.docs/models/providers/mistral.md +3 -2
- package/.docs/models/providers/nano-gpt.md +8 -8
- package/.docs/models/providers/nearai.md +63 -60
- package/.docs/models/providers/openai.md +1 -1
- package/.docs/models/providers.md +1 -0
- package/.docs/reference/agent-controller/agent-controller-class.md +10 -0
- package/.docs/reference/agents/channels.md +4 -0
- package/.docs/reference/auth/fga.md +2 -0
- package/.docs/reference/auth/google.md +1 -1
- package/.docs/reference/auth/neon.md +2 -0
- package/.docs/reference/auth/okta.md +1 -1
- package/.docs/reference/cli/create-mastra.md +35 -3
- package/.docs/reference/cli/mastra.md +3 -3
- package/.docs/reference/client-js/observability.md +6 -23
- package/.docs/reference/configuration.md +5 -3
- package/.docs/reference/connect/providers.md +99 -1
- package/.docs/reference/core/mastra-class.md +2 -0
- package/.docs/reference/index.md +1 -21
- package/.docs/reference/observability/tracing/advanced-queries.md +226 -86
- package/.docs/reference/observability/tracing/exporters/braintrust.md +11 -1
- package/.docs/reference/observability/tracing/spans.md +3 -3
- package/.docs/reference/processors/processor-interface.md +1 -1
- package/.docs/reference/pubsub/redis-streams.md +45 -2
- package/.docs/reference/pubsub/valkey-streams.md +5 -1
- package/.docs/reference/rag/metadata-filters.md +11 -11
- package/.docs/reference/rag/vector-databases.md +3 -3
- package/.docs/reference/server/routes.md +18 -14
- package/.docs/reference/tools/mcp-client.md +48 -0
- package/.docs/reference/tools/mcp-server.md +216 -1
- package/.docs/reference/tools/submit-plan-tool.md +1 -1
- package/.docs/reference/workspace/filesystem.md +10 -0
- package/.docs/reference/workspace/local-sandbox.md +6 -0
- package/package.json +5 -5
- /package/.docs/{reference → integrations}/vectors/azure-ai-search.md +0 -0
- /package/.docs/{reference → integrations}/vectors/couchbase.md +0 -0
- /package/.docs/{reference → integrations}/vectors/duckdb.md +0 -0
- /package/.docs/{reference → integrations}/vectors/opensearch.md +0 -0
- /package/.docs/{reference → integrations}/vectors/oracledb.md +0 -0
- /package/.docs/{reference → integrations}/vectors/pinecone.md +0 -0
- /package/.docs/{reference → integrations}/vectors/vectorize.md +0 -0
- /package/.docs/{reference → integrations}/vectors/weaviate.md +0 -0
|
@@ -589,6 +589,31 @@ A [supervisor agent](https://mastra.ai/docs/subagents) coordinates multiple suba
|
|
|
589
589
|
|
|
590
590
|
Tool approvals also propagate through multiple levels of delegation. If a supervisor delegates to subagent A, which delegates to subagent B that has a tool with `requireApproval: true`, the approval request still surfaces at the top-level supervisor.
|
|
591
591
|
|
|
592
|
+
### Identify which subagent tool paused
|
|
593
|
+
|
|
594
|
+
The supervisor raises a subagent's pause on its own delegation call, so `toolCallId` on the `tool-call-approval` or `tool-call-suspended` chunk is the supervisor's call to the subagent. Always pass that `toolCallId` when you approve, decline, or resume.
|
|
595
|
+
|
|
596
|
+
To show which of the subagent's tool calls paused, read these fields from the same payload:
|
|
597
|
+
|
|
598
|
+
- `delegatedToolCallId`: The ID of the subagent's tool call that paused. Use it to tell apart two pauses from the same delegation, such as a question followed by an approval.
|
|
599
|
+
- `delegatedToolName`: The name of the subagent's tool that paused.
|
|
600
|
+
|
|
601
|
+
With several levels of delegation, both fields name the deepest tool call, the one that actually paused. Memory saves them with the pause, so they're still there when you reload the conversation, and `generate()` returns them on `suspendPayload`.
|
|
602
|
+
|
|
603
|
+
```typescript
|
|
604
|
+
const stream = await supervisorAgent.stream('Draft and publish the report')
|
|
605
|
+
|
|
606
|
+
for await (const chunk of stream.fullStream) {
|
|
607
|
+
if (chunk.type === 'tool-call-approval' || chunk.type === 'tool-call-suspended') {
|
|
608
|
+
// Label the pause with the subagent tool call that caused it
|
|
609
|
+
console.log('Paused:', chunk.payload.delegatedToolName, chunk.payload.delegatedToolCallId)
|
|
610
|
+
|
|
611
|
+
// Pass the supervisor's delegation call when you approve, decline, or resume
|
|
612
|
+
console.log('Resume with:', chunk.payload.toolCallId)
|
|
613
|
+
}
|
|
614
|
+
}
|
|
615
|
+
```
|
|
616
|
+
|
|
592
617
|
### Approve and decline in supervisor agents
|
|
593
618
|
|
|
594
619
|
The example below creates a subagent with a tool requiring approval. When the tool triggers an approval request, it surfaces in the supervisor's stream as a `tool-call-approval` chunk:
|
package/.docs/docs/auth/fga.md
CHANGED
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
|
|
5
5
|
# Fine-Grained Authorization (FGA)
|
|
6
6
|
|
|
7
|
-
> **Note:**
|
|
7
|
+
> **Note:** FGA requires a Mastra Enterprise Edition (EE) license in production. It works without a license in development. See [what requires an EE license](https://mastra.ai/docs/license). [Contact sales](https://mastra.ai/contact) for more information.
|
|
8
8
|
|
|
9
9
|
Fine-Grained Authorization (FGA) adds resource-level permission checks to your Mastra application. While RBAC answers "can this role do this action?", FGA answers **"can this user do this action on this specific resource?"**
|
|
10
10
|
|
|
@@ -292,6 +292,19 @@ await mastra.backgroundTaskManager?.resume(taskId, {
|
|
|
292
292
|
})
|
|
293
293
|
```
|
|
294
294
|
|
|
295
|
+
### Resume when no slot is free
|
|
296
|
+
|
|
297
|
+
By default, `resume()` throws `Concurrency limit reached` when every concurrency slot is in use. Pass `{ onNoSlot: 'queue' }` to queue the resume instead:
|
|
298
|
+
|
|
299
|
+
```typescript
|
|
300
|
+
const task = await mastra.backgroundTaskManager?.resume(taskId, resumeData, { onNoSlot: 'queue' })
|
|
301
|
+
// task.status is still 'suspended' until a slot frees up
|
|
302
|
+
```
|
|
303
|
+
|
|
304
|
+
The task stays `suspended` until a slot frees up, then resumes with the queued `resumeData`. Cancelling the task drops the queued resume.
|
|
305
|
+
|
|
306
|
+
The queue lives in the memory of the process that called `resume()`. If that process exits before the resume runs, the task stays `suspended` and the `resumeData` is lost. To survive restarts, persist the resume data yourself and call `resume()` again.
|
|
307
|
+
|
|
295
308
|
### What happens to the agent loop
|
|
296
309
|
|
|
297
310
|
When a task suspends mid-`stream()` with `untilIdle`, the wrapper treats it as terminal for the current iteration and closes. Once the resume payload is available, call `agent.resumeStream(resumeData, { runId, toolCallId, memory, untilIdle: true })` to continue immediately. The resumed background task completes and adds its result to the message list before the agent runs a follow-up turn on the same SSE connection. To drive the resume out of band, call `mastra.backgroundTaskManager.resume(taskId, resumeData)` directly. Its result is still written into the thread for the next user turn.
|
|
@@ -310,7 +323,7 @@ Each layer can register terminal-state callbacks. They don't replace one another
|
|
|
310
323
|
|
|
311
324
|
- Tool-level `background.onComplete` / `onFailed`: scoped to one tool.
|
|
312
325
|
- Agent-level `backgroundTasks.onTaskComplete` / `onTaskFailed`: scoped to all tasks dispatched by this agent.
|
|
313
|
-
- Manager-level `onTaskComplete` / `onTaskFailed`: scoped globally.
|
|
326
|
+
- Manager-level `onTaskComplete` / `onTaskFailed`: scoped globally. These fire for every task, including tasks from [non-agent owners](#non-agent-owners).
|
|
314
327
|
|
|
315
328
|
```typescript
|
|
316
329
|
import { Mastra } from '@mastra/core'
|
|
@@ -398,6 +411,77 @@ const { tasks, total } = await mastra.backgroundTaskManager?.listTasks({
|
|
|
398
411
|
|
|
399
412
|
These read from storage rather than the pubsub stream, so they're suitable for paginated lists and detail views.
|
|
400
413
|
|
|
414
|
+
## Non-agent owners
|
|
415
|
+
|
|
416
|
+
Code other than agents can run tasks through the manager. For example, an MCP server can run long tool calls as background tasks. The task's `agentId` is its owner key, and agent streams, `untilIdle`, and the end-of-step wait only see tasks whose `agentId` matches the agent. Use a namespaced owner key such as `mcp-server:<serverId>` so it can't collide with a real agent ID. Mastra doesn't enforce this.
|
|
417
|
+
|
|
418
|
+
Non-agent owners usually register a static executor with `registerStaticExecutor()` so any process can run or recover their tasks. They can also set these optional task fields:
|
|
419
|
+
|
|
420
|
+
- `expiresAt`: When cleanup deletes the task. Once a task completes, fails, is cancelled, or times out, cleanup deletes it after `expiresAt` passes instead of using `completedTtlMs` or `failedTtlMs`. Cleanup only runs when you set the `cleanup` option, and it never deletes a pending, running, or suspended task, so cancel expired work first. It also needs a storage adapter version that supports `expiresAt`. Older adapters keep using the global retention settings.
|
|
421
|
+
- `metadata`: JSON stored with the task. The manager doesn't read it.
|
|
422
|
+
|
|
423
|
+
```typescript
|
|
424
|
+
mastra.backgroundTaskManager?.registerStaticExecutor('mcp-server:ops:deploy', {
|
|
425
|
+
execute: runDeploy,
|
|
426
|
+
})
|
|
427
|
+
|
|
428
|
+
await mastra.backgroundTaskManager?.enqueue({
|
|
429
|
+
agentId: 'mcp-server:ops',
|
|
430
|
+
toolName: 'mcp-server:ops:deploy',
|
|
431
|
+
toolCallId: taskId,
|
|
432
|
+
runId: taskId,
|
|
433
|
+
args,
|
|
434
|
+
resourceId: principalId,
|
|
435
|
+
expiresAt: new Date(Date.now() + 24 * 60 * 60 * 1000),
|
|
436
|
+
metadata: { ttlMs: 86_400_000 },
|
|
437
|
+
})
|
|
438
|
+
```
|
|
439
|
+
|
|
440
|
+
Use `perOwnerConcurrency` to give an owner its own concurrency limit instead of `perAgentConcurrency`. Its tasks still count toward `globalConcurrency`:
|
|
441
|
+
|
|
442
|
+
```typescript
|
|
443
|
+
export const mastra = new Mastra({
|
|
444
|
+
storage,
|
|
445
|
+
backgroundTasks: {
|
|
446
|
+
enabled: true,
|
|
447
|
+
globalConcurrency: 60,
|
|
448
|
+
perOwnerConcurrency: { 'mcp-server:ops': 50 },
|
|
449
|
+
},
|
|
450
|
+
})
|
|
451
|
+
```
|
|
452
|
+
|
|
453
|
+
Known limitations:
|
|
454
|
+
|
|
455
|
+
- A recovered task runs without the original request. Store anything the executor needs, such as the principal in `resourceId` or other JSON in `metadata`, on the task itself.
|
|
456
|
+
- A `pending` task that isn't pinned holds no lease. On startup, another process can pick it up and dispatch it. If its executor only existed in the original process, the task fails with `No executor registered`. Static executors registered in every process avoid this. Use `pinToWorker` when the original process already started the work.
|
|
457
|
+
- The end-of-step wait in the agent loop only waits for `running` tasks, not `pending` ones. [#28228](https://github.com/mastra-ai/mastra/pull/28228) tracks the fix.
|
|
458
|
+
|
|
459
|
+
### Pin a task to the current worker
|
|
460
|
+
|
|
461
|
+
Sometimes work for a task is already running in this process before you enqueue it. For example, an MCP server may start a tool call inside the request and hand it to a background task only if it runs long. Pass `pinToWorker: true` with a task context so no other process starts the same work:
|
|
462
|
+
|
|
463
|
+
```typescript
|
|
464
|
+
await mastra.backgroundTaskManager?.enqueue(
|
|
465
|
+
{
|
|
466
|
+
agentId: 'mcp-server:ops',
|
|
467
|
+
toolName: 'mcp-server:ops:deploy',
|
|
468
|
+
toolCallId: taskId,
|
|
469
|
+
runId: taskId,
|
|
470
|
+
args,
|
|
471
|
+
},
|
|
472
|
+
{ executor: { execute: adoptRunningDeploy } },
|
|
473
|
+
{ pinToWorker: true },
|
|
474
|
+
)
|
|
475
|
+
```
|
|
476
|
+
|
|
477
|
+
`pinToWorker` means work for this task is already in flight on this worker. The `pending` task records this worker as its owner and holds an execution lease, which the worker renews while the task waits for a free slot. Other processes don't recover or dispatch the task while the lease is live.
|
|
478
|
+
|
|
479
|
+
If the worker dies or shuts down first, that work is lost. Recovery treats the task as a lost attempt, like a running task whose worker died. If `retryCount` is below `maxRetries`, the task uses a retry and runs on another worker, which needs a static executor for it. Otherwise the task fails with `Worker process terminated before task completed`. A task with `maxRetries: 0` never runs on another worker. Other processes check for lapsed pins at startup and then every `leaseDurationMs`, unless `recoverStaleTasksOnStart` is `false`.
|
|
480
|
+
|
|
481
|
+
A lapsed lease only shows that the worker stopped renewing it, not that the work stopped. A worker whose event loop stalls past the lease can still be running the task when another worker retries it. Make pinned work idempotent, or guard its side effects, if it can be retried.
|
|
482
|
+
|
|
483
|
+
`pinToWorker` throws without a task context. Tasks that aren't pinned, including all agent tasks, hold no lease while `pending`.
|
|
484
|
+
|
|
401
485
|
## Related
|
|
402
486
|
|
|
403
487
|
- [`Agent.stream()` reference](https://mastra.ai/reference/streaming/agents/stream)
|
package/.docs/docs/license.md
CHANGED
|
@@ -18,6 +18,26 @@ Mastra uses a dual-license model with the Apache License 2.0 for the majority of
|
|
|
18
18
|
|
|
19
19
|
- Content outside of the above-mentioned directories or restrictions is available under the "Apache License 2.0".
|
|
20
20
|
|
|
21
|
+
## What requires an EE license
|
|
22
|
+
|
|
23
|
+
Whether you need a Mastra Enterprise Edition (EE) license depends on which features you configure, not on which packages you install. The table shows which features need a license in production. Every feature works without a license in development and testing.
|
|
24
|
+
|
|
25
|
+
| Feature | EE license required in production |
|
|
26
|
+
| ------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | --------------------------------- |
|
|
27
|
+
| Authentication on API routes (`server.auth`) with any provider, including Simple Auth, JWT, Auth0, Better Auth, Clerk, Firebase, Google, Neon, Okta, Supabase, and WorkOS | No |
|
|
28
|
+
| Studio with Simple Auth, JWT, or Mastra platform auth | No |
|
|
29
|
+
| Studio sign-in screen (an SSO button or an email and password form) with a third-party provider | Yes |
|
|
30
|
+
| Role-based access control (RBAC) with `server.rbac` or `studio.rbac`, using any provider | Yes |
|
|
31
|
+
| Fine-grained authorization (FGA) with `server.fga` or `studio.fga` | Yes |
|
|
32
|
+
| Agent Builder | Yes |
|
|
33
|
+
|
|
34
|
+
### Without a license in production
|
|
35
|
+
|
|
36
|
+
Set your license key in the `MASTRA_LICENSE_KEY` environment variable. Mastra also reads the older `MASTRA_EE_LICENSE` variable. Without a valid key in production:
|
|
37
|
+
|
|
38
|
+
- **RBAC, FGA, or Agent Builder**: The server doesn't start, and the error names the feature that needs a license.
|
|
39
|
+
- **Studio sign-in screen with a third-party provider**: Studio hides the sign-in screen. Authentication on API routes keeps working.
|
|
40
|
+
|
|
21
41
|
## Apache License 2.0
|
|
22
42
|
|
|
23
43
|
```md
|
|
@@ -183,9 +183,34 @@ npx mastra api trace query '{
|
|
|
183
183
|
}'
|
|
184
184
|
```
|
|
185
185
|
|
|
186
|
-
Choose a time range containing your exported traces
|
|
186
|
+
Choose a time range containing your exported traces within your plan's data retention period, with `from` earlier than `to`. Results appear in `data.traces`.
|
|
187
187
|
|
|
188
|
-
Mastra Platform
|
|
188
|
+
Mastra Platform follows the same query and aggregate request structure as Mastra Server. Use the [Query traces and spans reference](https://mastra.ai/reference/observability/tracing/advanced-queries) for HTTP endpoints, filters, response shapes, pagination, and discovery:
|
|
189
|
+
|
|
190
|
+
| Task | CLI command | Reference |
|
|
191
|
+
| -------------------------------------------- | ---------------------------- | -------------------------------------------------------------------------------------- |
|
|
192
|
+
| Find matching traces | `mastra api trace query` | [Query traces](https://mastra.ai/reference/observability/tracing/advanced-queries) |
|
|
193
|
+
| Find individual spans, including nested runs | `mastra api span query` | [Query spans](https://mastra.ai/reference/observability/tracing/advanced-queries) |
|
|
194
|
+
| Measure matching traces | `mastra api trace aggregate` | [Aggregate traces](https://mastra.ai/reference/observability/tracing/advanced-queries) |
|
|
195
|
+
| Measure individual spans | `mastra api span aggregate` | [Aggregate spans](https://mastra.ai/reference/observability/tracing/advanced-queries) |
|
|
196
|
+
|
|
197
|
+
Pass the request as one JSON argument to each command. Responses are nested under `data`.
|
|
198
|
+
|
|
199
|
+
### Platform scope and differences
|
|
200
|
+
|
|
201
|
+
Use the `X-Mastra-Project-Id` HTTP header to select one project. The CLI sets it from `MASTRA_PROJECT_ID`, an explicit header, or your project configuration. Without a project scope, credentials authorized for organization-wide access can query across projects. Project-bound credentials remain restricted to their project. Project scoping is separate from predicates: don't put `projectId` in `where`.
|
|
202
|
+
|
|
203
|
+
Platform adds these fields and grouping options:
|
|
204
|
+
|
|
205
|
+
| Operation | Platform addition |
|
|
206
|
+
| ---------------------------------- | --------------------------------------------------------------------- |
|
|
207
|
+
| `queryTraces()` and `querySpans()` | Each result includes `projectId`. |
|
|
208
|
+
| `aggregateTraces()` | Supports `groupBy: ['projectId']` and `countDistinct.projectId`. |
|
|
209
|
+
| `aggregateSpans()` | Supports `groupBy: ['projectId']`, but not `countDistinct.projectId`. |
|
|
210
|
+
|
|
211
|
+
Data retention depends on your plan: 15 days for Starter, 6 months for Teams, and custom retention for Enterprise. See [pricing](https://mastra.ai/pricing) for current plan limits.
|
|
212
|
+
|
|
213
|
+
### Other observability data
|
|
189
214
|
|
|
190
215
|
You can query exported feedback over HTTP. See the [Feedback API](https://mastra.ai/docs/mastra-platform/api) for its current status, regional endpoints, authentication, project scoping, and supported query parameters such as `traceId` and `environment`.
|
|
191
216
|
|
|
@@ -295,10 +320,12 @@ npx mastra traces import langfuse \
|
|
|
295
320
|
|
|
296
321
|
Set `SINCE` and `UNTIL` to ISO 8601 dates or timestamps. The following rules apply:
|
|
297
322
|
|
|
298
|
-
- `--until`
|
|
299
|
-
- `--since` must be earlier than `--until` and
|
|
323
|
+
- `--until` must be within the last 30 days and can't be in the future.
|
|
324
|
+
- `--since` must be earlier than `--until` and within the last 30 days.
|
|
300
325
|
- The selected window can't exceed 30 days.
|
|
301
|
-
- If only `--until` is set, the default start is
|
|
326
|
+
- If only `--until` is set, the default start is 30 days before the current time.
|
|
327
|
+
|
|
328
|
+
This 30-day import window is separate from your plan's data retention period.
|
|
302
329
|
|
|
303
330
|
The earlier `--from` and `--to` names still work, but they're deprecated hidden aliases of `--since` and `--until` and don't appear in the command help. Use `--since` and `--until` in new commands.
|
|
304
331
|
|
|
@@ -141,24 +141,24 @@ const agent = new Agent({
|
|
|
141
141
|
|
|
142
142
|
Each vector store page below includes installation instructions, configuration parameters, and usage examples:
|
|
143
143
|
|
|
144
|
-
- [Astra](https://mastra.ai/
|
|
145
|
-
- [Chroma](https://mastra.ai/
|
|
146
|
-
- [Cloudflare Vectorize](https://mastra.ai/
|
|
147
|
-
- [Convex](https://mastra.ai/
|
|
148
|
-
- [Couchbase](https://mastra.ai/
|
|
149
|
-
- [DuckDB](https://mastra.ai/
|
|
150
|
-
- [Elasticsearch](https://mastra.ai/
|
|
151
|
-
- [LanceDB](https://mastra.ai/
|
|
152
|
-
- [libSQL](https://mastra.ai/
|
|
153
|
-
- [MongoDB](https://mastra.ai/
|
|
154
|
-
- [OpenSearch](https://mastra.ai/
|
|
155
|
-
- [OracleDB](https://mastra.ai/
|
|
156
|
-
- [Pinecone](https://mastra.ai/
|
|
157
|
-
- [PostgreSQL](https://mastra.ai/
|
|
158
|
-
- [Qdrant](https://mastra.ai/
|
|
159
|
-
- [S3 Vectors](https://mastra.ai/
|
|
160
|
-
- [Turbopuffer](https://mastra.ai/
|
|
161
|
-
- [Upstash](https://mastra.ai/
|
|
144
|
+
- [Astra](https://mastra.ai/integrations/vectors/astra)
|
|
145
|
+
- [Chroma](https://mastra.ai/integrations/vectors/chroma)
|
|
146
|
+
- [Cloudflare Vectorize](https://mastra.ai/integrations/vectors/vectorize)
|
|
147
|
+
- [Convex](https://mastra.ai/integrations/vectors/convex)
|
|
148
|
+
- [Couchbase](https://mastra.ai/integrations/vectors/couchbase)
|
|
149
|
+
- [DuckDB](https://mastra.ai/integrations/vectors/duckdb)
|
|
150
|
+
- [Elasticsearch](https://mastra.ai/integrations/vectors/elasticsearch)
|
|
151
|
+
- [LanceDB](https://mastra.ai/integrations/vectors/lance)
|
|
152
|
+
- [libSQL](https://mastra.ai/integrations/vectors/libsql)
|
|
153
|
+
- [MongoDB](https://mastra.ai/integrations/vectors/mongodb)
|
|
154
|
+
- [OpenSearch](https://mastra.ai/integrations/vectors/opensearch)
|
|
155
|
+
- [OracleDB](https://mastra.ai/integrations/vectors/oracledb)
|
|
156
|
+
- [Pinecone](https://mastra.ai/integrations/vectors/pinecone)
|
|
157
|
+
- [PostgreSQL](https://mastra.ai/integrations/vectors/pg)
|
|
158
|
+
- [Qdrant](https://mastra.ai/integrations/vectors/qdrant)
|
|
159
|
+
- [S3 Vectors](https://mastra.ai/integrations/vectors/s3vectors)
|
|
160
|
+
- [Turbopuffer](https://mastra.ai/integrations/vectors/turbopuffer)
|
|
161
|
+
- [Upstash](https://mastra.ai/integrations/vectors/upstash)
|
|
162
162
|
|
|
163
163
|
## Recall configuration
|
|
164
164
|
|
|
@@ -250,7 +250,7 @@ const options = {
|
|
|
250
250
|
|
|
251
251
|
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.
|
|
252
252
|
|
|
253
|
-
MongoDB does this through [Automated Embedding](https://mastra.ai/
|
|
253
|
+
MongoDB does this through [Automated Embedding](https://mastra.ai/integrations/vectors/mongodb): name a Voyage AI model on the vector store and leave the `embedder` out.
|
|
254
254
|
|
|
255
255
|
```typescript
|
|
256
256
|
import { Memory } from '@mastra/memory'
|
|
@@ -467,7 +467,7 @@ const agent = new Agent({
|
|
|
467
467
|
})
|
|
468
468
|
```
|
|
469
469
|
|
|
470
|
-
For detailed information about index configuration options and performance tuning, see the [PgVector configuration guide](https://mastra.ai/
|
|
470
|
+
For detailed information about index configuration options and performance tuning, see the [PgVector configuration guide](https://mastra.ai/integrations/vectors/pg).
|
|
471
471
|
|
|
472
472
|
## Disable semantic recall
|
|
473
473
|
|
|
@@ -8,6 +8,8 @@ When you configure [authentication](https://mastra.ai/docs/auth/overview) on you
|
|
|
8
8
|
|
|
9
9
|
Without authentication, Studio and all API routes are publicly accessible.
|
|
10
10
|
|
|
11
|
+
> **Note:** In production, the Studio sign-in screen with a third-party provider, role-based access control (RBAC), and fine-grained authorization (FGA) require a Mastra Enterprise Edition (EE) license. Simple Auth, JWT, and authentication on API routes don't. Every feature works without a license in development. See [what requires an EE license](https://mastra.ai/docs/license). [Contact sales](https://mastra.ai/contact) for more information.
|
|
12
|
+
|
|
11
13
|
> **Note:** Studio deployed on Mastra platform works differently. By default, the platform injects its own auth so only your organization members can sign in, and your `server.auth` applies to API routes only. Set `MASTRA_PLATFORM_STUDIO_AUTH=disabled` to opt out. See [Authentication on Mastra platform](https://mastra.ai/docs/mastra-platform/studio).
|
|
12
14
|
|
|
13
15
|
## When to use Studio Auth
|
|
@@ -155,10 +157,6 @@ Studio adapts its login screen based on the auth provider:
|
|
|
155
157
|
|
|
156
158
|
Sign-up can be enabled or disabled per provider. When disabled, Studio hides the sign-up link and forces the sign-in form.
|
|
157
159
|
|
|
158
|
-
## EE licensing
|
|
159
|
-
|
|
160
|
-
Studio Auth features (SSO login, RBAC, permission-based UI) are part of the Mastra Enterprise Edition. A license is optional when using Simple Auth or running locally. Production deployments with third-party providers require a valid EE license from [Mastra sales](https://mastra.ai/contact).
|
|
161
|
-
|
|
162
160
|
## Related
|
|
163
161
|
|
|
164
162
|
- [Auth overview](https://mastra.ai/docs/auth/overview): Full list of supported auth providers.
|
|
@@ -14,7 +14,7 @@ All require an observability storage backend to be configured.
|
|
|
14
14
|
|
|
15
15
|
## Quickstart
|
|
16
16
|
|
|
17
|
-
For detailed instructions, follow the [observability instructions](https://mastra.ai/docs/observability/overview). To get up and running quickly, add the `@mastra/observability` package to your project and configure it with [LibSQL](https://mastra.ai/integrations/databases/libsql) and [DuckDB](https://mastra.ai/
|
|
17
|
+
For detailed instructions, follow the [observability instructions](https://mastra.ai/docs/observability/overview). To get up and running quickly, add the `@mastra/observability` package to your project and configure it with [LibSQL](https://mastra.ai/integrations/databases/libsql) and [DuckDB](https://mastra.ai/integrations/vectors/duckdb) for a local development setup that supports both traces and metrics.
|
|
18
18
|
|
|
19
19
|
**npm**:
|
|
20
20
|
|
|
@@ -303,6 +303,8 @@ sendMessage(
|
|
|
303
303
|
|
|
304
304
|
`suspended` is the `data` of the latest `data-tool-call-suspended` part in `messages`.
|
|
305
305
|
|
|
306
|
+
When the tool runs inside a [subagent](https://mastra.ai/docs/agents/human-in-the-loop), `toolCallId` on `data-tool-call-suspended` and `data-tool-call-approval` parts is the supervisor's call to the subagent. The parts also include `delegatedToolCallId` and `delegatedToolName`, which name the subagent's tool call that paused. Use them to label the prompt you render, and keep using `runId` and `toolCallId` to resume.
|
|
307
|
+
|
|
306
308
|
## Using Mastra Memory
|
|
307
309
|
|
|
308
310
|
When your agent has [memory](https://mastra.ai/docs/memory/overview) configured, Mastra loads conversation history from storage on the server. Send only the new message from the client instead of the full conversation history.
|
|
@@ -110,6 +110,8 @@ export const mastra = new Mastra({
|
|
|
110
110
|
|
|
111
111
|
### Auth with Google Groups RBAC
|
|
112
112
|
|
|
113
|
+
> **Note:** RBAC requires a Mastra Enterprise Edition (EE) license in production. It works without a license in development. See [what requires an EE license](https://mastra.ai/docs/license). [Contact sales](https://mastra.ai/contact) for more information.
|
|
114
|
+
|
|
113
115
|
Add `MastraRBACGoogle` to map Google Workspace groups to Mastra permissions:
|
|
114
116
|
|
|
115
117
|
```typescript
|
|
@@ -75,6 +75,8 @@ export const mastra = new Mastra({
|
|
|
75
75
|
|
|
76
76
|
### Auth with RBAC
|
|
77
77
|
|
|
78
|
+
> **Note:** RBAC requires a Mastra Enterprise Edition (EE) license in production. It works without a license in development. See [what requires an EE license](https://mastra.ai/docs/license). [Contact sales](https://mastra.ai/contact) for more information.
|
|
79
|
+
|
|
78
80
|
Add `MastraRBACOkta` to map Okta groups to Mastra permissions:
|
|
79
81
|
|
|
80
82
|
```typescript
|
|
@@ -91,6 +91,8 @@ By default, `MastraAuthWorkos` grants access to any authenticated WorkOS user. T
|
|
|
91
91
|
|
|
92
92
|
### FGA membership loading
|
|
93
93
|
|
|
94
|
+
> **Note:** FGA requires a Mastra Enterprise Edition (EE) license in production. It works without a license in development. See [what requires an EE license](https://mastra.ai/docs/license). [Contact sales](https://mastra.ai/contact) for more information.
|
|
95
|
+
|
|
94
96
|
Set `fetchMemberships: true` when you use [`MastraFGAWorkos`](https://mastra.ai/docs/auth/fga). This tells the auth provider to load the user's WorkOS organization memberships during authentication so FGA checks can resolve the correct organization membership ID.
|
|
95
97
|
|
|
96
98
|
```typescript
|
|
@@ -230,5 +230,5 @@ Set these environment variables for your deployment:
|
|
|
230
230
|
|
|
231
231
|
## Related
|
|
232
232
|
|
|
233
|
-
- [Convex Vector Store](https://mastra.ai/
|
|
233
|
+
- [Convex Vector Store](https://mastra.ai/integrations/vectors/convex)
|
|
234
234
|
- [Convex Documentation](https://docs.convex.dev/)
|
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
|
|
7
7
|
[DuckDB](https://duckdb.org/) is an embedded, in-process analytical database. The `@mastra/duckdb` package provides an OLAP-backed observability store for local development, suitable for traces, logs, metrics, scores, and feedback without running an external service.
|
|
8
8
|
|
|
9
|
-
For vector search, see the [DuckDB vector store reference](https://mastra.ai/
|
|
9
|
+
For vector search, see the [DuckDB vector store reference](https://mastra.ai/integrations/vectors/duckdb), which is a separate API in the same package.
|
|
10
10
|
|
|
11
11
|
## When to use DuckDB
|
|
12
12
|
|
|
@@ -154,5 +154,5 @@ DuckDB supports the `event-sourced` strategy used by `MastraStorageExporter`, wh
|
|
|
154
154
|
- [Storage overview](https://mastra.ai/reference/storage/overview)
|
|
155
155
|
- [Composite storage](https://mastra.ai/reference/storage/composite)
|
|
156
156
|
- [ClickHouse storage](https://mastra.ai/integrations/databases/clickhouse): Production observability backend
|
|
157
|
-
- [DuckDB vector store](https://mastra.ai/
|
|
157
|
+
- [DuckDB vector store](https://mastra.ai/integrations/vectors/duckdb): Vector search using the same package
|
|
158
158
|
- [Observability overview](https://mastra.ai/docs/observability/overview)
|
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
|
|
7
7
|
[libSQL](https://docs.turso.tech/libsql) is an open-source, SQLite-compatible database that supports both local and remote deployments. It can be used to store message history, workflow snapshots, traces, and eval scores.
|
|
8
8
|
|
|
9
|
-
For vectors like semantic recall or traditional RAG, use [libSQL Vector](https://mastra.ai/
|
|
9
|
+
For vectors like semantic recall or traditional RAG, use [libSQL Vector](https://mastra.ai/integrations/vectors/libsql) which covers embeddings and vector search.
|
|
10
10
|
|
|
11
11
|
## Installation
|
|
12
12
|
|
|
@@ -194,7 +194,7 @@ await storage.close()
|
|
|
194
194
|
|
|
195
195
|
## Vector search capabilities
|
|
196
196
|
|
|
197
|
-
MongoDB storage includes built-in vector search capabilities for AI applications. For detailed vector operations including index creation, upserting embeddings, similarity search, and metadata filtering, see the [MongoDB vector reference](https://mastra.ai/
|
|
197
|
+
MongoDB storage includes built-in vector search capabilities for AI applications. For detailed vector operations including index creation, upserting embeddings, similarity search, and metadata filtering, see the [MongoDB vector reference](https://mastra.ai/integrations/vectors/mongodb).
|
|
198
198
|
|
|
199
199
|
## Usage example
|
|
200
200
|
|
|
@@ -207,7 +207,7 @@ See [Neon connection pooling](https://neon.com/docs/connect/connection-pooling)
|
|
|
207
207
|
|
|
208
208
|
## Vector search
|
|
209
209
|
|
|
210
|
-
Neon supports the [`pgvector` extension](https://neon.com/docs/extensions/pgvector). Use the direct `DATABASE_URL_UNPOOLED` connection while creating the extension and indexes. After setup, configure [`PgVector`](https://mastra.ai/
|
|
210
|
+
Neon supports the [`pgvector` extension](https://neon.com/docs/extensions/pgvector). Use the direct `DATABASE_URL_UNPOOLED` connection while creating the extension and indexes. After setup, configure [`PgVector`](https://mastra.ai/integrations/vectors/pg) with the pooled connection for runtime queries:
|
|
211
211
|
|
|
212
212
|
```typescript
|
|
213
213
|
import { PgVector } from '@mastra/pg'
|
|
@@ -235,7 +235,7 @@ export const oracleAgent = new Agent({
|
|
|
235
235
|
|
|
236
236
|
## Related
|
|
237
237
|
|
|
238
|
-
- [OracleDB vector store](https://mastra.ai/
|
|
238
|
+
- [OracleDB vector store](https://mastra.ai/integrations/vectors/oracledb)
|
|
239
239
|
- [Storage overview](https://mastra.ai/reference/storage/overview)
|
|
240
240
|
- [Working memory](https://mastra.ai/docs/memory/working-memory)
|
|
241
241
|
- [Workflow snapshots](https://mastra.ai/docs/workflows/snapshots)
|
|
@@ -311,7 +311,7 @@ Before enabling workers:
|
|
|
311
311
|
- **A storage backend that supports the `schedules` domain**, if you enable the scheduler: PostgreSQL, LibSQL, MySQL, MongoDB, Spanner, or Convex. Redis and ClickHouse don't support it, and the scheduler won't find due schedules on them.
|
|
312
312
|
- **`mastra-server.workers.splitDeployment: true`.** Without it the API keeps running workers in-process and every worker runs twice, double-firing every cron schedule. The chart refuses to render if you enable workers without it.
|
|
313
313
|
|
|
314
|
-
> **Redis eviction policy:** Set `maxmemory-policy` to `noeviction`
|
|
314
|
+
> **Redis eviction policy:** Set `maxmemory-policy` to `noeviction` on Redis or Valkey. Every evicting policy deletes live Mastra state under memory pressure: `allkeys-*` policies evict unacknowledged workflow events, and `volatile-*` policies evict lease keys and streams, which carry a TTL by default. Runs then stall without a run error. `RedisStreamsPubSub` and `ValkeyStreamsPubSub` log a one-time warning after they first connect when the policy can evict. On managed Redis this is a parameter-group setting, and Amazon ElastiCache defaults to `volatile-lru`.
|
|
315
315
|
|
|
316
316
|
### Build the worker artifact into your image
|
|
317
317
|
|
|
@@ -193,6 +193,12 @@ console.log('Braintrust row and span ID:', result.spanId)
|
|
|
193
193
|
|
|
194
194
|
The same applies to `agent.generate()` and workflow run results (`run.start()`, `run.stream()` final state, `run.resume()`).
|
|
195
195
|
|
|
196
|
+
## Cost tracking
|
|
197
|
+
|
|
198
|
+
When the model provider reports the cost of a request, as OpenRouter and Vercel AI Gateway do, the exporter sends that cost to Braintrust. Braintrust then shows the amount the provider charged instead of an estimate from its own model prices. Generations without a reported cost keep Braintrust's estimate.
|
|
199
|
+
|
|
200
|
+
See the [`BraintrustExporter` reference](https://mastra.ai/reference/observability/tracing/exporters/braintrust) for the exact rules.
|
|
201
|
+
|
|
196
202
|
## Related
|
|
197
203
|
|
|
198
204
|
- [Tracing Overview](https://mastra.ai/docs/observability/tracing/overview)
|
|
@@ -370,7 +370,7 @@ For Daytona-specific desktop APIs (regions, compressed screenshots, screen recor
|
|
|
370
370
|
|
|
371
371
|
**apiKey** (`string`): Daytona API key for authentication. Falls back to DAYTONA_API_KEY environment variable.
|
|
372
372
|
|
|
373
|
-
**apiUrl** (`string`): Daytona API endpoint. Falls back to DAYTONA_API_URL environment variable.
|
|
373
|
+
**apiUrl** (`string`): Daytona API endpoint. Falls back to the DAYTONA_API_URL process environment variable, or the deprecated DAYTONA_SERVER_URL (the SDK no longer reads either from .env files). If a .env, .env.local or .env.development file in the working directory also defines one of these variables, as is common with mastra dev, the sandbox fails to start with an "endpoint is ambiguous" error. For self-hosted Daytona, pass the endpoint explicitly, for example apiUrl: process.env.DAYTONA_API_URL.
|
|
374
374
|
|
|
375
375
|
**target** (`string`): Runner region. Falls back to DAYTONA_TARGET environment variable.
|
|
376
376
|
|
|
@@ -84,6 +84,10 @@ interface IndexStats {
|
|
|
84
84
|
|
|
85
85
|
**id** (`string`): ID of the vector to delete
|
|
86
86
|
|
|
87
|
+
### `deleteVectors()`
|
|
88
|
+
|
|
89
|
+
Not implemented for Astra. Calling it throws a `MastraError` with the ID `MASTRA_VECTOR_ASTRA_DELETE_VECTORS_NOT_SUPPORTED`. Delete vectors one at a time with `deleteVector()` instead.
|
|
90
|
+
|
|
87
91
|
## Response types
|
|
88
92
|
|
|
89
93
|
Query results are returned in this format:
|
|
@@ -6,16 +6,10 @@
|
|
|
6
6
|
|
|
7
7
|
The ChromaVector class provides vector search using [Chroma](https://docs.trychroma.com/docs/overview/getting-started), an open-source embedding database. It offers efficient vector search with metadata filtering and hybrid search capabilities.
|
|
8
8
|
|
|
9
|
-
> **Note:**
|
|
10
|
-
>
|
|
11
|
-
> **Chroma Cloud**
|
|
12
|
-
>
|
|
13
|
-
> Chroma Cloud powers serverless vector and full-text search. It's extremely fast, cost-effective, high-capacity, and painless. Create a DB and try it out in under 30 seconds with $5 of free credits.
|
|
14
|
-
>
|
|
15
|
-
> [Get started with Chroma Cloud](https://trychroma.com/signup)
|
|
16
|
-
|
|
17
9
|
## Constructor options
|
|
18
10
|
|
|
11
|
+
**id** (`string`): Unique identifier for this vector store instance
|
|
12
|
+
|
|
19
13
|
**host** (`string`): The host address of the Chroma server. Defaults to 'localhost'
|
|
20
14
|
|
|
21
15
|
**port** (`number`): The port number of the Chroma server. Defaults to 8000
|
|
@@ -58,7 +52,7 @@ Otherwise, you have several options for setting up your single-node Chroma serve
|
|
|
58
52
|
|
|
59
53
|
Note: Forking is only supported on Chroma Cloud, or if you deploy your own OSS **distributed** Chroma.
|
|
60
54
|
|
|
61
|
-
`forkIndex` instantly forks an existing Chroma index without affecting the original index. Learn more on the [Chroma docs](https://docs.trychroma.com/cloud/collection-forking).
|
|
55
|
+
`forkIndex` instantly forks an existing Chroma index without affecting the original index. Learn more on the [Chroma docs](https://docs.trychroma.com/cloud/features/collection-forking).
|
|
62
56
|
|
|
63
57
|
**indexName** (`string`): Name of the index to fork
|
|
64
58
|
|
|
@@ -133,6 +127,16 @@ You can also provide the shape of your metadata to a `get` call for type inferen
|
|
|
133
127
|
|
|
134
128
|
**offset** (`number`): Offset for returning records. Use with limit to paginate results.
|
|
135
129
|
|
|
130
|
+
### `hybridSearch()`
|
|
131
|
+
|
|
132
|
+
Note: The Search API is only supported on Chroma Cloud, or if you deploy your own OSS **distributed** Chroma. A local single-node server doesn't support it.
|
|
133
|
+
|
|
134
|
+
Run a [Chroma Search API](https://docs.trychroma.com/cloud/search-api/overview) request against an index. It exposes Chroma's native search, including hybrid ranking across dense and sparse keys, which the standard vector methods don't cover.
|
|
135
|
+
|
|
136
|
+
**indexName** (`string`): Name of the index to search
|
|
137
|
+
|
|
138
|
+
**search** (`Search`): A Chroma Search request, including ranking, filters, and the fields to return
|
|
139
|
+
|
|
136
140
|
### `listIndexes()`
|
|
137
141
|
|
|
138
142
|
Returns an array of index names as strings.
|
|
@@ -42,6 +42,8 @@ Before using `ConvexVector`, you need to set up the Convex schema and storage ha
|
|
|
42
42
|
|
|
43
43
|
## Constructor options
|
|
44
44
|
|
|
45
|
+
**id** (`string`): Unique identifier for this vector store instance
|
|
46
|
+
|
|
45
47
|
**deploymentUrl** (`string`): Convex deployment URL (e.g., https\://your-project.convex.cloud)
|
|
46
48
|
|
|
47
49
|
**adminAuthToken** (`string`): Convex admin authentication token
|
|
@@ -271,6 +273,16 @@ Deletes the index and all its vectors.
|
|
|
271
273
|
await vectorStore.deleteIndex({ indexName: 'my_vectors' })
|
|
272
274
|
```
|
|
273
275
|
|
|
276
|
+
### `truncateIndex()`
|
|
277
|
+
|
|
278
|
+
Deletes every vector in an index while keeping the index itself. Rows are removed in batches so each mutation stays within Convex's per-mutation time limit. This method is available on `ConvexVector`; `ConvexNativeVector` uses Convex's own table operations instead.
|
|
279
|
+
|
|
280
|
+
**indexName** (`string`): Name of the index to clear
|
|
281
|
+
|
|
282
|
+
```typescript
|
|
283
|
+
await vectorStore.truncateIndex({ indexName: 'my_vectors' })
|
|
284
|
+
```
|
|
285
|
+
|
|
274
286
|
### `updateVector()`
|
|
275
287
|
|
|
276
288
|
Update a single vector by ID or by metadata filter. Either `id` or `filter` must be provided, but not both.
|
|
@@ -73,7 +73,11 @@ const results = await store.query({
|
|
|
73
73
|
|
|
74
74
|
**id** (`string`): Unique identifier for this vector store instance
|
|
75
75
|
|
|
76
|
-
**url** (`string`): Elasticsearch connection URL (e.g., 'http\://localhost:9200')
|
|
76
|
+
**url** (`string`): Elasticsearch connection URL (e.g., 'http\://localhost:9200'). Provide either url or client.
|
|
77
|
+
|
|
78
|
+
**client** (`ElasticSearchClient`): A pre-configured Elasticsearch client. Use it instead of url to control connection settings yourself.
|
|
79
|
+
|
|
80
|
+
**auth** (`ElasticSearchAuth`): Authentication for the url form: { apiKey }, { username, password }, or { bearer }. Not used with client.
|
|
77
81
|
|
|
78
82
|
## Methods
|
|
79
83
|
|
|
@@ -12,7 +12,7 @@ The LanceVectorStore uses a factory pattern for creation. You should use the sta
|
|
|
12
12
|
|
|
13
13
|
**uri** (`string`): Path to LanceDB database or URI for cloud deployments
|
|
14
14
|
|
|
15
|
-
**options** (`ConnectionOptions`): Additional connection options for LanceDB
|
|
15
|
+
**options** (`ConnectionOptions & { id?: string }`): Additional connection options for LanceDB. Pass id to name the store; otherwise a random UUID is used.
|
|
16
16
|
|
|
17
17
|
## Constructor examples
|
|
18
18
|
|
|
@@ -75,6 +75,8 @@ const results = await store.query({
|
|
|
75
75
|
|
|
76
76
|
## Constructor options
|
|
77
77
|
|
|
78
|
+
**id** (`string`): Unique identifier for this vector store instance
|
|
79
|
+
|
|
78
80
|
**url** (`string`): libSQL database URL. Use ':memory:' for in-memory database, 'file:dbname.db' for local file, or a libSQL-compatible connection string like 'libsql://your-database.turso.io'.
|
|
79
81
|
|
|
80
82
|
**authToken** (`string`): Authentication token for Turso cloud databases
|
|
@@ -83,6 +85,12 @@ const results = await store.query({
|
|
|
83
85
|
|
|
84
86
|
**syncInterval** (`number`): Interval in milliseconds for database sync (Turso specific)
|
|
85
87
|
|
|
88
|
+
**maxRetries** (`number`): Total attempts allowed for a write that hits a database lock (SQLITE_BUSY, SQLITE_LOCKED, or a "database is locked" error). The default of 5 means one attempt plus at most four retries. Use at least 1: with 0 the write is never attempted and the call throws (Default: `5`)
|
|
89
|
+
|
|
90
|
+
**initialBackoffMs** (`number`): Backoff before the first retry, in milliseconds. Each later retry waits twice as long (Default: `100`)
|
|
91
|
+
|
|
92
|
+
**vectorTopKOverFetchMultiplier** (`number`): Over-fetch multiplier for vector_top_k queries that have metadata filters. Higher values improve recall at the cost of scanning more rows. Must be a positive integer, or the constructor throws (Default: `10`)
|
|
93
|
+
|
|
86
94
|
## Methods
|
|
87
95
|
|
|
88
96
|
### `createIndex()`
|
|
@@ -191,6 +199,14 @@ Delete multiple vectors by IDs or by metadata filter. Either `ids` or `filter` m
|
|
|
191
199
|
|
|
192
200
|
**filter** (`Record<string, any>`): Metadata filter to identify vectors to delete (mutually exclusive with ids)
|
|
193
201
|
|
|
202
|
+
### `close()`
|
|
203
|
+
|
|
204
|
+
Closes the underlying libSQL client and releases the file handles this vector store holds. Calling it more than once is a no-op.
|
|
205
|
+
|
|
206
|
+
```typescript
|
|
207
|
+
await store.close()
|
|
208
|
+
```
|
|
209
|
+
|
|
194
210
|
## Response types
|
|
195
211
|
|
|
196
212
|
Query results are returned in this format:
|