@mastra/core 1.9.0 → 1.10.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +202 -0
- package/dist/agent/agent.d.ts +22 -3
- package/dist/agent/agent.d.ts.map +1 -1
- package/dist/agent/index.cjs +13 -13
- package/dist/agent/index.js +2 -2
- package/dist/agent/message-list/index.cjs +18 -18
- package/dist/agent/message-list/index.js +1 -1
- package/dist/agent/message-list/message-list.d.ts.map +1 -1
- package/dist/{chunk-IOY7Y5GV.js → chunk-3VVNJPTO.js} +602 -187
- package/dist/chunk-3VVNJPTO.js.map +1 -0
- package/dist/{chunk-VDKWYUGC.cjs → chunk-5WBEMKE2.cjs} +7 -3
- package/dist/chunk-5WBEMKE2.cjs.map +1 -0
- package/dist/{chunk-H5S4PS44.cjs → chunk-76Q75VI4.cjs} +602 -187
- package/dist/chunk-76Q75VI4.cjs.map +1 -0
- package/dist/{chunk-ZBESCKPX.cjs → chunk-7AHCLTZZ.cjs} +1572 -36
- package/dist/chunk-7AHCLTZZ.cjs.map +1 -0
- package/dist/{chunk-SEKQJ447.js → chunk-ACAILOJE.js} +166 -68
- package/dist/chunk-ACAILOJE.js.map +1 -0
- package/dist/{chunk-YIJZBU54.cjs → chunk-BCSVBOAN.cjs} +240 -463
- package/dist/chunk-BCSVBOAN.cjs.map +1 -0
- package/dist/{chunk-ZVWVQ6MG.js → chunk-CY4ZWL2X.js} +8 -3
- package/dist/chunk-CY4ZWL2X.js.map +1 -0
- package/dist/{chunk-ET7GXCHS.js → chunk-DIKRJVK6.js} +5 -5
- package/dist/{chunk-ET7GXCHS.js.map → chunk-DIKRJVK6.js.map} +1 -1
- package/dist/{chunk-P6ZX7OKT.cjs → chunk-E6I5LBDM.cjs} +7 -7
- package/dist/{chunk-P6ZX7OKT.cjs.map → chunk-E6I5LBDM.cjs.map} +1 -1
- package/dist/{chunk-BFV3GSGS.js → chunk-FT5Q6XTK.js} +1546 -22
- package/dist/chunk-FT5Q6XTK.js.map +1 -0
- package/dist/{chunk-K54LFB4P.js → chunk-FXOWXS4O.js} +3 -3
- package/dist/{chunk-K54LFB4P.js.map → chunk-FXOWXS4O.js.map} +1 -1
- package/dist/{chunk-QNXY3J6B.cjs → chunk-GCRPNAAR.cjs} +22 -19
- package/dist/chunk-GCRPNAAR.cjs.map +1 -0
- package/dist/{chunk-5M3RMO7U.js → chunk-GTA5BKXZ.js} +8 -8
- package/dist/{chunk-5M3RMO7U.js.map → chunk-GTA5BKXZ.js.map} +1 -1
- package/dist/{chunk-G5R2755Q.cjs → chunk-HAIQ57YB.cjs} +53 -20
- package/dist/chunk-HAIQ57YB.cjs.map +1 -0
- package/dist/{chunk-3ZBLD2Y4.cjs → chunk-HH76UOJL.cjs} +2 -2
- package/dist/{chunk-3ZBLD2Y4.cjs.map → chunk-HH76UOJL.cjs.map} +1 -1
- package/dist/{chunk-HAGCXIBX.cjs → chunk-HNYQITSV.cjs} +9 -9
- package/dist/{chunk-HAGCXIBX.cjs.map → chunk-HNYQITSV.cjs.map} +1 -1
- package/dist/{chunk-GJTLWOKJ.js → chunk-HQA3IBLZ.js} +51 -18
- package/dist/chunk-HQA3IBLZ.js.map +1 -0
- package/dist/{chunk-4BXXAZ75.js → chunk-HQTHWVAK.js} +15 -7
- package/dist/chunk-HQTHWVAK.js.map +1 -0
- package/dist/{chunk-CCLV5CAA.js → chunk-JGOH7RWL.js} +7 -3
- package/dist/chunk-JGOH7RWL.js.map +1 -0
- package/dist/{chunk-Y6TGIUGL.js → chunk-LSF5WJ6G.js} +2 -2
- package/dist/{chunk-Y6TGIUGL.js.map → chunk-LSF5WJ6G.js.map} +1 -1
- package/dist/{chunk-D6HO5QAM.cjs → chunk-M26GEN4C.cjs} +14 -9
- package/dist/chunk-M26GEN4C.cjs.map +1 -0
- package/dist/{chunk-4P35AVPE.cjs → chunk-MEMYFFOL.cjs} +256 -157
- package/dist/chunk-MEMYFFOL.cjs.map +1 -0
- package/dist/{chunk-BQ355Z3O.js → chunk-NUZWQA4J.js} +4 -4
- package/dist/{chunk-BQ355Z3O.js.map → chunk-NUZWQA4J.js.map} +1 -1
- package/dist/{chunk-JIRB5LX4.js → chunk-OHX36YXF.js} +5 -3
- package/dist/chunk-OHX36YXF.js.map +1 -0
- package/dist/{chunk-PKORY4ZZ.cjs → chunk-OOTLMVNN.cjs} +107 -7
- package/dist/chunk-OOTLMVNN.cjs.map +1 -0
- package/dist/{chunk-D4M6E4OQ.cjs → chunk-OWZ6QT24.cjs} +16 -8
- package/dist/chunk-OWZ6QT24.cjs.map +1 -0
- package/dist/{chunk-6OHS6ZQ3.js → chunk-PDJCIONR.js} +8 -8
- package/dist/{chunk-6OHS6ZQ3.js.map → chunk-PDJCIONR.js.map} +1 -1
- package/dist/{chunk-WU2P7XOU.cjs → chunk-PP4G2TZZ.cjs} +20 -20
- package/dist/{chunk-WU2P7XOU.cjs.map → chunk-PP4G2TZZ.cjs.map} +1 -1
- package/dist/{chunk-VWAK25TU.js → chunk-SBBWRNZA.js} +10 -7
- package/dist/chunk-SBBWRNZA.js.map +1 -0
- package/dist/{chunk-TU4YMXOQ.js → chunk-TJIFNVPX.js} +6 -6
- package/dist/{chunk-TU4YMXOQ.js.map → chunk-TJIFNVPX.js.map} +1 -1
- package/dist/{chunk-V5YNS2QO.cjs → chunk-XJNQHPBJ.cjs} +15 -15
- package/dist/{chunk-V5YNS2QO.cjs.map → chunk-XJNQHPBJ.cjs.map} +1 -1
- package/dist/{chunk-MVYP55NA.js → chunk-YC6Z75K2.js} +113 -336
- package/dist/chunk-YC6Z75K2.js.map +1 -0
- package/dist/{chunk-3ZF7IC6Q.cjs → chunk-YZMSJKAK.cjs} +5 -3
- package/dist/chunk-YZMSJKAK.cjs.map +1 -0
- package/dist/{chunk-L3WDI7HP.cjs → chunk-Z2X5VTYJ.cjs} +65 -65
- package/dist/{chunk-L3WDI7HP.cjs.map → chunk-Z2X5VTYJ.cjs.map} +1 -1
- package/dist/{chunk-BN5MV2QK.cjs → chunk-Z52OAJ73.cjs} +4 -4
- package/dist/{chunk-BN5MV2QK.cjs.map → chunk-Z52OAJ73.cjs.map} +1 -1
- package/dist/{chunk-WYPSC6CO.js → chunk-ZBU6P4JV.js} +104 -4
- package/dist/chunk-ZBU6P4JV.js.map +1 -0
- package/dist/datasets/experiment/index.d.ts.map +1 -1
- package/dist/datasets/experiment/scorer.d.ts.map +1 -1
- package/dist/datasets/index.cjs +17 -17
- package/dist/datasets/index.js +2 -2
- package/dist/di/index.cjs +4 -4
- package/dist/di/index.js +1 -1
- package/dist/docs/SKILL.md +1 -1
- package/dist/docs/assets/SOURCE_MAP.json +443 -384
- package/dist/docs/references/docs-agents-agent-approval.md +61 -31
- package/dist/docs/references/docs-agents-supervisor-agents.md +1 -1
- package/dist/docs/references/docs-memory-observational-memory.md +9 -0
- package/dist/docs/references/docs-memory-semantic-recall.md +17 -1
- package/dist/docs/references/docs-workspace-skills.md +7 -5
- package/dist/docs/references/reference-agents-agent.md +20 -20
- package/dist/docs/references/reference-agents-generate.md +200 -66
- package/dist/docs/references/reference-agents-generateLegacy.md +77 -35
- package/dist/docs/references/reference-agents-getDefaultGenerateOptions.md +4 -6
- package/dist/docs/references/reference-agents-getDefaultOptions.md +4 -6
- package/dist/docs/references/reference-agents-getDefaultStreamOptions.md +4 -6
- package/dist/docs/references/reference-agents-getDescription.md +1 -1
- package/dist/docs/references/reference-agents-getInstructions.md +4 -6
- package/dist/docs/references/reference-agents-getLLM.md +6 -8
- package/dist/docs/references/reference-agents-getMemory.md +4 -6
- package/dist/docs/references/reference-agents-getModel.md +4 -6
- package/dist/docs/references/reference-agents-getTools.md +5 -7
- package/dist/docs/references/reference-agents-getVoice.md +4 -6
- package/dist/docs/references/reference-agents-listAgents.md +4 -6
- package/dist/docs/references/reference-agents-listScorers.md +4 -6
- package/dist/docs/references/reference-agents-listTools.md +4 -6
- package/dist/docs/references/reference-agents-listWorkflows.md +4 -6
- package/dist/docs/references/reference-agents-network.md +69 -23
- package/dist/docs/references/reference-ai-sdk-chat-route.md +7 -7
- package/dist/docs/references/reference-ai-sdk-network-route.md +3 -3
- package/dist/docs/references/reference-ai-sdk-to-ai-sdk-stream.md +9 -9
- package/dist/docs/references/reference-ai-sdk-with-mastra.md +12 -12
- package/dist/docs/references/reference-ai-sdk-workflow-route.md +3 -3
- package/dist/docs/references/reference-auth-auth0.md +6 -6
- package/dist/docs/references/reference-auth-clerk.md +5 -5
- package/dist/docs/references/reference-auth-firebase.md +7 -7
- package/dist/docs/references/reference-auth-jwt.md +1 -1
- package/dist/docs/references/reference-auth-supabase.md +4 -4
- package/dist/docs/references/reference-auth-workos.md +6 -6
- package/dist/docs/references/reference-core-addGateway.md +2 -2
- package/dist/docs/references/reference-core-getAgent.md +2 -2
- package/dist/docs/references/reference-core-getAgentById.md +2 -2
- package/dist/docs/references/reference-core-getDeployer.md +1 -1
- package/dist/docs/references/reference-core-getGateway.md +2 -2
- package/dist/docs/references/reference-core-getGatewayById.md +2 -2
- package/dist/docs/references/reference-core-getLogger.md +1 -1
- package/dist/docs/references/reference-core-getMCPServer.md +2 -2
- package/dist/docs/references/reference-core-getMCPServerById.md +3 -3
- package/dist/docs/references/reference-core-getMemory.md +2 -2
- package/dist/docs/references/reference-core-getScorer.md +2 -2
- package/dist/docs/references/reference-core-getScorerById.md +2 -2
- package/dist/docs/references/reference-core-getServer.md +1 -1
- package/dist/docs/references/reference-core-getStorage.md +1 -1
- package/dist/docs/references/reference-core-getStoredAgentById.md +18 -20
- package/dist/docs/references/reference-core-getTelemetry.md +1 -1
- package/dist/docs/references/reference-core-getVector.md +2 -2
- package/dist/docs/references/reference-core-getWorkflow.md +3 -3
- package/dist/docs/references/reference-core-listAgents.md +1 -1
- package/dist/docs/references/reference-core-listGateways.md +1 -1
- package/dist/docs/references/reference-core-listLogs.md +9 -11
- package/dist/docs/references/reference-core-listLogsByRunId.md +9 -9
- package/dist/docs/references/reference-core-listMCPServers.md +1 -1
- package/dist/docs/references/reference-core-listMemory.md +1 -1
- package/dist/docs/references/reference-core-listScorers.md +1 -1
- package/dist/docs/references/reference-core-listStoredAgents.md +9 -11
- package/dist/docs/references/reference-core-listVectors.md +1 -1
- package/dist/docs/references/reference-core-listWorkflows.md +2 -2
- package/dist/docs/references/reference-core-mastra-class.md +17 -17
- package/dist/docs/references/reference-core-mastra-model-gateway.md +15 -15
- package/dist/docs/references/reference-core-setLogger.md +2 -4
- package/dist/docs/references/reference-core-setStorage.md +1 -1
- package/dist/docs/references/reference-datasets-addItem.md +20 -4
- package/dist/docs/references/reference-datasets-addItems.md +8 -2
- package/dist/docs/references/reference-datasets-compareExperiments.md +15 -3
- package/dist/docs/references/reference-datasets-create.md +6 -6
- package/dist/docs/references/reference-datasets-dataset.md +1 -1
- package/dist/docs/references/reference-datasets-delete.md +2 -2
- package/dist/docs/references/reference-datasets-deleteExperiment.md +2 -2
- package/dist/docs/references/reference-datasets-deleteItem.md +2 -2
- package/dist/docs/references/reference-datasets-deleteItems.md +2 -2
- package/dist/docs/references/reference-datasets-get.md +2 -2
- package/dist/docs/references/reference-datasets-getDetails.md +9 -9
- package/dist/docs/references/reference-datasets-getExperiment.md +2 -2
- package/dist/docs/references/reference-datasets-getItem.md +3 -3
- package/dist/docs/references/reference-datasets-getItemHistory.md +22 -2
- package/dist/docs/references/reference-datasets-list.md +7 -3
- package/dist/docs/references/reference-datasets-listExperimentResults.md +34 -4
- package/dist/docs/references/reference-datasets-listExperiments.md +41 -3
- package/dist/docs/references/reference-datasets-listItems.md +18 -6
- package/dist/docs/references/reference-datasets-listVersions.md +23 -3
- package/dist/docs/references/reference-datasets-startExperiment.md +62 -12
- package/dist/docs/references/reference-datasets-startExperimentAsync.md +5 -1
- package/dist/docs/references/reference-datasets-update.md +6 -6
- package/dist/docs/references/reference-datasets-updateItem.md +5 -5
- package/dist/docs/references/reference-evals-answer-relevancy.md +11 -11
- package/dist/docs/references/reference-evals-answer-similarity.md +17 -19
- package/dist/docs/references/reference-evals-bias.md +10 -10
- package/dist/docs/references/reference-evals-completeness.md +3 -3
- package/dist/docs/references/reference-evals-content-similarity.md +6 -6
- package/dist/docs/references/reference-evals-context-precision.md +4 -4
- package/dist/docs/references/reference-evals-create-scorer.md +47 -49
- package/dist/docs/references/reference-evals-faithfulness.md +11 -11
- package/dist/docs/references/reference-evals-hallucination.md +17 -21
- package/dist/docs/references/reference-evals-keyword-coverage.md +4 -4
- package/dist/docs/references/reference-evals-mastra-scorer.md +14 -14
- package/dist/docs/references/reference-evals-run-evals.md +16 -16
- package/dist/docs/references/reference-evals-scorer-utils.md +3 -3
- package/dist/docs/references/reference-evals-textual-difference.md +3 -3
- package/dist/docs/references/reference-evals-tone-consistency.md +3 -3
- package/dist/docs/references/reference-evals-toxicity.md +8 -8
- package/dist/docs/references/reference-harness-harness-class.md +34 -42
- package/dist/docs/references/reference-logging-pino-logger.md +5 -5
- package/dist/docs/references/reference-memory-deleteMessages.md +2 -2
- package/dist/docs/references/reference-memory-memory-class.md +12 -14
- package/dist/docs/references/reference-memory-observational-memory.md +102 -94
- package/dist/docs/references/reference-observability-tracing-configuration.md +27 -10
- package/dist/docs/references/reference-observability-tracing-exporters-console-exporter.md +4 -7
- package/dist/docs/references/reference-processors-batch-parts-processor.md +8 -10
- package/dist/docs/references/reference-processors-language-detector.md +14 -16
- package/dist/docs/references/reference-processors-message-history-processor.md +7 -9
- package/dist/docs/references/reference-processors-moderation-processor.md +13 -15
- package/dist/docs/references/reference-processors-pii-detector.md +14 -16
- package/dist/docs/references/reference-processors-processor-interface.md +62 -62
- package/dist/docs/references/reference-processors-prompt-injection-detector.md +11 -13
- package/dist/docs/references/reference-processors-semantic-recall-processor.md +14 -16
- package/dist/docs/references/reference-processors-system-prompt-scrubber.md +12 -14
- package/dist/docs/references/reference-processors-token-limiter-processor.md +11 -13
- package/dist/docs/references/reference-processors-tool-call-filter.md +5 -7
- package/dist/docs/references/reference-processors-tool-search-processor.md +9 -11
- package/dist/docs/references/reference-processors-unicode-normalizer.md +8 -10
- package/dist/docs/references/reference-processors-working-memory-processor.md +14 -18
- package/dist/docs/references/reference-rag-database-config.md +11 -7
- package/dist/docs/references/reference-rag-embeddings.md +12 -12
- package/dist/docs/references/reference-server-mastra-server.md +10 -10
- package/dist/docs/references/reference-server-register-api-route.md +13 -13
- package/dist/docs/references/reference-storage-cloudflare-d1.md +5 -5
- package/dist/docs/references/reference-storage-composite.md +9 -9
- package/dist/docs/references/reference-storage-lance.md +3 -3
- package/dist/docs/references/reference-storage-libsql.md +2 -2
- package/dist/docs/references/reference-storage-mongodb.md +5 -5
- package/dist/docs/references/reference-storage-mssql.md +2 -2
- package/dist/docs/references/reference-storage-postgresql.md +25 -25
- package/dist/docs/references/reference-storage-upstash.md +3 -3
- package/dist/docs/references/reference-streaming-ChunkType.md +251 -59
- package/dist/docs/references/reference-streaming-agents-MastraModelOutput.md +86 -16
- package/dist/docs/references/reference-streaming-agents-streamLegacy.md +79 -39
- package/dist/docs/references/reference-streaming-workflows-resumeStream.md +18 -8
- package/dist/docs/references/reference-streaming-workflows-stream.md +21 -9
- package/dist/docs/references/reference-streaming-workflows-timeTravelStream.md +4 -4
- package/dist/docs/references/reference-tools-create-tool.md +25 -21
- package/dist/docs/references/reference-tools-graph-rag-tool.md +16 -18
- package/dist/docs/references/reference-tools-mcp-client.md +38 -27
- package/dist/docs/references/reference-tools-mcp-server.md +45 -45
- package/dist/docs/references/reference-tools-vector-query-tool.md +34 -22
- package/dist/docs/references/reference-vectors-libsql.md +31 -31
- package/dist/docs/references/reference-vectors-mongodb.md +32 -32
- package/dist/docs/references/reference-vectors-pg.md +60 -44
- package/dist/docs/references/reference-vectors-upstash.md +25 -25
- package/dist/docs/references/reference-voice-composite-voice.md +10 -10
- package/dist/docs/references/reference-voice-mastra-voice.md +20 -20
- package/dist/docs/references/reference-voice-voice.addInstructions.md +1 -1
- package/dist/docs/references/reference-voice-voice.addTools.md +1 -1
- package/dist/docs/references/reference-voice-voice.connect.md +3 -3
- package/dist/docs/references/reference-voice-voice.events.md +11 -11
- package/dist/docs/references/reference-voice-voice.listen.md +9 -9
- package/dist/docs/references/reference-voice-voice.on.md +2 -2
- package/dist/docs/references/reference-voice-voice.speak.md +11 -11
- package/dist/docs/references/reference-workflows-run-methods-cancel.md +2 -2
- package/dist/docs/references/reference-workflows-run-methods-restart.md +17 -5
- package/dist/docs/references/reference-workflows-run-methods-resume.md +23 -9
- package/dist/docs/references/reference-workflows-run-methods-start.md +22 -8
- package/dist/docs/references/reference-workflows-run-methods-startAsync.md +12 -6
- package/dist/docs/references/reference-workflows-run-methods-timeTravel.md +29 -13
- package/dist/docs/references/reference-workflows-run.md +12 -12
- package/dist/docs/references/reference-workflows-step.md +24 -26
- package/dist/docs/references/reference-workflows-workflow-methods-branch.md +2 -2
- package/dist/docs/references/reference-workflows-workflow-methods-commit.md +1 -1
- package/dist/docs/references/reference-workflows-workflow-methods-create-run.md +4 -4
- package/dist/docs/references/reference-workflows-workflow-methods-dountil.md +3 -3
- package/dist/docs/references/reference-workflows-workflow-methods-dowhile.md +3 -3
- package/dist/docs/references/reference-workflows-workflow-methods-foreach.md +9 -9
- package/dist/docs/references/reference-workflows-workflow-methods-map.md +2 -2
- package/dist/docs/references/reference-workflows-workflow-methods-parallel.md +2 -2
- package/dist/docs/references/reference-workflows-workflow-methods-sleep.md +2 -2
- package/dist/docs/references/reference-workflows-workflow-methods-sleepUntil.md +2 -2
- package/dist/docs/references/reference-workflows-workflow-methods-then.md +2 -2
- package/dist/docs/references/reference-workflows-workflow.md +40 -50
- package/dist/docs/references/reference-workspace-filesystem.md +22 -22
- package/dist/docs/references/reference-workspace-local-filesystem.md +35 -35
- package/dist/docs/references/reference-workspace-local-sandbox.md +26 -26
- package/dist/docs/references/reference-workspace-sandbox.md +8 -8
- package/dist/docs/references/reference-workspace-workspace-class.md +30 -34
- package/dist/editor/types.d.ts +1 -0
- package/dist/editor/types.d.ts.map +1 -1
- package/dist/evals/index.cjs +20 -20
- package/dist/evals/index.js +3 -3
- package/dist/evals/scoreTraces/index.cjs +5 -5
- package/dist/evals/scoreTraces/index.js +2 -2
- package/dist/harness/harness.d.ts.map +1 -1
- package/dist/harness/index.cjs +25 -21
- package/dist/harness/index.cjs.map +1 -1
- package/dist/harness/index.js +15 -11
- package/dist/harness/index.js.map +1 -1
- package/dist/index.cjs +2 -2
- package/dist/index.js +1 -1
- package/dist/integration/index.cjs +2 -2
- package/dist/integration/index.js +1 -1
- package/dist/llm/index.cjs +12 -12
- package/dist/llm/index.js +3 -3
- package/dist/llm/model/model.d.ts.map +1 -1
- package/dist/llm/model/model.loop.d.ts.map +1 -1
- package/dist/llm/model/provider-types.generated.d.ts +5 -1
- package/dist/loop/index.cjs +14 -14
- package/dist/loop/index.js +1 -1
- package/dist/loop/workflows/agentic-loop/index.d.ts.map +1 -1
- package/dist/mastra/index.cjs +2 -2
- package/dist/mastra/index.js +1 -1
- package/dist/memory/index.cjs +14 -14
- package/dist/memory/index.js +1 -1
- package/dist/models-dev-2FJK72J2.cjs +12 -0
- package/dist/{models-dev-UVWCKPA2.cjs.map → models-dev-2FJK72J2.cjs.map} +1 -1
- package/dist/models-dev-CMQG6EMO.js +3 -0
- package/dist/{models-dev-W3LXZTEB.js.map → models-dev-CMQG6EMO.js.map} +1 -1
- package/dist/processor-provider/index.cjs +10 -10
- package/dist/processor-provider/index.js +1 -1
- package/dist/processors/index.cjs +42 -42
- package/dist/processors/index.js +1 -1
- package/dist/processors/processors/skills.d.ts +9 -42
- package/dist/processors/processors/skills.d.ts.map +1 -1
- package/dist/provider-registry-EHOAWHFE.cjs +40 -0
- package/dist/{provider-registry-4HLP2JRR.cjs.map → provider-registry-EHOAWHFE.cjs.map} +1 -1
- package/dist/provider-registry-LVP6T63V.js +3 -0
- package/dist/{provider-registry-K3DWQSMH.js.map → provider-registry-LVP6T63V.js.map} +1 -1
- package/dist/provider-registry.json +12 -4
- package/dist/relevance/index.cjs +3 -3
- package/dist/relevance/index.js +1 -1
- package/dist/request-context/index.cjs +4 -4
- package/dist/request-context/index.d.ts.map +1 -1
- package/dist/request-context/index.js +1 -1
- package/dist/storage/base.d.ts +34 -1
- package/dist/storage/base.d.ts.map +1 -1
- package/dist/storage/constants.cjs +56 -56
- package/dist/storage/constants.js +1 -1
- package/dist/storage/domains/agents/filesystem.d.ts +28 -0
- package/dist/storage/domains/agents/filesystem.d.ts.map +1 -0
- package/dist/storage/domains/agents/index.d.ts +1 -0
- package/dist/storage/domains/agents/index.d.ts.map +1 -1
- package/dist/storage/domains/experiments/inmemory.d.ts.map +1 -1
- package/dist/storage/domains/mcp-clients/filesystem.d.ts +28 -0
- package/dist/storage/domains/mcp-clients/filesystem.d.ts.map +1 -0
- package/dist/storage/domains/mcp-clients/index.d.ts +1 -0
- package/dist/storage/domains/mcp-clients/index.d.ts.map +1 -1
- package/dist/storage/domains/mcp-servers/filesystem.d.ts +28 -0
- package/dist/storage/domains/mcp-servers/filesystem.d.ts.map +1 -0
- package/dist/storage/domains/mcp-servers/index.d.ts +1 -0
- package/dist/storage/domains/mcp-servers/index.d.ts.map +1 -1
- package/dist/storage/domains/prompt-blocks/filesystem.d.ts +28 -0
- package/dist/storage/domains/prompt-blocks/filesystem.d.ts.map +1 -0
- package/dist/storage/domains/prompt-blocks/index.d.ts +1 -0
- package/dist/storage/domains/prompt-blocks/index.d.ts.map +1 -1
- package/dist/storage/domains/scorer-definitions/filesystem.d.ts +28 -0
- package/dist/storage/domains/scorer-definitions/filesystem.d.ts.map +1 -0
- package/dist/storage/domains/scorer-definitions/index.d.ts +1 -0
- package/dist/storage/domains/scorer-definitions/index.d.ts.map +1 -1
- package/dist/storage/domains/skills/filesystem.d.ts +28 -0
- package/dist/storage/domains/skills/filesystem.d.ts.map +1 -0
- package/dist/storage/domains/skills/index.d.ts +1 -0
- package/dist/storage/domains/skills/index.d.ts.map +1 -1
- package/dist/storage/domains/workspaces/filesystem.d.ts +28 -0
- package/dist/storage/domains/workspaces/filesystem.d.ts.map +1 -0
- package/dist/storage/domains/workspaces/index.d.ts +1 -0
- package/dist/storage/domains/workspaces/index.d.ts.map +1 -1
- package/dist/storage/filesystem-db.d.ts +82 -0
- package/dist/storage/filesystem-db.d.ts.map +1 -0
- package/dist/storage/filesystem-versioned.d.ts +148 -0
- package/dist/storage/filesystem-versioned.d.ts.map +1 -0
- package/dist/storage/filesystem.d.ts +39 -0
- package/dist/storage/filesystem.d.ts.map +1 -0
- package/dist/storage/git-history.d.ts +68 -0
- package/dist/storage/git-history.d.ts.map +1 -0
- package/dist/storage/index.cjs +208 -160
- package/dist/storage/index.d.ts +4 -0
- package/dist/storage/index.d.ts.map +1 -1
- package/dist/storage/index.js +2 -2
- package/dist/storage/types.d.ts +1 -0
- package/dist/storage/types.d.ts.map +1 -1
- package/dist/stream/RunOutput.d.ts +1 -1
- package/dist/stream/aisdk/v5/output-helpers.d.ts +6 -6
- package/dist/stream/base/output.d.ts +3 -3
- package/dist/stream/base/schema.d.ts +1 -1
- package/dist/stream/index.cjs +11 -11
- package/dist/stream/index.js +2 -2
- package/dist/test-utils/llm-mock.cjs +4 -4
- package/dist/test-utils/llm-mock.js +1 -1
- package/dist/tool-loop-agent/index.cjs +4 -4
- package/dist/tool-loop-agent/index.js +1 -1
- package/dist/tools/index.cjs +6 -6
- package/dist/tools/index.js +1 -1
- package/dist/tools/is-vercel-tool.cjs +2 -2
- package/dist/tools/is-vercel-tool.js +1 -1
- package/dist/tools/tool-builder/builder.d.ts.map +1 -1
- package/dist/tools/tool.d.ts +6 -0
- package/dist/tools/tool.d.ts.map +1 -1
- package/dist/tools/types.d.ts +27 -0
- package/dist/tools/types.d.ts.map +1 -1
- package/dist/utils.cjs +23 -23
- package/dist/utils.js +1 -1
- package/dist/vector/index.cjs +9 -9
- package/dist/vector/index.js +2 -2
- package/dist/workflows/evented/index.cjs +10 -10
- package/dist/workflows/evented/index.js +1 -1
- package/dist/workflows/index.cjs +25 -25
- package/dist/workflows/index.js +1 -1
- package/dist/workspace/index.cjs +70 -66
- package/dist/workspace/index.d.ts +1 -0
- package/dist/workspace/index.d.ts.map +1 -1
- package/dist/workspace/index.js +1 -1
- package/dist/workspace/sandbox/execa.d.ts +9 -0
- package/dist/workspace/sandbox/execa.d.ts.map +1 -0
- package/dist/workspace/sandbox/local-process-manager.d.ts.map +1 -1
- package/dist/workspace/skills/index.d.ts +1 -0
- package/dist/workspace/skills/index.d.ts.map +1 -1
- package/dist/workspace/skills/tools.d.ts +36 -0
- package/dist/workspace/skills/tools.d.ts.map +1 -0
- package/dist/workspace/tools/execute-command.d.ts.map +1 -1
- package/dist/workspace/tools/output-helpers.d.ts +4 -3
- package/dist/workspace/tools/output-helpers.d.ts.map +1 -1
- package/package.json +9 -9
- package/src/llm/model/provider-types.generated.d.ts +5 -1
- package/dist/chunk-3ZF7IC6Q.cjs.map +0 -1
- package/dist/chunk-4BXXAZ75.js.map +0 -1
- package/dist/chunk-4P35AVPE.cjs.map +0 -1
- package/dist/chunk-BFV3GSGS.js.map +0 -1
- package/dist/chunk-CCLV5CAA.js.map +0 -1
- package/dist/chunk-D4M6E4OQ.cjs.map +0 -1
- package/dist/chunk-D6HO5QAM.cjs.map +0 -1
- package/dist/chunk-G5R2755Q.cjs.map +0 -1
- package/dist/chunk-GJTLWOKJ.js.map +0 -1
- package/dist/chunk-H5S4PS44.cjs.map +0 -1
- package/dist/chunk-IOY7Y5GV.js.map +0 -1
- package/dist/chunk-JIRB5LX4.js.map +0 -1
- package/dist/chunk-MVYP55NA.js.map +0 -1
- package/dist/chunk-PKORY4ZZ.cjs.map +0 -1
- package/dist/chunk-QNXY3J6B.cjs.map +0 -1
- package/dist/chunk-SEKQJ447.js.map +0 -1
- package/dist/chunk-VDKWYUGC.cjs.map +0 -1
- package/dist/chunk-VWAK25TU.js.map +0 -1
- package/dist/chunk-WYPSC6CO.js.map +0 -1
- package/dist/chunk-YIJZBU54.cjs.map +0 -1
- package/dist/chunk-ZBESCKPX.cjs.map +0 -1
- package/dist/chunk-ZVWVQ6MG.js.map +0 -1
- package/dist/models-dev-UVWCKPA2.cjs +0 -12
- package/dist/models-dev-W3LXZTEB.js +0 -3
- package/dist/provider-registry-4HLP2JRR.cjs +0 -40
- package/dist/provider-registry-K3DWQSMH.js +0 -3
|
@@ -45,139 +45,273 @@ console.log(`Remaining requests: ${remainingRequests}, Remaining tokens: ${remai
|
|
|
45
45
|
|
|
46
46
|
## Parameters
|
|
47
47
|
|
|
48
|
-
**messages
|
|
48
|
+
**messages** (`string | string[] | CoreMessage[] | AiMessageType[] | UIMessageWithMetadata[]`): The messages to send to the agent. Can be a single string, array of strings, or structured message objects.
|
|
49
49
|
|
|
50
|
-
**options
|
|
50
|
+
**options** (`AgentExecutionOptions<Output, Format>`): Optional configuration for the generation process.
|
|
51
51
|
|
|
52
|
-
|
|
52
|
+
**options.maxSteps** (`number`): Maximum number of steps to run during execution.
|
|
53
53
|
|
|
54
|
-
**
|
|
54
|
+
**options.stopWhen** (`LoopOptions['stopWhen']`): Conditions for stopping execution (e.g., step count, token limit).
|
|
55
55
|
|
|
56
|
-
**
|
|
56
|
+
**options.onIterationComplete** (`(context: IterationCompleteContext) => { continue?: boolean; feedback?: string } | void | Promise<{ continue?: boolean; feedback?: string } | void>`): Callback function called after each iteration completes. Use this to monitor progress, provide feedback to guide the agent, or stop execution early. The callback receives context about the iteration including the current text, tool calls, and finish reason.
|
|
57
57
|
|
|
58
|
-
**onIterationComplete
|
|
58
|
+
**options.onIterationComplete.context.iteration** (`number`): Current iteration number (1-based).
|
|
59
59
|
|
|
60
|
-
**
|
|
60
|
+
**options.onIterationComplete.context.maxIterations** (`number | undefined`): Maximum iterations allowed (if set).
|
|
61
61
|
|
|
62
|
-
**
|
|
62
|
+
**options.onIterationComplete.context.text** (`string`): The text response from this iteration.
|
|
63
63
|
|
|
64
|
-
**
|
|
64
|
+
**options.onIterationComplete.context.isFinal** (`boolean`): Whether this is the final iteration.
|
|
65
65
|
|
|
66
|
-
**
|
|
66
|
+
**options.onIterationComplete.context.finishReason** (`string`): Reason why this iteration finished (e.g., 'stop', 'length', 'tool-calls').
|
|
67
67
|
|
|
68
|
-
**
|
|
68
|
+
**options.onIterationComplete.context.toolCalls** (`ToolCall[]`): Tool calls made in this iteration.
|
|
69
69
|
|
|
70
|
-
**
|
|
70
|
+
**options.onIterationComplete.context.messages** (`MastraDBMessage[]`): All messages accumulated so far.
|
|
71
71
|
|
|
72
|
-
**
|
|
72
|
+
**options.onIterationComplete.return.continue** (`boolean`): Set to false to stop execution early.
|
|
73
73
|
|
|
74
|
-
**
|
|
74
|
+
**options.onIterationComplete.return.feedback** (`string`): Feedback message to guide the agent's next iteration.
|
|
75
75
|
|
|
76
|
-
**
|
|
76
|
+
**options.isTaskComplete** (`IsTaskCompleteConfig`): Task completion scoring configuration that validates whether the task is complete. Uses Mastra's evaluation scorers to automatically check if the agent's response satisfies the completion criteria.
|
|
77
77
|
|
|
78
|
-
**
|
|
78
|
+
**options.isTaskComplete.scorers** (`MastraScorer[]`): Array of scorers that evaluate task completion. Each scorer returns 0 (failed) or 1 (passed).
|
|
79
79
|
|
|
80
|
-
**
|
|
80
|
+
**options.isTaskComplete.strategy** (`'all' | 'any'`): Strategy for combining scorer results. 'all' requires all scorers to pass, 'any' requires at least one.
|
|
81
81
|
|
|
82
|
-
**
|
|
82
|
+
**options.isTaskComplete.onComplete** (`(result: IsTaskCompleteRunResult) => void | Promise<void>`): Callback called when the task completion check finishes. Receives the result with individual scorer scores.
|
|
83
83
|
|
|
84
|
-
**
|
|
84
|
+
**options.isTaskComplete.parallel** (`boolean`): Whether to run scorers in parallel.
|
|
85
85
|
|
|
86
|
-
**
|
|
86
|
+
**options.isTaskComplete.timeout** (`number`): Maximum time in milliseconds to wait for all scorers to complete.
|
|
87
87
|
|
|
88
|
-
**
|
|
88
|
+
**options.delegation** (`DelegationConfig`): Configuration for subagent delegation. Use this to control and monitor when the agent delegates tasks to other agents, including the ability to modify, reject delegations, and provide feedback to guide the supervisor.
|
|
89
89
|
|
|
90
|
-
**
|
|
90
|
+
**options.delegation.onDelegationStart** (`(context: DelegationStartContext) => DelegationStartResult | void | Promise<DelegationStartResult | void>`): Called before delegating to a subagent. Use this to modify the delegation parameters or reject the delegation entirely.
|
|
91
91
|
|
|
92
|
-
**
|
|
92
|
+
**options.delegation.onDelegationComplete** (`(context: DelegationCompleteContext) => { feedback?: string } | void | Promise<{ feedback?: string } | void>`): Called after a subagent delegation completes. The context includes a \`bail()\` method to stop further execution, and you can return \`{ feedback }\` to guide the supervisor's next action. Feedback is saved to supervisor memory as an assistant message.
|
|
93
93
|
|
|
94
|
-
**
|
|
94
|
+
**options.delegation.messageFilter** (`(context: MessageFilterContext) => MastraDBMessage[] | Promise<MastraDBMessage[]>`): Callback function called before delegating to a subagent. Use this to filter the messages that are passed to the subagent.
|
|
95
95
|
|
|
96
|
-
**
|
|
96
|
+
**options.scorers** (`MastraScorers | Record<string, { scorer: MastraScorer['name']; sampling?: ScoringSamplingConfig }>`): Evaluation scorers to run on the execution results.
|
|
97
97
|
|
|
98
|
-
**
|
|
98
|
+
**options.scorers.scorer** (`string`): Name of the scorer to use.
|
|
99
99
|
|
|
100
|
-
**
|
|
100
|
+
**options.scorers.sampling** (`ScoringSamplingConfig`): Sampling configuration for the scorer.
|
|
101
101
|
|
|
102
|
-
**
|
|
102
|
+
**options.scorers.sampling.type** (`'none' | 'ratio'`): Type of sampling strategy. Use 'none' to disable sampling or 'ratio' for percentage-based sampling.
|
|
103
103
|
|
|
104
|
-
**
|
|
104
|
+
**options.scorers.sampling.rate** (`number`): Sampling rate (0-1). Required when type is 'ratio'.
|
|
105
105
|
|
|
106
|
-
**
|
|
106
|
+
**options.returnScorerData** (`boolean`): Whether to return detailed scoring data in the response.
|
|
107
107
|
|
|
108
|
-
**
|
|
108
|
+
**options.onChunk** (`(chunk: ChunkType) => Promise<void> | void`): Callback function called for each chunk during generation.
|
|
109
109
|
|
|
110
|
-
**
|
|
110
|
+
**options.onError** (`({ error }: { error: Error | string }) => Promise<void> | void`): Callback function called when an error occurs during generation.
|
|
111
111
|
|
|
112
|
-
**
|
|
112
|
+
**options.onAbort** (`(event: any) => Promise<void> | void`): Callback function called when the generation is aborted.
|
|
113
113
|
|
|
114
|
-
**
|
|
114
|
+
**options.activeTools** (`Array<keyof ToolSet> | undefined`): Array of tool names that should be active during execution. If undefined, all available tools are active.
|
|
115
115
|
|
|
116
|
-
**
|
|
116
|
+
**options.abortSignal** (`AbortSignal`): Signal object that allows you to abort the agent's execution. When the signal is aborted, all ongoing operations will be terminated.
|
|
117
117
|
|
|
118
|
-
**
|
|
118
|
+
**options.prepareStep** (`PrepareStepFunction`): Callback function called before each step of multi-step execution.
|
|
119
119
|
|
|
120
|
-
**
|
|
120
|
+
**options.requireToolApproval** (`boolean`): When true, all tool calls require explicit approval before execution. The generate() method will return with \`finishReason: 'suspended'\` and include a \`suspendPayload\` with tool call details (\`toolCallId\`, \`toolName\`, \`args\`). Use \`approveToolCallGenerate()\` or \`declineToolCallGenerate()\` to proceed. See \[Agent Approval]\(/docs/agents/agent-approval#tool-approval-with-generate) for details.
|
|
121
121
|
|
|
122
|
-
**
|
|
122
|
+
**options.autoResumeSuspendedTools** (`boolean`): When true, automatically resumes suspended tools when the user sends a new message on the same thread. The agent extracts \`resumeData\` from the user's message based on the tool's \`resumeSchema\`. Requires memory to be configured.
|
|
123
123
|
|
|
124
|
-
**
|
|
124
|
+
**options.toolCallConcurrency** (`number`): Maximum number of tool calls to execute concurrently. Defaults to 1 when approval may be required, otherwise 10.
|
|
125
125
|
|
|
126
|
-
**
|
|
126
|
+
**options.context** (`ModelMessage[]`): Additional context messages to provide to the agent.
|
|
127
127
|
|
|
128
|
-
**
|
|
128
|
+
**options.structuredOutput** (`StructuredOutputOptions<S extends ZodTypeAny = ZodTypeAny>`): Options to fine tune your structured output generation.
|
|
129
129
|
|
|
130
|
-
**
|
|
130
|
+
**options.structuredOutput.schema** (`z.ZodSchema<S>`): Zod schema defining the expected output structure.
|
|
131
|
+
|
|
132
|
+
**options.structuredOutput.model** (`MastraLanguageModel`): Language model to use for structured output generation. If provided, enables the agent to respond in multi step with tool calls, text, and structured output
|
|
133
|
+
|
|
134
|
+
**options.structuredOutput.errorStrategy** (`'strict' | 'warn' | 'fallback'`): Strategy for handling schema validation errors. 'strict' throws errors, 'warn' logs warnings, 'fallback' uses fallback values.
|
|
135
|
+
|
|
136
|
+
**options.structuredOutput.fallbackValue** (`<S extends ZodTypeAny>`): Fallback value to use when schema validation fails and errorStrategy is 'fallback'.
|
|
137
|
+
|
|
138
|
+
**options.structuredOutput.instructions** (`string`): Additional instructions for the structured output model.
|
|
139
|
+
|
|
140
|
+
**options.structuredOutput.jsonPromptInjection** (`boolean`): Injects system prompt into the main agent instructing it to return structured output, useful for when a model does not natively support structured outputs.
|
|
141
|
+
|
|
142
|
+
**options.structuredOutput.logger** (`IMastraLogger`): Optional logger instance for structured logging during output generation.
|
|
143
|
+
|
|
144
|
+
**options.structuredOutput.providerOptions** (`ProviderOptions`): Provider-specific options passed to the internal structuring agent. Use this to control model behavior like reasoning effort for thinking models (e.g., \`{ openai: { reasoningEffort: 'low' } }\`).
|
|
145
|
+
|
|
146
|
+
**options.outputProcessors** (`OutputProcessorOrWorkflow[]`): Output processors to use for this execution (overrides agent's default).
|
|
147
|
+
|
|
148
|
+
**options.maxProcessorRetries** (`number`): Maximum number of times processors can trigger a retry for this generation. Overrides agent's default maxProcessorRetries.
|
|
149
|
+
|
|
150
|
+
**options.inputProcessors** (`InputProcessorOrWorkflow[]`): Input processors to use for this execution (overrides agent's default).
|
|
151
|
+
|
|
152
|
+
**options.instructions** (`string | string[] | CoreSystemMessage | SystemModelMessage | CoreSystemMessage[] | SystemModelMessage[]`): Custom instructions that override the agent's default instructions for this execution. Can be a single string, message object, or array of either.
|
|
153
|
+
|
|
154
|
+
**options.system** (`string | string[] | CoreSystemMessage | SystemModelMessage | CoreSystemMessage[] | SystemModelMessage[]`): Custom system message(s) to include in the prompt. Can be a single string, message object, or array of either. System messages provide additional context or behavior instructions that supplement the agent's main instructions.
|
|
155
|
+
|
|
156
|
+
**options.output** (`Zod schema | JsonSchema7`): \*\*Deprecated.\*\* Use structuredOutput without a model to achieve the same thing. Defines the expected structure of the output. Can be a JSON Schema object or a Zod schema.
|
|
157
|
+
|
|
158
|
+
**options.memory** (`object`): Memory configuration for conversation persistence and retrieval.
|
|
159
|
+
|
|
160
|
+
**options.memory.thread** (`string | { id: string; metadata?: Record<string, any>, title?: string }`): Thread identifier for conversation continuity. Can be a string ID or an object with ID and optional metadata/title.
|
|
161
|
+
|
|
162
|
+
**options.memory.resource** (`string`): Resource identifier for organizing conversations by user, session, or context.
|
|
163
|
+
|
|
164
|
+
**options.memory.options** (`MemoryConfig`): Additional memory configuration options including lastMessages, readOnly, semanticRecall, and workingMemory.
|
|
165
|
+
|
|
166
|
+
**options.onFinish** (`LoopConfig['onFinish']`): Callback fired when generation completes.
|
|
167
|
+
|
|
168
|
+
**options.onStepFinish** (`LoopConfig['onStepFinish']`): Callback fired after each generation step.
|
|
169
|
+
|
|
170
|
+
**options.telemetry** (`TelemetrySettings`): Settings for OTLP telemetry collection during generation (not Tracing).
|
|
171
|
+
|
|
172
|
+
**options.telemetry.isEnabled** (`boolean`): Whether telemetry collection is enabled.
|
|
173
|
+
|
|
174
|
+
**options.telemetry.recordInputs** (`boolean`): Whether to record input data in telemetry.
|
|
175
|
+
|
|
176
|
+
**options.telemetry.recordOutputs** (`boolean`): Whether to record output data in telemetry.
|
|
177
|
+
|
|
178
|
+
**options.telemetry.functionId** (`string`): Identifier for the function being executed.
|
|
179
|
+
|
|
180
|
+
**options.modelSettings** (`CallSettings`): Model-specific settings like temperature, maxOutputTokens, topP, etc. These settings control how the language model generates responses.
|
|
181
|
+
|
|
182
|
+
**options.modelSettings.temperature** (`number`): Controls randomness in generation (0-2). Higher values make output more random.
|
|
183
|
+
|
|
184
|
+
**options.modelSettings.maxOutputTokens** (`number`): Maximum number of tokens to generate in the response. Note: Use maxOutputTokens (not maxTokens) as per AI SDK v5 convention.
|
|
185
|
+
|
|
186
|
+
**options.modelSettings.maxRetries** (`number`): Maximum number of retry attempts for failed requests.
|
|
187
|
+
|
|
188
|
+
**options.modelSettings.topP** (`number`): Nucleus sampling parameter (0-1). Controls diversity of generated text.
|
|
189
|
+
|
|
190
|
+
**options.modelSettings.topK** (`number`): Top-k sampling parameter. Limits vocabulary to k most likely tokens.
|
|
191
|
+
|
|
192
|
+
**options.modelSettings.presencePenalty** (`number`): Penalty for token presence (-2 to 2). Reduces repetition.
|
|
193
|
+
|
|
194
|
+
**options.modelSettings.frequencyPenalty** (`number`): Penalty for token frequency (-2 to 2). Reduces repetition of frequent tokens.
|
|
195
|
+
|
|
196
|
+
**options.modelSettings.stopSequences** (`string[]`): Stop sequences. If set, the model will stop generating text when one of the stop sequences is generated.
|
|
197
|
+
|
|
198
|
+
**options.toolChoice** (`'auto' | 'none' | 'required' | { type: 'tool'; toolName: string }`): Controls how tools are selected during generation.
|
|
199
|
+
|
|
200
|
+
**options.toolChoice.'auto'** (`string`): Let the model decide when to use tools (default).
|
|
201
|
+
|
|
202
|
+
**options.toolChoice.'none'** (`string`): Disable tool usage entirely.
|
|
203
|
+
|
|
204
|
+
**options.toolChoice.'required'** (`string`): Force the model to use at least one tool.
|
|
205
|
+
|
|
206
|
+
**options.toolChoice.{ type: 'tool'; toolName: string }** (`object`): Force the model to use a specific tool.
|
|
207
|
+
|
|
208
|
+
**options.toolsets** (`ToolsetsInput`): Additional tool sets that can be used for this execution.
|
|
209
|
+
|
|
210
|
+
**options.clientTools** (`ToolsInput`): Client-side tools available during execution.
|
|
211
|
+
|
|
212
|
+
**options.savePerStep** (`boolean`): Save messages incrementally after each generation step completes (default: false).
|
|
213
|
+
|
|
214
|
+
**options.providerOptions** (`Record<string, Record<string, JSONValue>>`): Provider-specific options passed to the language model.
|
|
215
|
+
|
|
216
|
+
**options.providerOptions.openai** (`Record<string, JSONValue>`): OpenAI-specific options like reasoningEffort, responseFormat, etc.
|
|
217
|
+
|
|
218
|
+
**options.providerOptions.anthropic** (`Record<string, JSONValue>`): Anthropic-specific options like maxTokens, etc.
|
|
219
|
+
|
|
220
|
+
**options.providerOptions.google** (`Record<string, JSONValue>`): Google-specific options.
|
|
221
|
+
|
|
222
|
+
**options.providerOptions.\[providerName]** (`Record<string, JSONValue>`): Any provider-specific options.
|
|
223
|
+
|
|
224
|
+
**options.runId** (`string`): Unique identifier for this execution run.
|
|
225
|
+
|
|
226
|
+
**options.requestContext** (`RequestContext`): Request Context containing dynamic configuration and state.
|
|
227
|
+
|
|
228
|
+
**options.tracingContext** (`TracingContext`): Tracing context for creating child spans and adding metadata. Automatically injected when using Mastra's tracing system.
|
|
229
|
+
|
|
230
|
+
**options.tracingContext.currentSpan** (`Span`): Current span for creating child spans and adding metadata. Use this to create custom child spans or update span attributes during execution.
|
|
231
|
+
|
|
232
|
+
**options.tracingOptions** (`TracingOptions`): Options for Tracing configuration.
|
|
233
|
+
|
|
234
|
+
**options.tracingOptions.metadata** (`Record<string, any>`): Metadata to add to the root trace span. Useful for adding custom attributes like user IDs, session IDs, or feature flags.
|
|
235
|
+
|
|
236
|
+
**options.tracingOptions.requestContextKeys** (`string[]`): Additional RequestContext keys to extract as metadata for this trace. Supports dot notation for nested values (e.g., 'user.id').
|
|
237
|
+
|
|
238
|
+
**options.tracingOptions.traceId** (`string`): Trace ID to use for this execution (1-32 hexadecimal characters). If provided, this trace will be part of the specified trace.
|
|
239
|
+
|
|
240
|
+
**options.tracingOptions.parentSpanId** (`string`): Parent span ID to use for this execution (1-16 hexadecimal characters). If provided, the root span will be created as a child of this span.
|
|
241
|
+
|
|
242
|
+
**options.tracingOptions.tags** (`string[]`): Tags to apply to this trace. String labels for categorizing and filtering traces.
|
|
243
|
+
|
|
244
|
+
**options.includeRawChunks** (`boolean`): Whether to include raw chunks in the stream output. Not available on all model providers.
|
|
131
245
|
|
|
132
246
|
## Returns
|
|
133
247
|
|
|
134
|
-
**result
|
|
248
|
+
**result** (`Awaited<ReturnType<MastraModelOutput<Output>['getFullOutput']>>`): Returns the full output of the generation process including text, object (if structured output), tool calls, tool results, usage statistics, and step information.
|
|
249
|
+
|
|
250
|
+
**text** (`string`): The generated text response from the agent.
|
|
251
|
+
|
|
252
|
+
**object** (`Output | undefined`): The structured output object if structuredOutput was provided, validated against the schema.
|
|
253
|
+
|
|
254
|
+
**toolCalls** (`ToolCall[]`): Array of tool calls made during generation.
|
|
255
|
+
|
|
256
|
+
**toolResults** (`ToolResult[]`): Array of results from tool executions.
|
|
257
|
+
|
|
258
|
+
**usage** (`TokenUsage`): Token usage statistics for the generation.
|
|
259
|
+
|
|
260
|
+
**steps** (`Step[]`): Array of execution steps, useful for debugging multi-step generations.
|
|
261
|
+
|
|
262
|
+
**finishReason** (`string`): The reason generation finished. Values include 'stop' (normal completion), 'tool-calls' (ended with tool calls), 'suspended' (waiting for tool approval), or 'error' (error occurred).
|
|
263
|
+
|
|
264
|
+
**response** (`object`): Response metadata from the model provider. Useful for accessing rate limit headers and request IDs.
|
|
265
|
+
|
|
266
|
+
**response.id** (`string`): Response ID from the model provider.
|
|
267
|
+
|
|
268
|
+
**response.timestamp** (`Date`): Timestamp when the response was generated.
|
|
135
269
|
|
|
136
|
-
**
|
|
270
|
+
**response.modelId** (`string`): Model identifier used for this response.
|
|
137
271
|
|
|
138
|
-
**
|
|
272
|
+
**response.headers** (`Record<string, string>`): HTTP response headers from the model provider. Contains rate limit information (e.g., \`anthropic-ratelimit-requests-remaining\`, \`x-ratelimit-remaining-tokens\`) and other provider-specific metadata.
|
|
139
273
|
|
|
140
|
-
**
|
|
274
|
+
**response.messages** (`ResponseMessage[]`): Response messages in model format.
|
|
141
275
|
|
|
142
|
-
**
|
|
276
|
+
**response.uiMessages** (`UIMessage[]`): Response messages in UI format, includes any metadata added by output processors.
|
|
143
277
|
|
|
144
|
-
**
|
|
278
|
+
**request** (`object`): The request that was sent to the model.
|
|
145
279
|
|
|
146
|
-
**
|
|
280
|
+
**request.body** (`unknown`): The request body sent to the model provider.
|
|
147
281
|
|
|
148
|
-
**
|
|
282
|
+
**warnings** (`LanguageModelWarning[]`): Any warnings from the model provider during generation.
|
|
149
283
|
|
|
150
|
-
**
|
|
284
|
+
**providerMetadata** (`Record<string, unknown>`): Provider-specific metadata returned with the response.
|
|
151
285
|
|
|
152
|
-
**
|
|
286
|
+
**reasoning** (`ReasoningChunk[]`): Reasoning details from models that support reasoning (e.g., OpenAI o1 series).
|
|
153
287
|
|
|
154
|
-
**
|
|
288
|
+
**reasoningText** (`string`): Combined reasoning text from reasoning models.
|
|
155
289
|
|
|
156
|
-
**
|
|
290
|
+
**sources** (`SourceChunk[]`): Sources referenced by the model during generation.
|
|
157
291
|
|
|
158
|
-
**
|
|
292
|
+
**files** (`FileChunk[]`): Files generated by the model.
|
|
159
293
|
|
|
160
|
-
**
|
|
294
|
+
**suspendPayload** (`object`): Present when \`finishReason\` is 'suspended'. Contains tool call details needed to approve or decline the pending tool call.
|
|
161
295
|
|
|
162
|
-
**
|
|
296
|
+
**suspendPayload.toolCallId** (`string`): Unique identifier for the pending tool call.
|
|
163
297
|
|
|
164
|
-
**
|
|
298
|
+
**suspendPayload.toolName** (`string`): Name of the tool that requires approval.
|
|
165
299
|
|
|
166
|
-
**suspendPayload
|
|
300
|
+
**suspendPayload.args** (`Record<string, any>`): Arguments that will be passed to the tool.
|
|
167
301
|
|
|
168
|
-
**runId
|
|
302
|
+
**runId** (`string`): Unique identifier for this execution run. Required when calling \`approveToolCallGenerate()\` or \`declineToolCallGenerate()\` to resume a suspended execution.
|
|
169
303
|
|
|
170
|
-
**traceId
|
|
304
|
+
**traceId** (`string`): The trace ID associated with this execution when Tracing is enabled. Use this to correlate logs and debug execution flow.
|
|
171
305
|
|
|
172
|
-
**messages
|
|
306
|
+
**messages** (`MastraDBMessage[]`): All messages from this execution including input, memory history, and response.
|
|
173
307
|
|
|
174
|
-
**rememberedMessages
|
|
308
|
+
**rememberedMessages** (`MastraDBMessage[]`): Only messages loaded from memory (conversation history).
|
|
175
309
|
|
|
176
|
-
**error
|
|
310
|
+
**error** (`Error`): Error object if the generation failed.
|
|
177
311
|
|
|
178
|
-
**tripwire
|
|
312
|
+
**tripwire** (`StepTripwireData`): Tripwire data if content was blocked by a processor.
|
|
179
313
|
|
|
180
|
-
**scoringData
|
|
314
|
+
**scoringData** (`object`): Scoring data for evals when \`returnScorerData\` is enabled.
|
|
181
315
|
|
|
182
316
|
## Related
|
|
183
317
|
|
|
@@ -12,77 +12,119 @@ await agent.generateLegacy('message for agent')
|
|
|
12
12
|
|
|
13
13
|
## Parameters
|
|
14
14
|
|
|
15
|
-
**messages
|
|
15
|
+
**messages** (`string | string[] | CoreMessage[] | AiMessageType[] | UIMessageWithMetadata[]`): The messages to send to the agent. Can be a single string, array of strings, or structured message objects with multimodal content (text, images, etc.).
|
|
16
16
|
|
|
17
|
-
**options
|
|
17
|
+
**options** (`AgentGenerateOptions`): Optional configuration for the generation process.
|
|
18
18
|
|
|
19
|
-
|
|
19
|
+
**options.abortSignal** (`AbortSignal`): Signal object that allows you to abort the agent's execution. When the signal is aborted, all ongoing operations will be terminated.
|
|
20
20
|
|
|
21
|
-
**
|
|
21
|
+
**options.context** (`CoreMessage[]`): Additional context messages to provide to the agent.
|
|
22
22
|
|
|
23
|
-
**
|
|
23
|
+
**options.structuredOutput** (`StructuredOutputOptions<S extends ZodTypeAny = ZodTypeAny>`): Enables structured output generation with better developer experience. Automatically creates and uses a StructuredOutputProcessor internally.
|
|
24
24
|
|
|
25
|
-
**structuredOutput
|
|
25
|
+
**options.structuredOutput.schema** (`z.ZodSchema<S>`): Zod schema to validate the output against.
|
|
26
26
|
|
|
27
|
-
**
|
|
27
|
+
**options.structuredOutput.model** (`MastraLanguageModel`): Model to use for the internal structuring agent.
|
|
28
28
|
|
|
29
|
-
**
|
|
29
|
+
**options.structuredOutput.errorStrategy** (`'strict' | 'warn' | 'fallback'`): Strategy when parsing or validation fails. Defaults to 'strict'.
|
|
30
30
|
|
|
31
|
-
**
|
|
31
|
+
**options.structuredOutput.fallbackValue** (`<S extends ZodTypeAny>`): Fallback value when errorStrategy is 'fallback'.
|
|
32
32
|
|
|
33
|
-
**instructions
|
|
33
|
+
**options.structuredOutput.instructions** (`string`): Custom instructions for the structuring agent.
|
|
34
34
|
|
|
35
|
-
**
|
|
35
|
+
**options.outputProcessors** (`Processor[]`): Overrides the output processors set on the agent. Output processors that can modify or validate messages from the agent before they are returned to the user. Must implement either (or both) of the \`processOutputResult\` and \`processOutputStream\` functions.
|
|
36
36
|
|
|
37
|
-
**
|
|
37
|
+
**options.inputProcessors** (`Processor[]`): Overrides the input processors set on the agent. Input processors that can modify or validate messages before they are processed by the agent. Must implement the \`processInput\` function.
|
|
38
38
|
|
|
39
|
-
**
|
|
39
|
+
**options.experimental\_output** (`Zod schema | JsonSchema7`): Note, the preferred route is to use the \`structuredOutput\` property. Enables structured output generation alongside text generation and tool calls. The model will generate responses that conform to the provided schema.
|
|
40
40
|
|
|
41
|
-
**
|
|
41
|
+
**options.instructions** (`string`): Custom instructions that override the agent's default instructions for this specific generation. Useful for dynamically modifying agent behavior without creating a new agent instance.
|
|
42
42
|
|
|
43
|
-
**
|
|
43
|
+
**options.output** (`Zod schema | JsonSchema7`): Defines the expected structure of the output. Can be a JSON Schema object or a Zod schema.
|
|
44
44
|
|
|
45
|
-
**
|
|
45
|
+
**options.memory** (`object`): Configuration for memory. This is the preferred way to manage memory.
|
|
46
46
|
|
|
47
|
-
**
|
|
47
|
+
**options.memory.thread** (`string | { id: string; metadata?: Record<string, any>, title?: string }`): The conversation thread, as a string ID or an object with an \`id\` and optional \`metadata\`.
|
|
48
48
|
|
|
49
|
-
**
|
|
49
|
+
**options.memory.resource** (`string`): Identifier for the user or resource associated with the thread.
|
|
50
50
|
|
|
51
|
-
**
|
|
51
|
+
**options.memory.options** (`MemoryConfig`): Configuration for memory behavior, like message history and semantic recall. See \`MemoryConfig\` below.
|
|
52
52
|
|
|
53
|
-
**
|
|
53
|
+
**options.maxSteps** (`number`): Maximum number of execution steps allowed.
|
|
54
54
|
|
|
55
|
-
**
|
|
55
|
+
**options.maxRetries** (`number`): Maximum number of retries. Set to 0 to disable retries.
|
|
56
56
|
|
|
57
|
-
**
|
|
57
|
+
**options.onStepFinish** (`GenerateTextOnStepFinishCallback<any> | never`): Callback function called after each execution step. Receives step details as a JSON string. Unavailable for structured output
|
|
58
58
|
|
|
59
|
-
**
|
|
59
|
+
**options.runId** (`string`): Unique ID for this generation run. Useful for tracking and debugging purposes.
|
|
60
60
|
|
|
61
|
-
**
|
|
61
|
+
**options.telemetry** (`TelemetrySettings`): Settings for telemetry collection during generation.
|
|
62
62
|
|
|
63
|
-
**
|
|
63
|
+
**options.telemetry.isEnabled** (`boolean`): Enable or disable telemetry. Disabled by default while experimental.
|
|
64
64
|
|
|
65
|
-
**
|
|
65
|
+
**options.telemetry.recordInputs** (`boolean`): Enable or disable input recording. Enabled by default. You might want to disable input recording to avoid recording sensitive information.
|
|
66
66
|
|
|
67
|
-
**
|
|
67
|
+
**options.telemetry.recordOutputs** (`boolean`): Enable or disable output recording. Enabled by default. You might want to disable output recording to avoid recording sensitive information.
|
|
68
68
|
|
|
69
|
-
**
|
|
69
|
+
**options.telemetry.functionId** (`string`): Identifier for this function. Used to group telemetry data by function.
|
|
70
70
|
|
|
71
|
-
**
|
|
71
|
+
**options.temperature** (`number`): Controls randomness in the model's output. Higher values (e.g., 0.8) make the output more random, lower values (e.g., 0.2) make it more focused and deterministic.
|
|
72
72
|
|
|
73
|
-
**
|
|
73
|
+
**options.toolChoice** (`'auto' | 'none' | 'required' | { type: 'tool'; toolName: string }`): Controls how the agent uses tools during generation.
|
|
74
74
|
|
|
75
|
-
**
|
|
75
|
+
**options.toolChoice.'auto'** (`string`): Let the model decide whether to use tools (default).
|
|
76
76
|
|
|
77
|
-
**
|
|
77
|
+
**options.toolChoice.'none'** (`string`): Do not use any tools.
|
|
78
|
+
|
|
79
|
+
**options.toolChoice.'required'** (`string`): Require the model to use at least one tool.
|
|
80
|
+
|
|
81
|
+
**options.toolChoice.{ type: 'tool'; toolName: string }** (`object`): Require the model to use a specific tool by name.
|
|
82
|
+
|
|
83
|
+
**options.toolsets** (`ToolsetsInput`): Additional toolsets to make available to the agent during generation.
|
|
84
|
+
|
|
85
|
+
**options.clientTools** (`ToolsInput`): Tools that are executed on the 'client' side of the request. These tools do not have execute functions in the definition.
|
|
86
|
+
|
|
87
|
+
**options.savePerStep** (`boolean`): Save messages incrementally after each stream step completes (default: false).
|
|
88
|
+
|
|
89
|
+
**options.providerOptions** (`Record<string, Record<string, JSONValue>>`): Additional provider-specific options that are passed through to the underlying LLM provider. The structure is \`{ providerName: { optionKey: value } }\`. Since Mastra extends AI SDK, see the \[AI SDK documentation]\(https\://sdk.vercel.ai/docs/providers/ai-sdk-providers) for complete provider options.
|
|
90
|
+
|
|
91
|
+
**options.providerOptions.openai** (`Record<string, JSONValue>`): OpenAI-specific options. Example: \`{ reasoningEffort: 'high' }\`
|
|
92
|
+
|
|
93
|
+
**options.providerOptions.anthropic** (`Record<string, JSONValue>`): Anthropic-specific options. Example: \`{ maxTokens: 1000 }\`
|
|
94
|
+
|
|
95
|
+
**options.providerOptions.google** (`Record<string, JSONValue>`): Google-specific options. Example: \`{ safetySettings: \[...] }\`
|
|
96
|
+
|
|
97
|
+
**options.providerOptions.\[providerName]** (`Record<string, JSONValue>`): Other provider-specific options. The key is the provider name and the value is a record of provider-specific options.
|
|
98
|
+
|
|
99
|
+
**options.requestContext** (`RequestContext`): Request Context for dependency injection and contextual information.
|
|
100
|
+
|
|
101
|
+
**options.maxTokens** (`number`): Maximum number of tokens to generate.
|
|
102
|
+
|
|
103
|
+
**options.topP** (`number`): Nucleus sampling. This is a number between 0 and 1. It is recommended to set either \`temperature\` or \`topP\`, but not both.
|
|
104
|
+
|
|
105
|
+
**options.topK** (`number`): Only sample from the top K options for each subsequent token. Used to remove 'long tail' low probability responses.
|
|
106
|
+
|
|
107
|
+
**options.presencePenalty** (`number`): Presence penalty setting. It affects the likelihood of the model to repeat information that is already in the prompt. A number between -1 (increase repetition) and 1 (maximum penalty, decrease repetition).
|
|
108
|
+
|
|
109
|
+
**options.frequencyPenalty** (`number`): Frequency penalty setting. It affects the likelihood of the model to repeatedly use the same words or phrases. A number between -1 (increase repetition) and 1 (maximum penalty, decrease repetition).
|
|
110
|
+
|
|
111
|
+
**options.stopSequences** (`string[]`): Stop sequences. If set, the model will stop generating text when one of the stop sequences is generated.
|
|
112
|
+
|
|
113
|
+
**options.seed** (`number`): The seed (integer) to use for random sampling. If set and supported by the model, calls will generate deterministic results.
|
|
114
|
+
|
|
115
|
+
**options.headers** (`Record<string, string | undefined>`): Additional HTTP headers to be sent with the request. Only applicable for HTTP-based providers.
|
|
78
116
|
|
|
79
117
|
## Returns
|
|
80
118
|
|
|
81
|
-
**text
|
|
119
|
+
**text** (`string`): The generated text response. Present when output is 'text' (no schema provided).
|
|
120
|
+
|
|
121
|
+
**object** (`object`): The generated structured response. Present when a schema is provided via \`output\`, \`structuredOutput\`, or \`experimental\_output\`.
|
|
122
|
+
|
|
123
|
+
**toolCalls** (`Array<ToolCall>`): The tool calls made during the generation process. Present in both text and object modes.
|
|
82
124
|
|
|
83
|
-
**
|
|
125
|
+
**toolCalls.toolName** (`string`): The name of the tool invoked.
|
|
84
126
|
|
|
85
|
-
**toolCalls
|
|
127
|
+
**toolCalls.args** (`any`): The arguments passed to the tool.
|
|
86
128
|
|
|
87
129
|
## Migration to New API
|
|
88
130
|
|
|
@@ -12,11 +12,13 @@ await agent.getDefaultGenerateOptionsLegacy()
|
|
|
12
12
|
|
|
13
13
|
## Parameters
|
|
14
14
|
|
|
15
|
-
**options
|
|
15
|
+
**options** (`{ requestContext?: RequestContext }`): Optional configuration object containing request context. (Default: `{}`)
|
|
16
|
+
|
|
17
|
+
**options.requestContext** (`RequestContext`): Request Context for dependency injection and contextual information.
|
|
16
18
|
|
|
17
19
|
## Returns
|
|
18
20
|
|
|
19
|
-
**defaultOptions
|
|
21
|
+
**defaultOptions** (`AgentGenerateOptions | Promise<AgentGenerateOptions>`): The default generation options configured for the agent, either as a direct object or a promise that resolves to the options.
|
|
20
22
|
|
|
21
23
|
## Extended usage example
|
|
22
24
|
|
|
@@ -26,10 +28,6 @@ await agent.getDefaultGenerateOptionsLegacy({
|
|
|
26
28
|
})
|
|
27
29
|
```
|
|
28
30
|
|
|
29
|
-
### Options parameters
|
|
30
|
-
|
|
31
|
-
**requestContext?:** (`RequestContext`): Request Context for dependency injection and contextual information. (Default: `new RequestContext()`)
|
|
32
|
-
|
|
33
31
|
## Related
|
|
34
32
|
|
|
35
33
|
- [Agent generation](https://mastra.ai/docs/agents/overview)
|