@mastra/mcp-docs-server 1.2.4 → 1.2.5-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/agent-builder/deploying.md +1 -1
- package/.docs/docs/agent-controller/overview.md +1 -1
- package/.docs/docs/agent-controller/session.md +1 -1
- package/.docs/docs/agents/overview.md +1 -1
- package/.docs/docs/agents/processors.md +1 -1
- package/.docs/docs/agents/supervisor-agents.md +3 -3
- package/.docs/docs/agents/using-tools.md +1 -1
- package/.docs/docs/{agents → long-running-agents}/background-tasks.md +2 -2
- package/.docs/docs/{agents → long-running-agents}/durable-agents.md +2 -2
- package/.docs/docs/{agents → long-running-agents}/goals.md +1 -1
- package/.docs/docs/{agents → long-running-agents}/heartbeats.md +5 -5
- package/.docs/docs/{agents → long-running-agents}/signal-providers.md +4 -4
- package/.docs/docs/memory/working-memory.md +1 -1
- package/.docs/docs/observability/config.md +1 -2
- package/.docs/docs/server/pubsub.md +2 -2
- package/.docs/docs/voice/overview.md +3 -3
- package/.docs/docs/voice/speech-to-speech.md +81 -1
- package/.docs/docs/voice/speech-to-text.md +19 -1
- package/.docs/docs/voice/text-to-speech.md +21 -1
- package/.docs/docs/workflows/control-flow.md +1 -1
- package/.docs/docs/workflows/error-handling.md +1 -1
- package/.docs/docs/workflows/human-in-the-loop.md +1 -1
- package/.docs/docs/workflows/overview.md +1 -1
- package/.docs/docs/workflows/snapshots.md +1 -1
- package/.docs/docs/workflows/suspend-and-resume.md +1 -1
- package/.docs/docs/workflows/time-travel.md +1 -1
- package/.docs/docs/workflows/workflow-state.md +1 -1
- package/.docs/guides/build-your-ui/copilotkit/channels.md +76 -0
- package/.docs/guides/build-your-ui/copilotkit/generative-ui.md +174 -0
- package/.docs/guides/build-your-ui/copilotkit/overview.md +411 -0
- package/.docs/guides/concepts/streaming.md +1 -1
- package/.docs/guides/deployment/vercel.md +1 -2
- package/.docs/guides/guide/signal-provider.md +5 -5
- package/.docs/models/environment-variables.md +2 -0
- package/.docs/models/index.md +1 -1
- package/.docs/models/providers/alibaba-cn.md +2 -1
- package/.docs/models/providers/friendli.md +1 -2
- package/.docs/models/providers/kenari.md +95 -0
- package/.docs/models/providers/nvidia.md +2 -3
- package/.docs/models/providers/tencent-token-plan.md +7 -7
- package/.docs/models/providers/tencent-tokenhub.md +5 -4
- package/.docs/models/providers.md +2 -0
- package/.docs/reference/acp/acp-agent.md +5 -5
- package/.docs/reference/acp/create-acp-tool.md +5 -5
- package/.docs/reference/agent-controller/agent-controller-class.md +27 -27
- package/.docs/reference/agents/agent.md +34 -34
- package/.docs/reference/agents/channels.md +19 -19
- package/.docs/reference/agents/createSkill.md +2 -2
- package/.docs/reference/agents/durable-agent.md +22 -22
- package/.docs/reference/agents/generate.md +10 -10
- package/.docs/reference/agents/generateLegacy.md +12 -12
- package/.docs/reference/agents/getMetadata.md +1 -1
- package/.docs/reference/agents/getVoice.md +1 -1
- package/.docs/reference/agents/inngest-agent.md +9 -9
- package/.docs/reference/agents/network.md +1 -1
- package/.docs/reference/ai-sdk/chat-route.md +4 -4
- package/.docs/reference/ai-sdk/handle-chat-stream.md +6 -6
- package/.docs/reference/ai-sdk/handle-network-stream.md +3 -3
- package/.docs/reference/ai-sdk/handle-workflow-stream.md +1 -1
- package/.docs/reference/ai-sdk/network-route.md +4 -4
- package/.docs/reference/ai-sdk/to-ai-sdk-messages.md +1 -1
- package/.docs/reference/ai-sdk/to-ai-sdk-stream.md +1 -1
- package/.docs/reference/ai-sdk/with-mastra.md +2 -2
- package/.docs/reference/ai-sdk/workflow-route.md +2 -2
- package/.docs/reference/ai-sdk/workflow-snapshot-to-stream.md +1 -1
- package/.docs/reference/auth/google.md +10 -10
- package/.docs/reference/auth/okta.md +11 -11
- package/.docs/reference/auth/workos.md +3 -3
- package/.docs/reference/channels/slack-provider.md +15 -15
- package/.docs/reference/cli/mastra.md +145 -0
- package/.docs/reference/client-js/agents.md +9 -9
- package/.docs/reference/client-js/mastra-client.md +5 -5
- package/.docs/reference/client-js/responses.md +3 -3
- package/.docs/reference/configuration.md +1 -1
- package/.docs/reference/core/getAgentById.md +3 -3
- package/.docs/reference/core/getWorkflow.md +1 -1
- package/.docs/reference/core/listWorkflows.md +1 -1
- package/.docs/reference/core/mastra-class.md +3 -3
- package/.docs/reference/core/removeWorkspace.md +2 -2
- package/.docs/reference/datasets/compareExperiments.md +1 -1
- package/.docs/reference/datasets/getItemHistory.md +1 -1
- package/.docs/reference/datasets/list.md +5 -5
- package/.docs/reference/datasets/listExperimentResults.md +4 -4
- package/.docs/reference/datasets/listExperiments.md +4 -4
- package/.docs/reference/datasets/listItems.md +5 -5
- package/.docs/reference/datasets/listVersions.md +3 -3
- package/.docs/reference/datasets/startExperiment.md +8 -8
- package/.docs/reference/datasets/startExperimentAsync.md +1 -1
- package/.docs/reference/editor/agent-builder/agent-builder-options.md +4 -4
- package/.docs/reference/editor/agent-builder/builder-agent-defaults.md +7 -7
- package/.docs/reference/editor/agent-builder/builder-models.md +4 -4
- package/.docs/reference/editor/blob-store-provider.md +2 -2
- package/.docs/reference/editor/browser-provider.md +2 -2
- package/.docs/reference/editor/filesystem-provider.md +2 -2
- package/.docs/reference/editor/mastra-editor.md +2 -2
- package/.docs/reference/editor/processor-provider.md +4 -4
- package/.docs/reference/editor/sandbox-provider.md +2 -2
- package/.docs/reference/editor/storage-browser-ref.md +2 -2
- package/.docs/reference/editor/storage-workspace-ref.md +7 -7
- package/.docs/reference/evals/create-scorer.md +8 -8
- package/.docs/reference/evals/rubric.md +1 -1
- package/.docs/reference/evals/run-evals.md +7 -7
- package/.docs/reference/evals/trajectory-accuracy.md +1 -1
- package/.docs/reference/index.md +2 -2
- package/.docs/reference/logging/pino-logger.md +4 -4
- package/.docs/reference/memory/cloneThread.md +35 -4
- package/.docs/reference/memory/memory-class.md +5 -5
- package/.docs/reference/memory/observational-memory.md +43 -43
- package/.docs/reference/memory/recall.md +4 -4
- package/.docs/reference/memory/serialized-memory-config.md +6 -6
- package/.docs/reference/observability/tracing/configuration.md +4 -4
- package/.docs/reference/processors/language-detector.md +1 -1
- package/.docs/reference/processors/moderation-processor.md +1 -1
- package/.docs/reference/processors/pii-detector.md +1 -1
- package/.docs/reference/processors/processor-interface.md +20 -20
- package/.docs/reference/processors/prompt-injection-detector.md +1 -1
- package/.docs/reference/processors/response-cache.md +6 -6
- package/.docs/reference/processors/unicode-normalizer.md +1 -1
- package/.docs/reference/pubsub/base.md +7 -7
- package/.docs/reference/pubsub/caching-pubsub.md +1 -1
- package/.docs/reference/pubsub/event-emitter.md +2 -2
- package/.docs/reference/pubsub/google-cloud-pubsub.md +1 -1
- package/.docs/reference/pubsub/lease-provider.md +3 -3
- package/.docs/reference/pubsub/redis-streams.md +6 -6
- package/.docs/reference/pubsub/unix-socket-pubsub.md +1 -1
- package/.docs/reference/rag/chunk.md +2 -2
- package/.docs/reference/server/create-route.md +3 -3
- package/.docs/reference/server/express-adapter.md +4 -4
- package/.docs/reference/server/fastify-adapter.md +4 -4
- package/.docs/reference/server/hono-adapter.md +4 -4
- package/.docs/reference/server/koa-adapter.md +4 -4
- package/.docs/reference/server/mastra-server.md +1 -1
- package/.docs/reference/server/nestjs-adapter.md +3 -3
- package/.docs/reference/server/register-api-route.md +3 -3
- package/.docs/reference/signals/create-notification-inbox-tool.md +3 -3
- package/.docs/reference/signals/signal-provider.md +7 -7
- package/.docs/reference/signals/webhook-signal-provider.md +2 -2
- package/.docs/reference/storage/clickhouse.md +7 -7
- package/.docs/reference/storage/composite.md +2 -2
- package/.docs/reference/storage/duckdb.md +1 -1
- package/.docs/reference/storage/dynamodb.md +1 -1
- package/.docs/reference/storage/libsql.md +1 -1
- package/.docs/reference/storage/postgresql.md +2 -2
- package/.docs/reference/storage/redis.md +2 -2
- package/.docs/reference/storage/retention.md +5 -5
- package/.docs/reference/storage/spanner.md +6 -6
- package/.docs/reference/streaming/ChunkType.md +3 -3
- package/.docs/reference/streaming/agents/stream.md +14 -14
- package/.docs/reference/streaming/agents/streamLegacy.md +10 -10
- package/.docs/reference/streaming/agents/streamUntilIdle.md +1 -1
- package/.docs/reference/streaming/workflows/resumeStream.md +1 -1
- package/.docs/reference/templates/overview.md +1 -140
- package/.docs/reference/tools/brightdata.md +4 -4
- package/.docs/reference/tools/create-code-mode.md +5 -5
- package/.docs/reference/tools/create-tool.md +15 -15
- package/.docs/reference/tools/graph-rag-tool.md +1 -1
- package/.docs/reference/tools/mcp-client.md +2 -2
- package/.docs/reference/tools/mcp-server.md +12 -12
- package/.docs/reference/tools/perplexity.md +3 -3
- package/.docs/reference/tools/tavily.md +1 -1
- package/.docs/reference/tools/vector-query-tool.md +1 -1
- package/.docs/reference/vectors/chroma.md +1 -1
- package/.docs/reference/vectors/mongodb.md +1 -1
- package/.docs/reference/vectors/pg.md +1 -1
- package/.docs/reference/vectors/s3vectors.md +4 -4
- package/.docs/reference/voice/google-gemini-live.md +3 -3
- package/.docs/reference/voice/inworld-realtime.md +12 -12
- package/.docs/reference/voice/inworld.md +2 -2
- package/.docs/reference/voice/voice.on.md +1 -1
- package/.docs/reference/workflows/run-methods/resume.md +1 -1
- package/.docs/reference/workflows/run-methods/timeTravel.md +1 -1
- package/.docs/reference/workspace/agentcore-runtime-sandbox.md +4 -4
- package/.docs/reference/workspace/agentfs-filesystem.md +1 -1
- package/.docs/reference/workspace/apple-container-sandbox.md +5 -5
- package/.docs/reference/workspace/archil-filesystem.md +5 -5
- package/.docs/reference/workspace/blaxel-sandbox.md +1 -1
- package/.docs/reference/workspace/daytona-sandbox.md +1 -1
- package/.docs/reference/workspace/docker-sandbox.md +2 -2
- package/.docs/reference/workspace/e2b-sandbox.md +2 -2
- package/.docs/reference/workspace/files-sdk-filesystem.md +1 -1
- package/.docs/reference/workspace/filesystem.md +1 -1
- package/.docs/reference/workspace/local-filesystem.md +3 -3
- package/.docs/reference/workspace/local-sandbox.md +1 -1
- package/.docs/reference/workspace/mesa-filesystem.md +3 -3
- package/.docs/reference/workspace/modal-sandbox.md +1 -1
- package/.docs/reference/workspace/railway-sandbox.md +1 -1
- package/.docs/reference/workspace/s3-filesystem.md +4 -4
- package/.docs/reference/workspace/sandbox.md +1 -1
- package/.docs/reference/workspace/{vercel-microvm-sandbox.md → vercel-sandbox.md} +21 -15
- package/.docs/reference/workspace/{vercel.md → vercel-serverless.md} +21 -14
- package/.docs/reference/workspace/workspace-class.md +15 -15
- package/CHANGELOG.md +15 -0
- package/package.json +5 -5
- package/.docs/docs/agents/adding-voice.md +0 -383
- package/.docs/docs/community/contributing-templates.md +0 -5
- package/.docs/docs/community/discord.md +0 -11
- package/.docs/guides/build-your-ui/copilotkit.md +0 -291
- package/LICENSE.md +0 -30
- /package/.docs/docs/{community/licensing.md → license.md} +0 -0
- /package/.docs/docs/{agents → long-running-agents}/signals.md +0 -0
|
@@ -45,29 +45,29 @@ new MastraEditor({
|
|
|
45
45
|
|
|
46
46
|
## Properties
|
|
47
47
|
|
|
48
|
-
**memory** (`SerializedMemoryConfig`): Default memory configuration for new agents. Pass
|
|
48
|
+
**memory** (`SerializedMemoryConfig`): Default memory configuration for new agents. Pass { observationalMemory: true } to enable long-lived fact extraction. Requires Mastra.storage. See the SerializedMemoryConfig reference for the full schema.
|
|
49
49
|
|
|
50
|
-
**workspace** (`StorageWorkspaceRef`): Default workspace reference for new agents. Pass
|
|
50
|
+
**workspace** (`StorageWorkspaceRef`): Default workspace reference for new agents. Pass { type: 'inline', config } to embed a snapshot, or { type: 'id', workspaceId } to point at a workspace registered on Mastra.workspace. See the StorageWorkspaceRef reference for both variants.
|
|
51
51
|
|
|
52
|
-
**browser** (`StorageBrowserRef`): Default browser configuration for new agents. Pass
|
|
52
|
+
**browser** (`StorageBrowserRef`): Default browser configuration for new agents. Pass { type: 'inline', config: { provider } } to attach a registered browser provider. See the StorageBrowserRef reference for the full schema.
|
|
53
53
|
|
|
54
54
|
**models** (`{ allowed?: ProviderModelEntry[]; default?: DefaultModelEntry }`): Model allowlist and default applied to every Builder-created agent. See the BuilderModels reference for the full schema and validation rules.
|
|
55
55
|
|
|
56
56
|
**models.allowed** (`ProviderModelEntry[]`): Allowlist of providers and models. Omit to allow every registered model. ProviderModelEntry is a discriminated union (known providers vs. custom).
|
|
57
57
|
|
|
58
|
-
**models.default** (`DefaultModelEntry`): Pre-selected model on new-agent create. Required when the model picker is hidden. DefaultModelEntry requires
|
|
58
|
+
**models.default** (`DefaultModelEntry`): Pre-selected model on new-agent create. Required when the model picker is hidden. DefaultModelEntry requires provider and modelId, with an optional kind.
|
|
59
59
|
|
|
60
60
|
**tools** (`{ allowed?: string[] }`): Allowlist of tool IDs visible in the Builder tools picker. Unknown IDs are dropped and surfaced as warnings.
|
|
61
61
|
|
|
62
|
-
**tools.allowed** (`string[]`): Allowlist of
|
|
62
|
+
**tools.allowed** (`string[]`): Allowlist of tool.id values. Omit for unrestricted, pass \[] to lock the picker down, pass \[...ids] to restrict to the listed tools.
|
|
63
63
|
|
|
64
64
|
**agents** (`{ allowed?: string[] }`): Allowlist of agent IDs visible in the Builder sub-agents picker. Unknown IDs are dropped and surfaced as warnings.
|
|
65
65
|
|
|
66
|
-
**agents.allowed** (`string[]`): Allowlist of
|
|
66
|
+
**agents.allowed** (`string[]`): Allowlist of Agent.id values. Omit for unrestricted, pass \[] to lock the picker down, pass \[...ids] to restrict to the listed agents.
|
|
67
67
|
|
|
68
68
|
**workflows** (`{ allowed?: string[] }`): Allowlist of workflow IDs visible in the Builder workflows picker. Unknown IDs are dropped and surfaced as warnings.
|
|
69
69
|
|
|
70
|
-
**workflows.allowed** (`string[]`): Allowlist of
|
|
70
|
+
**workflows.allowed** (`string[]`): Allowlist of workflow\.id values. Omit for unrestricted, pass \[] to lock the picker down, pass \[...ids] to restrict to the listed workflows.
|
|
71
71
|
|
|
72
72
|
## Related
|
|
73
73
|
|
|
@@ -33,7 +33,7 @@ new MastraEditor({
|
|
|
33
33
|
|
|
34
34
|
**allowed** (`ProviderModelEntry[]`): Allowlist of providers and models. Omit to allow every registered model. When non-empty, only the listed entries are selectable in the Builder.
|
|
35
35
|
|
|
36
|
-
**allowed.provider** (`Provider`): Provider id from the generated provider registry (for example,
|
|
36
|
+
**allowed.provider** (`Provider`): Provider id from the generated provider registry (for example, openai, anthropic).
|
|
37
37
|
|
|
38
38
|
**allowed.modelId** (`ModelForProvider<Provider>`): Specific model id for that provider. Omit to allow every model under the provider.
|
|
39
39
|
|
|
@@ -43,13 +43,13 @@ new MastraEditor({
|
|
|
43
43
|
|
|
44
44
|
**allowed.modelId** (`string`): Specific model id under the custom provider. Omit to allow every model under it.
|
|
45
45
|
|
|
46
|
-
**default** (`DefaultModelEntry`): Pre-selected model on new-agent create. Same shape as
|
|
46
|
+
**default** (`DefaultModelEntry`): Pre-selected model on new-agent create. Same shape as ProviderModelEntry, but modelId is required. Must satisfy the allowed list when set.
|
|
47
47
|
|
|
48
|
-
**default.provider** (`Provider | string`): Provider id. Use a
|
|
48
|
+
**default.provider** (`Provider | string`): Provider id. Use a Provider literal for known providers, or any string with kind: 'custom'.
|
|
49
49
|
|
|
50
50
|
**default.modelId** (`string`): Required model id. Points at a specific model, not a whole provider.
|
|
51
51
|
|
|
52
|
-
**default.kind** (`'custom'`): Set to
|
|
52
|
+
**default.kind** (`'custom'`): Set to custom when targeting a provider that isn't in the generated registry.
|
|
53
53
|
|
|
54
54
|
## Validation rules
|
|
55
55
|
|
|
@@ -21,7 +21,7 @@ new MastraEditor({
|
|
|
21
21
|
|
|
22
22
|
## Properties
|
|
23
23
|
|
|
24
|
-
**id** (`string`): Unique provider identifier (for example,
|
|
24
|
+
**id** (`string`): Unique provider identifier (for example, "storage", "s3").
|
|
25
25
|
|
|
26
26
|
**name** (`string`): Human-readable name for UI display.
|
|
27
27
|
|
|
@@ -29,7 +29,7 @@ new MastraEditor({
|
|
|
29
29
|
|
|
30
30
|
**configSchema** (`Record<string, unknown>`): JSON Schema describing provider-specific configuration. Used by the UI to render config forms.
|
|
31
31
|
|
|
32
|
-
**createBlobStore** (`(config: TConfig) => BlobStore | Promise<BlobStore>`): Create a runtime
|
|
32
|
+
**createBlobStore** (`(config: TConfig) => BlobStore | Promise<BlobStore>`): Create a runtime BlobStore instance from the stored config. Called when the editor resolves a blob store via MastraEditor.resolveBlobStore(providerId, config).
|
|
33
33
|
|
|
34
34
|
## Implementing a provider
|
|
35
35
|
|
|
@@ -21,7 +21,7 @@ new MastraEditor({
|
|
|
21
21
|
|
|
22
22
|
## Properties
|
|
23
23
|
|
|
24
|
-
**id** (`string`): Unique provider identifier (for example,
|
|
24
|
+
**id** (`string`): Unique provider identifier (for example, "stagehand"). Must match StorageBrowserConfig.provider on every stored agent that uses this provider.
|
|
25
25
|
|
|
26
26
|
**name** (`string`): Human-readable name for UI display.
|
|
27
27
|
|
|
@@ -29,7 +29,7 @@ new MastraEditor({
|
|
|
29
29
|
|
|
30
30
|
**configSchema** (`Record<string, unknown>`): JSON Schema describing provider-specific configuration. Used by the UI to render config forms.
|
|
31
31
|
|
|
32
|
-
**createBrowser** (`(config: TConfig) => MastraBrowser | Promise<MastraBrowser>`): Create a runtime
|
|
32
|
+
**createBrowser** (`(config: TConfig) => MastraBrowser | Promise<MastraBrowser>`): Create a runtime MastraBrowser instance from the stored config. Called once per agent hydration; the resulting instance is cached alongside the agent.
|
|
33
33
|
|
|
34
34
|
## Implementing a provider
|
|
35
35
|
|
|
@@ -21,7 +21,7 @@ new MastraEditor({
|
|
|
21
21
|
|
|
22
22
|
## Properties
|
|
23
23
|
|
|
24
|
-
**id** (`string`): Unique provider identifier (for example,
|
|
24
|
+
**id** (`string`): Unique provider identifier (for example, "local", "s3"). Must match StorageFilesystemConfig.provider on every stored workspace that uses this provider.
|
|
25
25
|
|
|
26
26
|
**name** (`string`): Human-readable name for UI display.
|
|
27
27
|
|
|
@@ -29,7 +29,7 @@ new MastraEditor({
|
|
|
29
29
|
|
|
30
30
|
**configSchema** (`Record<string, unknown>`): JSON Schema describing provider-specific configuration. Used by the UI to render config forms.
|
|
31
31
|
|
|
32
|
-
**createFilesystem** (`(config: TConfig) => WorkspaceFilesystem | Promise<WorkspaceFilesystem>`): Create a runtime
|
|
32
|
+
**createFilesystem** (`(config: TConfig) => WorkspaceFilesystem | Promise<WorkspaceFilesystem>`): Create a runtime WorkspaceFilesystem instance from the stored config. Called at workspace hydration time.
|
|
33
33
|
|
|
34
34
|
## Implementing a provider
|
|
35
35
|
|
|
@@ -41,9 +41,9 @@ export const mastra = new Mastra({
|
|
|
41
41
|
|
|
42
42
|
**blobStores** (`Record<string, BlobStoreProvider>`): Blob storage providers for binary data (for example, S3). Falls back to the Mastra storage blob store if no provider is specified. (Default: `{}`)
|
|
43
43
|
|
|
44
|
-
**browsers** (`Record<string, BrowserProvider>`): Browser providers for agent browser access (for example, Stagehand). No built-ins — required when
|
|
44
|
+
**browsers** (`Record<string, BrowserProvider>`): Browser providers for agent browser access (for example, Stagehand). No built-ins — required when builder.features.agent.browser is enabled. See the BrowserProvider reference for the provider interface. (Default: `{}`)
|
|
45
45
|
|
|
46
|
-
**builder** (`AgentBuilderOptions`): Agent Builder configuration. See the AgentBuilderOptions reference. Omit or set
|
|
46
|
+
**builder** (`AgentBuilderOptions`): Agent Builder configuration. See the AgentBuilderOptions reference. Omit or set enabled: false to disable the Builder.
|
|
47
47
|
|
|
48
48
|
**source** (`'code' | 'db'`): Where agent overrides are stored. With 'db', overrides live in the configured storage backend and Studio shows the save and publish flow. With 'code', overrides live as per-agent JSON files on disk (routed through a local FilesystemStore) and Studio shows filesystem actions. See the Editor overview for the difference. (Default: `'db'`)
|
|
49
49
|
|
|
@@ -26,17 +26,17 @@ new MastraEditor({
|
|
|
26
26
|
|
|
27
27
|
**info** (`ProcessorProviderInfo`): Metadata about the provider.
|
|
28
28
|
|
|
29
|
-
**info.id** (`string`): Unique identifier (for example,
|
|
29
|
+
**info.id** (`string`): Unique identifier (for example, "moderation", "token-limiter").
|
|
30
30
|
|
|
31
31
|
**info.name** (`string`): Human-readable name.
|
|
32
32
|
|
|
33
33
|
**info.description** (`string`): Short description of the provider.
|
|
34
34
|
|
|
35
|
-
**configSchema** (`ZodSchema`): Zod schema describing the configuration this provider accepts. Used by the UI to render a form. The validated config object is passed to
|
|
35
|
+
**configSchema** (`ZodSchema`): Zod schema describing the configuration this provider accepts. Used by the UI to render a form. The validated config object is passed to createProcessor().
|
|
36
36
|
|
|
37
|
-
**availablePhases** (`ProcessorPhase[]`): Phases this provider's processors support. One or more of
|
|
37
|
+
**availablePhases** (`ProcessorPhase[]`): Phases this provider's processors support. One or more of 'processInput', 'processInputStep', 'processOutputStream', 'processOutputResult', 'processOutputStep'.
|
|
38
38
|
|
|
39
|
-
**createProcessor** (`(config: Record<string, unknown>) => Processor`): Create a
|
|
39
|
+
**createProcessor** (`(config: Record<string, unknown>) => Processor`): Create a Processor instance from the validated configuration. Called during agent hydration to resolve stored processor configs into live instances.
|
|
40
40
|
|
|
41
41
|
## Implementing a provider
|
|
42
42
|
|
|
@@ -21,7 +21,7 @@ new MastraEditor({
|
|
|
21
21
|
|
|
22
22
|
## Properties
|
|
23
23
|
|
|
24
|
-
**id** (`string`): Unique provider identifier (for example,
|
|
24
|
+
**id** (`string`): Unique provider identifier (for example, "local", "e2b"). Must match StorageSandboxConfig.provider on every stored workspace that uses this provider.
|
|
25
25
|
|
|
26
26
|
**name** (`string`): Human-readable name for UI display.
|
|
27
27
|
|
|
@@ -29,7 +29,7 @@ new MastraEditor({
|
|
|
29
29
|
|
|
30
30
|
**configSchema** (`Record<string, unknown>`): JSON Schema describing provider-specific configuration. Used by the UI to render config forms.
|
|
31
31
|
|
|
32
|
-
**createSandbox** (`(config: TConfig) => WorkspaceSandbox | Promise<WorkspaceSandbox>`): Create a runtime
|
|
32
|
+
**createSandbox** (`(config: TConfig) => WorkspaceSandbox | Promise<WorkspaceSandbox>`): Create a runtime WorkspaceSandbox instance from the stored config. Called at workspace hydration time.
|
|
33
33
|
|
|
34
34
|
## Implementing a provider
|
|
35
35
|
|
|
@@ -42,7 +42,7 @@ A `{ type: 'id' }` variant for browsers isn't available — they're always inlin
|
|
|
42
42
|
|
|
43
43
|
## Properties
|
|
44
44
|
|
|
45
|
-
**type** (`'inline'`): Discriminant. Must be the literal
|
|
45
|
+
**type** (`'inline'`): Discriminant. Must be the literal "inline".
|
|
46
46
|
|
|
47
47
|
**config** (`StorageBrowserConfig`): Provider id and per-instance browser configuration. See the section below.
|
|
48
48
|
|
|
@@ -50,7 +50,7 @@ A `{ type: 'id' }` variant for browsers isn't available — they're always inlin
|
|
|
50
50
|
|
|
51
51
|
The shape embedded under `config`. Defined in `@mastra/core/storage`.
|
|
52
52
|
|
|
53
|
-
**provider** (`string`): Provider identifier (for example,
|
|
53
|
+
**provider** (`string`): Provider identifier (for example, "stagehand"). Must match a BrowserProvider.id registered on MastraEditor.browsers. There are no built-in providers.
|
|
54
54
|
|
|
55
55
|
**headless** (`boolean`): Run the browser in headless mode (no visible UI). (Default: `true`)
|
|
56
56
|
|
|
@@ -47,17 +47,17 @@ new MastraEditor({
|
|
|
47
47
|
|
|
48
48
|
## Variants
|
|
49
49
|
|
|
50
|
-
**{ type: 'id'; workspaceId: string }** (`IdRef`): Reference a workspace registered on the Mastra runtime via
|
|
50
|
+
**{ type: 'id'; workspaceId: string }** (`IdRef`): Reference a workspace registered on the Mastra runtime via new Mastra({ workspace }) or mastra.addWorkspace(). The id is the join key between admin config, stored agent record, and hydration.
|
|
51
51
|
|
|
52
|
-
**{ type: 'id'; workspaceId: string }.type** (`'id'`): Discriminant. Must be the literal
|
|
52
|
+
**{ type: 'id'; workspaceId: string }.type** (`'id'`): Discriminant. Must be the literal "id".
|
|
53
53
|
|
|
54
54
|
**{ type: 'id'; workspaceId: string }.workspaceId** (`string`): Id of a workspace registered on the Mastra runtime. Used by the Builder to snapshot, persist, and later hydrate the workspace.
|
|
55
55
|
|
|
56
|
-
**{ type: 'inline'; config: StorageWorkspaceSnapshotType }** (`InlineRef`): Embed a workspace snapshot directly. The Builder derives a deterministic id of the form
|
|
56
|
+
**{ type: 'inline'; config: StorageWorkspaceSnapshotType }** (`InlineRef`): Embed a workspace snapshot directly. The Builder derives a deterministic id of the form inline-\<sha256(config)\[:12]> and persists the snapshot, so identical inline configs are deduplicated across agents.
|
|
57
57
|
|
|
58
|
-
**{ type: 'inline'; config: StorageWorkspaceSnapshotType }.type** (`'inline'`): Discriminant. Must be the literal
|
|
58
|
+
**{ type: 'inline'; config: StorageWorkspaceSnapshotType }.type** (`'inline'`): Discriminant. Must be the literal "inline".
|
|
59
59
|
|
|
60
|
-
**{ type: 'inline'; config: StorageWorkspaceSnapshotType }.config** (`StorageWorkspaceSnapshotType`): Serialized workspace configuration (filesystem, sandbox, mounts, search, skills, tools). See the
|
|
60
|
+
**{ type: 'inline'; config: StorageWorkspaceSnapshotType }.config** (`StorageWorkspaceSnapshotType`): Serialized workspace configuration (filesystem, sandbox, mounts, search, skills, tools). See the StorageWorkspaceSnapshotType section below for the field list.
|
|
61
61
|
|
|
62
62
|
## `StorageWorkspaceSnapshotType`
|
|
63
63
|
|
|
@@ -67,9 +67,9 @@ The shape embedded under `{ type: 'inline', config }`. Defined in `@mastra/core/
|
|
|
67
67
|
|
|
68
68
|
**description** (`string`): Purpose description shown in the workspace listing.
|
|
69
69
|
|
|
70
|
-
**filesystem** (`StorageFilesystemConfig`): Primary filesystem configuration.
|
|
70
|
+
**filesystem** (`StorageFilesystemConfig`): Primary filesystem configuration. provider must match an id registered on MastraEditor.filesystems (built-in: local).
|
|
71
71
|
|
|
72
|
-
**sandbox** (`StorageSandboxConfig`): Sandbox configuration.
|
|
72
|
+
**sandbox** (`StorageSandboxConfig`): Sandbox configuration. provider must match an id registered on MastraEditor.sandboxes (built-in: local).
|
|
73
73
|
|
|
74
74
|
**mounts** (`Record<string, StorageFilesystemConfig>`): Additional filesystems mounted on the workspace, keyed by mount path.
|
|
75
75
|
|
|
@@ -39,9 +39,9 @@ const scorer = createScorer({
|
|
|
39
39
|
|
|
40
40
|
## `createScorer` options
|
|
41
41
|
|
|
42
|
-
**id** (`string`): Unique identifier for the scorer. Used as the name if
|
|
42
|
+
**id** (`string`): Unique identifier for the scorer. Used as the name if name is not provided.
|
|
43
43
|
|
|
44
|
-
**name** (`string`): Name of the scorer. Defaults to
|
|
44
|
+
**name** (`string`): Name of the scorer. Defaults to id if not provided.
|
|
45
45
|
|
|
46
46
|
**description** (`string`): Description of what the scorer does.
|
|
47
47
|
|
|
@@ -51,11 +51,11 @@ const scorer = createScorer({
|
|
|
51
51
|
|
|
52
52
|
**judge.instructions** (`string`): System prompt/instructions for the LLM.
|
|
53
53
|
|
|
54
|
-
**judge.jsonPromptInjection** (`boolean`): When true, inject the JSON schema into the prompt instead of using the provider's native
|
|
54
|
+
**judge.jsonPromptInjection** (`boolean`): When true, inject the JSON schema into the prompt instead of using the provider's native response\_format API. Set this for models that don't support native structured output (e.g. some Groq Llama models) to avoid a wasted 400 call.
|
|
55
55
|
|
|
56
56
|
**type** (`string`): Type specification for input/output. Use 'agent' for automatic agent types. For custom types, use the generic approach instead.
|
|
57
57
|
|
|
58
|
-
**prepareRun** (`(run: ScorerRun) => ScorerRun | Promise<ScorerRun>`): Transform the scorer run data before the pipeline executes. Use this to filter messages, limit context size, or drop fields the scorer doesn't need. The
|
|
58
|
+
**prepareRun** (`(run: ScorerRun) => ScorerRun | Promise<ScorerRun>`): Transform the scorer run data before the pipeline executes. Use this to filter messages, limit context size, or drop fields the scorer doesn't need. The \`filterRun()\` utility creates this function from declarative options. Can be async.
|
|
59
59
|
|
|
60
60
|
This function returns a scorer builder that you can chain step methods onto. See the [MastraScorer reference](https://mastra.ai/reference/evals/mastra-scorer) for details on the `.run()` method and its input/output.
|
|
61
61
|
|
|
@@ -153,7 +153,7 @@ Optional preprocessing step that can extract or transform data before analysis.
|
|
|
153
153
|
|
|
154
154
|
**Function Mode:** Function: `({ run, results }) => any`
|
|
155
155
|
|
|
156
|
-
**run.input** (`any`): Input records provided to the scorer. If the scorer is added to an agent, this will be an array of user messages, e.g.
|
|
156
|
+
**run.input** (`any`): Input records provided to the scorer. If the scorer is added to an agent, this will be an array of user messages, e.g. \[{ role: 'user', content: 'hello world' }]. If the scorer is used in a workflow, this will be the input of the workflow.
|
|
157
157
|
|
|
158
158
|
**run.output** (`any`): Output record provided to the scorer. For agents, this is usually the agent's response. For workflows, this is the workflow's output.
|
|
159
159
|
|
|
@@ -182,7 +182,7 @@ Optional analysis step that processes the input/output and any preprocessed data
|
|
|
182
182
|
|
|
183
183
|
**Function Mode:** Function: `({ run, results }) => any`
|
|
184
184
|
|
|
185
|
-
**run.input** (`any`): Input records provided to the scorer. If the scorer is added to an agent, this will be an array of user messages, e.g.
|
|
185
|
+
**run.input** (`any`): Input records provided to the scorer. If the scorer is added to an agent, this will be an array of user messages, e.g. \[{ role: 'user', content: 'hello world' }]. If the scorer is used in a workflow, this will be the input of the workflow.
|
|
186
186
|
|
|
187
187
|
**run.output** (`any`): Output record provided to the scorer. For agents, this is usually the agent's response. For workflows, this is the workflow's output.
|
|
188
188
|
|
|
@@ -211,7 +211,7 @@ The method can return any value. The returned value will be available to subsequ
|
|
|
211
211
|
|
|
212
212
|
**Function Mode:** Function: `({ run, results }) => number`
|
|
213
213
|
|
|
214
|
-
**run.input** (`any`): Input records provided to the scorer. If the scorer is added to an agent, this will be an array of user messages, e.g.
|
|
214
|
+
**run.input** (`any`): Input records provided to the scorer. If the scorer is added to an agent, this will be an array of user messages, e.g. \[{ role: 'user', content: 'hello world' }]. If the scorer is used in a workflow, this will be the input of the workflow.
|
|
215
215
|
|
|
216
216
|
**run.output** (`any`): Output record provided to the scorer. For agents, this is usually the agent's response. For workflows, this is the workflow's output.
|
|
217
217
|
|
|
@@ -246,7 +246,7 @@ Optional step that provides an explanation for the score.
|
|
|
246
246
|
|
|
247
247
|
**Function Mode:** Function: `({ run, results, score }) => string`
|
|
248
248
|
|
|
249
|
-
**run.input** (`any`): Input records provided to the scorer. If the scorer is added to an agent, this will be an array of user messages, e.g.
|
|
249
|
+
**run.input** (`any`): Input records provided to the scorer. If the scorer is added to an agent, this will be an array of user messages, e.g. \[{ role: 'user', content: 'hello world' }]. If the scorer is used in a workflow, this will be the input of the workflow.
|
|
250
250
|
|
|
251
251
|
**run.output** (`any`): Output record provided to the scorer. For agents, this is usually the agent's response. For workflows, this is the workflow's output.
|
|
252
252
|
|
|
@@ -12,7 +12,7 @@ This scorer is designed to drop into [`isTaskComplete`](https://mastra.ai/refere
|
|
|
12
12
|
|
|
13
13
|
**model** (`MastraModelConfig`): The language model used to grade the output against the rubric. A smaller, cheaper model is usually sufficient for grading.
|
|
14
14
|
|
|
15
|
-
**criteria** (`RubricCriterion[] | string`): The rubric to grade against. A string is treated as a newline-delimited checklist (each line becomes a required criterion). If omitted, the rubric is read at run time from a
|
|
15
|
+
**criteria** (`RubricCriterion[] | string`): The rubric to grade against. A string is treated as a newline-delimited checklist (each line becomes a required criterion). If omitted, the rubric is read at run time from a rubric value on request/additional context; if none resolves, the scorer is a no-op and returns 1.
|
|
16
16
|
|
|
17
17
|
**options** (`RubricScorerOptions`): Configuration options for the scorer
|
|
18
18
|
|
|
@@ -56,9 +56,9 @@ result.thresholdResults // [{ id, passed, averageScore, threshold }]
|
|
|
56
56
|
|
|
57
57
|
**data** (`RunEvalsDataItem[]`): Array of test cases with input data and optional ground truth.
|
|
58
58
|
|
|
59
|
-
**scorers** (`ScorerEntry[] | AgentScorerConfig | WorkflowScorerConfig`): Scorers to use. Each entry is either a bare
|
|
59
|
+
**scorers** (`ScorerEntry[] | AgentScorerConfig | WorkflowScorerConfig`): Scorers to use. Each entry is either a bare MastraScorer or { scorer, threshold } for threshold tracking. An AgentScorerConfig object separates agent-level and trajectory scorers. A WorkflowScorerConfig object specifies scorers for the workflow, individual steps, and trajectory.
|
|
60
60
|
|
|
61
|
-
**gates** (`MastraScorer[]`): Scorers that must score 1.0 for the run to pass. If any gate averages below 1.0 across data items, the verdict is
|
|
61
|
+
**gates** (`MastraScorer[]`): Scorers that must score 1.0 for the run to pass. If any gate averages below 1.0 across data items, the verdict is failed. Gates run before regular scorers on each data item.
|
|
62
62
|
|
|
63
63
|
**targetOptions** (`AgentExecutionOptions | WorkflowRunOptions`): Options forwarded to the target during execution. For agents: options passed to agent.generate() (e.g. maxSteps, modelSettings, instructions). For workflows: options passed to run.start() (e.g. perStep, outputOptions, initialState).
|
|
64
64
|
|
|
@@ -72,7 +72,7 @@ result.thresholdResults // [{ id, passed, averageScore, threshold }]
|
|
|
72
72
|
|
|
73
73
|
**groundTruth** (`any`): Expected or reference output for comparison during scoring.
|
|
74
74
|
|
|
75
|
-
**expectedTrajectory** (`TrajectoryExpectation`): Expected trajectory configuration for trajectory scoring. Includes expected steps, ordering, efficiency budgets, blacklists, and tool failure tolerance. Passed to trajectory scorers as
|
|
75
|
+
**expectedTrajectory** (`TrajectoryExpectation`): Expected trajectory configuration for trajectory scoring. Includes expected steps, ordering, efficiency budgets, blacklists, and tool failure tolerance. Passed to trajectory scorers as run.expectedTrajectory. Overrides the static defaults in scorer constructors.
|
|
76
76
|
|
|
77
77
|
**requestContext** (`RequestContext`): Request Context to pass to the target during execution.
|
|
78
78
|
|
|
@@ -106,11 +106,11 @@ For workflows, use `WorkflowScorerConfig` to specify scorers at different levels
|
|
|
106
106
|
|
|
107
107
|
**summary.totalItems** (`number`): Total number of test cases processed.
|
|
108
108
|
|
|
109
|
-
**verdict** (`'passed' | 'scored' | 'failed'`): Present when
|
|
109
|
+
**verdict** (`'passed' | 'scored' | 'failed'`): Present when gates or threshold-bearing scorers are provided. passed = all gates and thresholds met. scored = gates passed but a threshold was missed. failed = at least one gate did not score 1.0.
|
|
110
110
|
|
|
111
|
-
**gateResults** (`GateResult[]`): Per-gate results averaged across all data items. Each entry has
|
|
111
|
+
**gateResults** (`GateResult[]`): Per-gate results averaged across all data items. Each entry has id, passed (boolean), and score (0–1).
|
|
112
112
|
|
|
113
|
-
**thresholdResults** (`ThresholdResult[]`): Per-threshold-scorer results averaged across all data items. Each entry has
|
|
113
|
+
**thresholdResults** (`ThresholdResult[]`): Per-threshold-scorer results averaged across all data items. Each entry has id, passed, averageScore, and threshold.
|
|
114
114
|
|
|
115
115
|
## ScorerEntry
|
|
116
116
|
|
|
@@ -118,7 +118,7 @@ A scorer entry in the `scorers` array can be either a bare scorer or a scorer wi
|
|
|
118
118
|
|
|
119
119
|
**scorer** (`MastraScorer`): The scorer instance.
|
|
120
120
|
|
|
121
|
-
**threshold** (`number | { min?: number; max?: number }`): A number implies minimum threshold (score at or above passes). Use
|
|
121
|
+
**threshold** (`number | { min?: number; max?: number }`): A number implies minimum threshold (score at or above passes). Use { min, max } for range-based checks — e.g. { max: 0.3 } for scorers like hallucination where a high score is bad. Both min and max must be between 0 and 1.
|
|
122
122
|
|
|
123
123
|
## Examples
|
|
124
124
|
|
|
@@ -113,7 +113,7 @@ Omit `stepType` entirely to match any step by name only.
|
|
|
113
113
|
|
|
114
114
|
**stepType** (`TrajectoryStepType`): Step type discriminant. When set, enables autocomplete for that variant's fields. If omitted, matches any step type with the given name.
|
|
115
115
|
|
|
116
|
-
**(variant fields)** (`varies`): Type-specific fields from the corresponding TrajectoryStep variant. For example,
|
|
116
|
+
**(variant fields)** (`varies`): Type-specific fields from the corresponding TrajectoryStep variant. For example, toolArgs and toolResult for tool\_call, modelId for model\_generation, output for workflow\_step. All optional — only specified fields are compared.
|
|
117
117
|
|
|
118
118
|
**children** (`TrajectoryExpectation`): Nested expectation config for this step's children. Overrides the parent config for evaluating children of this step.
|
|
119
119
|
|
package/.docs/reference/index.md
CHANGED
|
@@ -368,8 +368,8 @@ The Reference section provides documentation of Mastra's API, including paramete
|
|
|
368
368
|
- [RailwaySandbox](https://mastra.ai/reference/workspace/railway-sandbox)
|
|
369
369
|
- [S3Filesystem](https://mastra.ai/reference/workspace/s3-filesystem)
|
|
370
370
|
- [SandboxProcessManager](https://mastra.ai/reference/workspace/process-manager)
|
|
371
|
-
- [
|
|
372
|
-
- [
|
|
371
|
+
- [VercelSandbox](https://mastra.ai/reference/workspace/vercel-sandbox)
|
|
372
|
+
- [VercelServerlessSandbox](https://mastra.ai/reference/workspace/vercel-serverless)
|
|
373
373
|
- [Workspace Class](https://mastra.ai/reference/workspace/workspace-class)
|
|
374
374
|
- [WorkspaceFilesystem](https://mastra.ai/reference/workspace/filesystem)
|
|
375
375
|
- [WorkspaceSandbox](https://mastra.ai/reference/workspace/sandbox)
|
|
@@ -30,13 +30,13 @@ export const mastra = new Mastra({
|
|
|
30
30
|
|
|
31
31
|
**formatters** (`pino.LoggerOptions['formatters']`): Custom Pino formatters for log serialization.
|
|
32
32
|
|
|
33
|
-
**redact** (`pino.LoggerOptions['redact']`): Paths or options for redacting sensitive fields from log output (Pino
|
|
33
|
+
**redact** (`pino.LoggerOptions['redact']`): Paths or options for redacting sensitive fields from log output (Pino redact).
|
|
34
34
|
|
|
35
|
-
**prettyPrint** (`boolean`): When false, disables
|
|
35
|
+
**prettyPrint** (`boolean`): When false, disables pino-pretty and writes raw JSON lines (useful for log aggregators). (Default: `true`)
|
|
36
36
|
|
|
37
|
-
**mixin** (`pino.MixinFn`): Pino mixin function merged into every log object (for example request-scoped
|
|
37
|
+
**mixin** (`pino.MixinFn`): Pino mixin function merged into every log object (for example request-scoped traceId or other shared metadata).
|
|
38
38
|
|
|
39
|
-
**customLevels** (`Record<string, number>`): Custom log levels and numeric values, forwarded to Pino. Standard severity is still logged via
|
|
39
|
+
**customLevels** (`Record<string, number>`): Custom log levels and numeric values, forwarded to Pino. Standard severity is still logged via debug, info, warn, and error; extra levels follow Pino’s custom-level behavior.
|
|
40
40
|
|
|
41
41
|
## Log enrichment with `mixin`
|
|
42
42
|
|
|
@@ -6,7 +6,16 @@ The `.cloneThread()` method creates a copy of an existing conversation thread, i
|
|
|
6
6
|
|
|
7
7
|
## Usage example
|
|
8
8
|
|
|
9
|
+
The following example creates a `Memory` instance and clones an existing thread.
|
|
10
|
+
|
|
9
11
|
```typescript
|
|
12
|
+
import { Memory } from '@mastra/memory'
|
|
13
|
+
import { LibSQLStore } from '@mastra/libsql'
|
|
14
|
+
|
|
15
|
+
const memory = new Memory({
|
|
16
|
+
storage: new LibSQLStore({ id: 'memory-store', url: 'file:./memory.db' }),
|
|
17
|
+
})
|
|
18
|
+
|
|
10
19
|
const { thread, clonedMessages } = await memory.cloneThread({
|
|
11
20
|
sourceThreadId: 'original-thread-123',
|
|
12
21
|
})
|
|
@@ -20,7 +29,7 @@ const { thread, clonedMessages } = await memory.cloneThread({
|
|
|
20
29
|
|
|
21
30
|
**resourceId** (`string`): Optional resource ID for the cloned thread. Defaults to the source thread's resourceId.
|
|
22
31
|
|
|
23
|
-
**title** (`string`): Optional title for the cloned thread.
|
|
32
|
+
**title** (`string`): Optional title for the cloned thread. If omitted, the clone uses Clone of ${sourceThread.title} when the source thread has a title. Otherwise, the title is empty.
|
|
24
33
|
|
|
25
34
|
**metadata** (`Record<string, unknown>`): Optional metadata to merge with the source thread's metadata. Clone metadata is automatically added.
|
|
26
35
|
|
|
@@ -44,7 +53,7 @@ const { thread, clonedMessages } = await memory.cloneThread({
|
|
|
44
53
|
|
|
45
54
|
**messageIdMap** (`Record<string, string>`): A mapping from source message IDs to their corresponding cloned message IDs.
|
|
46
55
|
|
|
47
|
-
### Clone
|
|
56
|
+
### Clone metadata
|
|
48
57
|
|
|
49
58
|
The cloned thread's metadata includes a `clone` property with:
|
|
50
59
|
|
|
@@ -93,8 +102,18 @@ const { thread: dateFilteredClone } = await memory.cloneThread({
|
|
|
93
102
|
},
|
|
94
103
|
})
|
|
95
104
|
|
|
105
|
+
// Clone specific messages
|
|
106
|
+
const { thread: selectedMessagesClone } = await memory.cloneThread({
|
|
107
|
+
sourceThreadId: 'original-thread-123',
|
|
108
|
+
options: {
|
|
109
|
+
messageFilter: {
|
|
110
|
+
messageIds: ['message-1', 'message-2'],
|
|
111
|
+
},
|
|
112
|
+
},
|
|
113
|
+
})
|
|
114
|
+
|
|
96
115
|
// Continue conversation on the cloned thread
|
|
97
|
-
const response = await agent.generate(
|
|
116
|
+
const response = await agent.generate('Try a different approach', {
|
|
98
117
|
memory: {
|
|
99
118
|
thread: fullClone.id,
|
|
100
119
|
resource: fullClone.resourceId,
|
|
@@ -102,9 +121,13 @@ const response = await agent.generate("Let's try a different approach", {
|
|
|
102
121
|
})
|
|
103
122
|
```
|
|
104
123
|
|
|
124
|
+
Pass the cloned `thread.id` and `thread.resourceId` to `agent.generate()` to continue the conversation from the cloned thread.
|
|
125
|
+
|
|
105
126
|
## Vector embeddings
|
|
106
127
|
|
|
107
|
-
When the Memory instance has semantic recall enabled
|
|
128
|
+
When the Memory instance has semantic recall enabled with a vector store and embedder configured, `cloneThread()` automatically creates vector embeddings for all cloned messages. This ensures that semantic search works correctly on the cloned thread.
|
|
129
|
+
|
|
130
|
+
In this example, `embeddingModel` is the embedding model configured for the project.
|
|
108
131
|
|
|
109
132
|
```typescript
|
|
110
133
|
import { Memory } from '@mastra/memory'
|
|
@@ -131,6 +154,14 @@ const results = await memory.recall({
|
|
|
131
154
|
})
|
|
132
155
|
```
|
|
133
156
|
|
|
157
|
+
## Working memory
|
|
158
|
+
|
|
159
|
+
When working memory is enabled, `cloneThread()` copies or shares working memory based on the working-memory scope and the clone's `resourceId`:
|
|
160
|
+
|
|
161
|
+
- **Thread-scoped working memory**: The working memory is copied to the cloned thread.
|
|
162
|
+
- **Resource-scoped working memory with the same `resourceId`**: The working memory is shared because the source and cloned threads belong to the same resource.
|
|
163
|
+
- **Resource-scoped working memory with a different `resourceId`**: The working memory is copied to the cloned thread's resource.
|
|
164
|
+
|
|
134
165
|
## Observational Memory
|
|
135
166
|
|
|
136
167
|
When [Observational Memory](https://mastra.ai/docs/memory/observational-memory) is enabled, `cloneThread()` automatically clones the OM records associated with the source thread. The behavior depends on the OM scope:
|
|
@@ -29,23 +29,23 @@ export const agent = new Agent({
|
|
|
29
29
|
|
|
30
30
|
## Constructor parameters
|
|
31
31
|
|
|
32
|
-
**storage** (`MastraCompositeStore`): Storage implementation for persisting memory data. Defaults to
|
|
32
|
+
**storage** (`MastraCompositeStore`): Storage implementation for persisting memory data. Defaults to new DefaultStorage({ config: { url: "file:memory.db" } }) if not provided.
|
|
33
33
|
|
|
34
|
-
**vector** (`MastraVector | false`): Vector store for semantic search capabilities. Set to
|
|
34
|
+
**vector** (`MastraVector | false`): Vector store for semantic search capabilities. Set to false to disable vector operations.
|
|
35
35
|
|
|
36
36
|
**embedder** (`EmbeddingModel<string> | EmbeddingModelV2<string>`): Embedder instance for vector embeddings. Required when semantic recall is enabled.
|
|
37
37
|
|
|
38
38
|
**options** (`MemoryConfig`): Memory configuration options.
|
|
39
39
|
|
|
40
|
-
**options.lastMessages** (`number | false`): Number of most recent messages to include in context. Set to
|
|
40
|
+
**options.lastMessages** (`number | false`): Number of most recent messages to include in context. Set to false to disable loading conversation history into context. Use Number.MAX\_SAFE\_INTEGER to retrieve all messages with no limit. To prevent saving new messages, use the readOnly option instead.
|
|
41
41
|
|
|
42
42
|
**options.readOnly** (`boolean`): When true, prevents memory from saving new messages and provides working memory as read-only context (without the updateWorkingMemory tool). Useful for read-only operations like previews, internal routing agents, or sub agents that should reference but not modify memory.
|
|
43
43
|
|
|
44
44
|
**options.semanticRecall** (`boolean | { topK: number; messageRange: number | { before: number; after: number }; scope?: 'thread' | 'resource' }`): Enable semantic search in message history. Can be a boolean or an object with configuration options. When enabled, requires both vector store and embedder to be configured. Default topK is 4, default messageRange is {before: 1, after: 1}.
|
|
45
45
|
|
|
46
|
-
**options.workingMemory** (`WorkingMemory`): Configuration for working memory feature. Can be
|
|
46
|
+
**options.workingMemory** (`WorkingMemory`): Configuration for working memory feature. Can be { enabled: boolean; template?: string; schema?: ZodObject\<any> | JSONSchema7; scope?: 'thread' | 'resource' } or { enabled: boolean } to disable.
|
|
47
47
|
|
|
48
|
-
**options.observationalMemory** (`boolean | ObservationalMemoryOptions`): Enable Observational Memory for long-context agentic memory. Set to
|
|
48
|
+
**options.observationalMemory** (`boolean | ObservationalMemoryOptions`): Enable Observational Memory for long-context agentic memory. Set to true for defaults, or pass a config object to customize token budgets, models, and scope. See Observational Memory reference for configuration details.
|
|
49
49
|
|
|
50
50
|
**options.generateTitle** (`boolean | { model: DynamicArgument<MastraLanguageModel>; instructions?: DynamicArgument<string> }`): Controls automatic thread title generation from the user's first message. Can be a boolean or an object with custom model and instructions.
|
|
51
51
|
|