@mastra/core 1.88.0-alpha.0 → 1.88.0-alpha.2
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/dist/_types/@internal_core@0.1.4/dist/knowledge-compat/index.d.ts +17 -1
- package/dist/agent/durable/index.cjs +1 -1
- package/dist/agent/durable/index.js +1 -1
- package/dist/agent/index.cjs +2 -2
- package/dist/agent/index.js +2 -2
- package/dist/agent-builder/ee/index.cjs +1 -1
- package/dist/agent-builder/ee/index.js +1 -1
- package/dist/agent-controller/index.cjs +1 -1
- package/dist/agent-controller/index.js +1 -1
- package/dist/agent-controller/model-catalog-cache.d.ts +9 -5
- package/dist/agent-controller/session.d.ts +17 -0
- package/dist/{agent-controller-NQKYmY0W.cjs → agent-controller-Bt7DwpZy.cjs} +57 -53
- package/dist/{agent-controller-CQDCmsFD.js → agent-controller-CFNkjF3l.js} +57 -53
- package/dist/background-tasks/index.cjs +1 -1
- package/dist/background-tasks/index.js +1 -1
- package/dist/{background-tasks-B7UygDdO.js → background-tasks-DJHuKMQC.js} +1 -1
- package/dist/{background-tasks-CeARf1DK.cjs → background-tasks-DbPzYpIZ.cjs} +1 -1
- package/dist/browser/index.cjs +1 -1
- package/dist/browser/index.js +1 -1
- package/dist/{builder-Dmf04g9P.cjs → builder-961mB1xC.cjs} +2 -2
- package/dist/{builder-CpAEmMdR.js → builder-BD6HtwKv.js} +2 -2
- package/dist/capabilities/302ai.json +200 -200
- package/dist/capabilities/abliteratedllm.json +37 -37
- package/dist/capabilities/abliteration-ai.json +9 -9
- package/dist/capabilities/above.json +22 -22
- package/dist/capabilities/adaption.json +13 -13
- package/dist/capabilities/adzuki.json +22 -22
- package/dist/capabilities/agentrouter.json +10 -10
- package/dist/capabilities/agnes.json +3 -3
- package/dist/capabilities/ai-router.json +7 -7
- package/dist/capabilities/aiand.json +22 -23
- package/dist/capabilities/aigrow.json +14 -14
- package/dist/capabilities/aimlapi.json +149 -158
- package/dist/capabilities/aixy.json +28 -28
- package/dist/capabilities/aki-io.json +12 -12
- package/dist/capabilities/alibaba-cn.json +99 -99
- package/dist/capabilities/alibaba-coding-plan-cn.json +4 -4
- package/dist/capabilities/alibaba-coding-plan.json +4 -4
- package/dist/capabilities/alibaba-token-plan-cn.json +55 -55
- package/dist/capabilities/alibaba-token-plan.json +56 -56
- package/dist/capabilities/alibaba.json +77 -77
- package/dist/capabilities/ambient.json +7 -7
- package/dist/capabilities/amd-tokenlab.json +5 -5
- package/dist/capabilities/amd.json +6 -6
- package/dist/capabilities/anthropic.json +31 -31
- package/dist/capabilities/anyapi.json +47 -47
- package/dist/capabilities/apiko.json +5 -5
- package/dist/capabilities/arcee.json +4 -4
- package/dist/capabilities/augure.json +5 -5
- package/dist/capabilities/auriko.json +21 -21
- package/dist/capabilities/bailing.json +5 -5
- package/dist/capabilities/baseten.json +34 -34
- package/dist/capabilities/bee.json +2 -2
- package/dist/capabilities/bothub.json +15 -15
- package/dist/capabilities/boundless.json +39 -39
- package/dist/capabilities/bumo.json +38 -38
- package/dist/capabilities/byteplus.json +26 -26
- package/dist/capabilities/cheapaimodel.json +7 -7
- package/dist/capabilities/cheapest-token.json +32 -32
- package/dist/capabilities/chutes.json +33 -33
- package/dist/capabilities/cline-pass.json +37 -37
- package/dist/capabilities/cloudcode.json +8 -8
- package/dist/capabilities/cloudflare-ai-gateway.json +716 -0
- package/dist/capabilities/cloudflare-workers-ai.json +12 -12
- package/dist/capabilities/cohere.json +67 -0
- package/dist/capabilities/commandcode.json +146 -146
- package/dist/capabilities/concentrate.json +281 -281
- package/dist/capabilities/cortecs.json +103 -103
- package/dist/capabilities/crossmodel.json +190 -190
- package/dist/capabilities/crusoe.json +11 -11
- package/dist/capabilities/daoxe.json +9 -9
- package/dist/capabilities/databricks.json +133 -133
- package/dist/capabilities/deepinfra.json +96 -96
- package/dist/capabilities/deepseek.json +3 -3
- package/dist/capabilities/digitalocean.json +115 -115
- package/dist/capabilities/dothoosh.json +34 -34
- package/dist/capabilities/doubleword.json +30 -30
- package/dist/capabilities/edenai.json +288 -279
- package/dist/capabilities/empiriolabs.json +187 -178
- package/dist/capabilities/engy.json +22 -22
- package/dist/capabilities/entrim.json +6 -6
- package/dist/capabilities/evroc.json +15 -15
- package/dist/capabilities/ezkielyna.json +10 -10
- package/dist/capabilities/fastrouter.json +90 -90
- package/dist/capabilities/fireworks-ai.json +93 -82
- package/dist/capabilities/freemodel.json +8 -8
- package/dist/capabilities/friendli.json +8 -8
- package/dist/capabilities/frogbot.json +87 -87
- package/dist/capabilities/gisoo.json +18 -18
- package/dist/capabilities/gmicloud.json +16 -16
- package/dist/capabilities/google.json +59 -59
- package/dist/capabilities/graphn.json +10 -10
- package/dist/capabilities/greenpt.json +32 -32
- package/dist/capabilities/helicone.json +80 -80
- package/dist/capabilities/hetzner.json +5 -5
- package/dist/capabilities/hostinger-router.json +11 -11
- package/dist/capabilities/hpc-ai.json +8 -8
- package/dist/capabilities/huawei-maas.json +15 -15
- package/dist/capabilities/hubris.json +26 -26
- package/dist/capabilities/huggingface.json +93 -85
- package/dist/capabilities/hyper.json +23 -23
- package/dist/capabilities/impossibl.json +153 -153
- package/dist/capabilities/inceptron.json +8 -8
- package/dist/capabilities/inco.json +3 -3
- package/dist/capabilities/infer.json +16 -16
- package/dist/capabilities/inferall.json +6 -6
- package/dist/capabilities/inference-coop.json +15 -15
- package/dist/capabilities/inferenceapis.json +25 -25
- package/dist/capabilities/inferris.json +3 -3
- package/dist/capabilities/infersia.json +9 -9
- package/dist/capabilities/inferx.json +2 -2
- package/dist/capabilities/infomaniak.json +2 -2
- package/dist/capabilities/iteracompute.json +44 -44
- package/dist/capabilities/jalapeno.json +11 -11
- package/dist/capabilities/jiekou.json +31 -31
- package/dist/capabilities/joingonka.json +4 -4
- package/dist/capabilities/jzstoken.json +49 -49
- package/dist/capabilities/keln.json +23 -23
- package/dist/capabilities/kenari.json +125 -125
- package/dist/capabilities/kilo.json +667 -626
- package/dist/capabilities/kimchi.json +16 -16
- package/dist/capabilities/kimi-code-plan-cn.json +6 -6
- package/dist/capabilities/kimi-code-plan-global.json +6 -6
- package/dist/capabilities/kitani.json +6 -6
- package/dist/capabilities/klavo.json +26 -26
- package/dist/capabilities/korouter.json +34 -34
- package/dist/capabilities/kunavo.json +6 -6
- package/dist/capabilities/liquid.json +11 -11
- package/dist/capabilities/lithosai.json +2 -2
- package/dist/capabilities/llmgateway-providers.json +933 -931
- package/dist/capabilities/llmgateway.json +350 -348
- package/dist/capabilities/llmtr.json +20 -20
- package/dist/capabilities/lowrouter.json +62 -62
- package/dist/capabilities/lyceum.json +13 -13
- package/dist/capabilities/melious.json +12 -12
- package/dist/capabilities/merge-gateway.json +296 -296
- package/dist/capabilities/meta.json +10 -10
- package/dist/capabilities/minimax-cn-coding-plan.json +5 -5
- package/dist/capabilities/minimax-cn.json +5 -5
- package/dist/capabilities/minimax-coding-plan.json +5 -5
- package/dist/capabilities/minimax.json +5 -5
- package/dist/capabilities/mistral.json +22 -14
- package/dist/capabilities/mixlayer.json +5 -5
- package/dist/capabilities/modal.json +10 -10
- package/dist/capabilities/model-oracle-ai.json +21 -21
- package/dist/capabilities/modelis.json +20 -20
- package/dist/capabilities/modelscope.json +2 -2
- package/dist/capabilities/modular.json +12 -12
- package/dist/capabilities/moneo.json +6 -6
- package/dist/capabilities/moonshotai-cn.json +7 -7
- package/dist/capabilities/moonshotai.json +7 -7
- package/dist/capabilities/morph.json +12 -12
- package/dist/capabilities/munito-eu.json +6 -6
- package/dist/capabilities/munito.json +8 -8
- package/dist/capabilities/nan.json +25 -25
- package/dist/capabilities/nano-gpt.json +585 -571
- package/dist/capabilities/nearai.json +112 -112
- package/dist/capabilities/nebius.json +36 -36
- package/dist/capabilities/neon.json +123 -123
- package/dist/capabilities/neuralwatt.json +41 -41
- package/dist/capabilities/nokeep.json +5 -5
- package/dist/capabilities/novita-ai.json +127 -127
- package/dist/capabilities/nvidia.json +16 -16
- package/dist/capabilities/oathbreaker.json +4 -4
- package/dist/capabilities/obscurify.json +31 -31
- package/dist/capabilities/oci.json +5 -5
- package/dist/capabilities/ofox.json +252 -252
- package/dist/capabilities/ollama-cloud.json +55 -55
- package/dist/capabilities/openai.json +54 -54
- package/dist/capabilities/opencode-go.json +109 -93
- package/dist/capabilities/openreason.json +4 -4
- package/dist/capabilities/openrouter.json +529 -529
- package/dist/capabilities/opper.json +27 -27
- package/dist/capabilities/orcarouter.json +263 -263
- package/dist/capabilities/outerlabs.json +30 -30
- package/dist/capabilities/ovhcloud.json +18 -18
- package/dist/capabilities/pareto.json +4 -4
- package/dist/capabilities/pendra.json +4 -4
- package/dist/capabilities/perplexity-agent.json +64 -64
- package/dist/capabilities/perplexity.json +2 -2
- package/dist/capabilities/phala.json +37 -37
- package/dist/capabilities/pioneer.json +2 -2
- package/dist/capabilities/poe.json +140 -140
- package/dist/capabilities/powerspring.json +11 -11
- package/dist/capabilities/primalabs.json +6 -6
- package/dist/capabilities/prime.json +119 -119
- package/dist/capabilities/privatemode-ai.json +7 -7
- package/dist/capabilities/proxystacks.json +3 -3
- package/dist/capabilities/qiniu-ai.json +11 -11
- package/dist/capabilities/refuseless.json +9 -9
- package/dist/capabilities/regolo-ai.json +9 -9
- package/dist/capabilities/requesty.json +201 -201
- package/dist/capabilities/ruapi.json +25 -25
- package/dist/capabilities/runcrate.json +15 -15
- package/dist/capabilities/runinfra.json +17 -17
- package/dist/capabilities/sakana.json +7 -7
- package/dist/capabilities/sambanova.json +5 -5
- package/dist/capabilities/sandbase.json +32 -32
- package/dist/capabilities/sarvam.json +9 -9
- package/dist/capabilities/scaleway.json +14 -14
- package/dist/capabilities/scnet-token-plan.json +4 -4
- package/dist/capabilities/scx-ai.json +21 -21
- package/dist/capabilities/sensenova.json +13 -13
- package/dist/capabilities/siliconflow-cn.json +56 -56
- package/dist/capabilities/siliconflow.json +63 -63
- package/dist/capabilities/snowflake-cortex.json +27 -27
- package/dist/capabilities/sokkan.json +2 -2
- package/dist/capabilities/sparrowcodes.json +18 -18
- package/dist/capabilities/standardcompute.json +83 -83
- package/dist/capabilities/steadyrouter.json +46 -46
- package/dist/capabilities/stepfun-ai-step-plan.json +8 -8
- package/dist/capabilities/stepfun-ai.json +8 -8
- package/dist/capabilities/stepfun-step-plan.json +8 -8
- package/dist/capabilities/stepfun.json +8 -8
- package/dist/capabilities/stepping-stone.json +21 -21
- package/dist/capabilities/subconscious.json +2 -2
- package/dist/capabilities/synthetic.json +12 -12
- package/dist/capabilities/synthorai.json +22 -22
- package/dist/capabilities/teamorouter.json +24 -24
- package/dist/capabilities/teapot-router.json +8 -8
- package/dist/capabilities/tencent-token-plan-intl.json +24 -24
- package/dist/capabilities/tencent-token-plan.json +35 -35
- package/dist/capabilities/tencent-tokenhub.json +50 -50
- package/dist/capabilities/tensorx.json +47 -47
- package/dist/capabilities/the-grid-ai.json +26 -26
- package/dist/capabilities/thinkingmachines.json +77 -77
- package/dist/capabilities/tinfoil.json +13 -13
- package/dist/capabilities/toapis.json +3 -3
- package/dist/capabilities/togetherai.json +58 -58
- package/dist/capabilities/tokengo.json +27 -27
- package/dist/capabilities/tokenharbor.json +216 -216
- package/dist/capabilities/tokenify.json +9 -9
- package/dist/capabilities/trustedrouter.json +7 -7
- package/dist/capabilities/trustedtokens.json +13 -13
- package/dist/capabilities/umans-ai-coding-plan.json +14 -14
- package/dist/capabilities/umans-ai.json +11 -11
- package/dist/capabilities/uncensuredai.json +4 -4
- package/dist/capabilities/unrestricted.json +4 -4
- package/dist/capabilities/uplinkswitch.json +22 -22
- package/dist/capabilities/vancine.json +20 -20
- package/dist/capabilities/vercel.json +594 -590
- package/dist/capabilities/verda.json +4 -4
- package/dist/capabilities/vivgrid.json +68 -68
- package/dist/capabilities/volcengine-coding-plan.json +29 -29
- package/dist/capabilities/volcengine.json +22 -22
- package/dist/capabilities/vultr.json +19 -19
- package/dist/capabilities/wafer.ai.json +19 -19
- package/dist/capabilities/wallaby.json +4 -4
- package/dist/capabilities/wally.json +11 -11
- package/dist/capabilities/wandb.json +21 -21
- package/dist/capabilities/watt.json +25 -25
- package/dist/capabilities/xai.json +6 -6
- package/dist/capabilities/xiaomi-token-plan-ams.json +2 -2
- package/dist/capabilities/xiaomi-token-plan-cn.json +2 -2
- package/dist/capabilities/xiaomi-token-plan-sgp.json +2 -2
- package/dist/capabilities/xiaomi.json +2 -2
- package/dist/capabilities/xpersona.json +13 -13
- package/dist/capabilities/xxapi.json +28 -28
- package/dist/capabilities/zai-coding-plan.json +11 -11
- package/dist/capabilities/zai.json +31 -31
- package/dist/capabilities/zenifra.json +30 -30
- package/dist/capabilities/zenmux.json +175 -175
- package/dist/capabilities/zerogpu.json +9 -9
- package/dist/capabilities/zhipuai-coding-plan.json +3 -3
- package/dist/capabilities/zhipuai.json +33 -33
- package/dist/capabilities/zro.json +4 -4
- package/dist/channels/index.cjs +2 -2
- package/dist/channels/index.js +2 -2
- package/dist/{channels-BQ--aLCA.js → channels-Dn6LqqK1.js} +1 -1
- package/dist/{channels-CTCBsS5M.cjs → channels-dYHpz7m2.cjs} +1 -1
- package/dist/coding-agent/index.cjs +1 -1
- package/dist/coding-agent/index.js +1 -1
- package/dist/{constants-Dro9fuhk.js → constants-C2Q-ZI5d.js} +6 -0
- package/dist/{constants-B2FVV_2e.cjs → constants-DPHwzvan.cjs} +6 -0
- package/dist/datasets/index.cjs +2 -2
- package/dist/datasets/index.js +2 -2
- package/dist/docs/SKILL.md +1 -1
- package/dist/docs/assets/SOURCE_MAP.json +1079 -1074
- package/dist/docs/references/docs-channels.md +42 -1
- package/dist/docs/references/docs-develop.md +2 -0
- package/dist/docs/references/docs-evals-experiments.md +2 -0
- package/dist/docs/references/docs-guides-build-an-eval-loop.md +5 -1
- package/dist/docs/references/docs-guides-overview.md +2 -1
- package/dist/docs/references/docs-knowledge-importers.md +11 -1
- package/dist/docs/references/docs-knowledge-scopes-and-access.md +26 -0
- package/dist/docs/references/docs-mastra-platform-observability-overview.md +60 -0
- package/dist/docs/references/docs-memory-message-history.md +24 -16
- package/dist/docs/references/docs-memory-overview.md +21 -17
- package/dist/docs/references/docs-sandbox-overview.md +12 -10
- package/dist/docs/references/docs-workflows-control-flow.md +20 -0
- package/dist/docs/references/integrations-observability-arthur.md +1 -1
- package/dist/docs/references/reference-agent-controller-agent-controller-class.md +1 -1
- package/dist/docs/references/reference-agent-controller-session.md +9 -0
- package/dist/docs/references/reference-knowledge-knowledge-class.md +1 -1
- package/dist/docs/references/reference-knowledge-knowledge-tools.md +1 -1
- package/dist/docs/references/reference-observability-tracing-bridges-datadog.md +12 -11
- package/dist/docs/references/reference-processors-processor-interface.md +1 -1
- package/dist/docs/references/reference-storage-overview.md +1 -1
- package/dist/docs/references/reference-voice-overview.md +0 -27
- package/dist/docs/references/reference-workflows-step.md +1 -1
- package/dist/docs/references/reference-workspace-workspace-class.md +3 -1
- package/dist/evals/index.cjs +2 -2
- package/dist/evals/index.js +2 -2
- package/dist/evals/scoreTraces/index.cjs +2 -2
- package/dist/evals/scoreTraces/index.js +2 -2
- package/dist/{execution-fence-C8Q0wWkG.cjs → execution-fence-CHI1L6Gw.cjs} +284 -97
- package/dist/{execution-fence-DGFyUV5h.js → execution-fence-P1uj8uB8.js} +273 -98
- package/dist/harness/index.cjs +1 -1
- package/dist/harness/index.js +1 -1
- package/dist/index.cjs +1 -1
- package/dist/index.js +1 -1
- package/dist/knowledge/importers/local-host.d.ts +2 -1
- package/dist/knowledge/importers/sink.d.ts +6 -0
- package/dist/knowledge/importers/types.d.ts +5 -0
- package/dist/knowledge/index.cjs +105 -20
- package/dist/knowledge/index.js +105 -21
- package/dist/knowledge/links.d.ts +19 -6
- package/dist/llm/index.cjs +3 -3
- package/dist/llm/index.js +3 -3
- package/dist/llm/model/gateways/mastra.d.ts +19 -0
- package/dist/llm/model/gateways/refreshing-cache.d.ts +52 -0
- package/dist/llm/model/gateways/url-template.d.ts +3 -1
- package/dist/llm/model/provider-types.generated.d.ts +7693 -7570
- package/dist/{llm-YNjDFSui.js → llm-D4BaXbwZ.js} +4 -3
- package/dist/{llm-RIAYOAtD.cjs → llm-DqcaZBHM.cjs} +4 -3
- package/dist/loop/index.cjs +2 -2
- package/dist/loop/index.js +2 -2
- package/dist/loop/workflows/agentic-execution/background-task-check-step.d.ts +4 -0
- package/dist/loop/workflows/agentic-execution/goal-step.d.ts +4 -0
- package/dist/loop/workflows/agentic-execution/is-task-complete-step.d.ts +4 -0
- package/dist/loop/workflows/agentic-execution/llm-execution-step.d.ts +4 -0
- package/dist/loop/workflows/agentic-execution/llm-mapping-step.d.ts +2 -0
- package/dist/loop/workflows/schema.d.ts +13 -0
- package/dist/{manager-DZhtdV6Q.js → manager-BAs1D8t9.js} +3 -3
- package/dist/{manager-Y-jYcS7T.cjs → manager-Do9PPiEw.cjs} +3 -3
- package/dist/mastra/index.cjs +1 -1
- package/dist/mastra/index.js +1 -1
- package/dist/{mastra-BJ54VxOO.js → mastra-CaLISVUE.js} +16 -16
- package/dist/{mastra-B2-HBq1-.cjs → mastra-DWCqC_6c.cjs} +16 -16
- package/dist/memory/index.cjs +2 -2
- package/dist/memory/index.js +2 -2
- package/dist/{model-lzZPXaEV.cjs → model-DAcaPIyq.cjs} +1 -1
- package/dist/{model-cS3d5rmF.js → model-DafU-uar.js} +1 -1
- package/dist/{netlify-1lti1j4Z.cjs → netlify-1Nz6N3ej.cjs} +29 -13
- package/dist/{netlify-ClBjc0Xg.js → netlify-CUG0Ko81.js} +29 -13
- package/dist/notifications/index.cjs +1 -1
- package/dist/notifications/index.js +1 -1
- package/dist/processor-provider/index.cjs +1 -1
- package/dist/processor-provider/index.js +1 -1
- package/dist/processors/index.cjs +2 -2
- package/dist/processors/index.js +2 -2
- package/dist/{provider-registry-C_XQJvu2.js → provider-registry-BjBiRMhs.js} +22121 -21683
- package/dist/{provider-registry-C6jd3Uxi.cjs → provider-registry-D_cE6sCW.cjs} +22132 -21676
- package/dist/provider-registry.json +21981 -21714
- package/dist/{registry-generator-DBrTbThj.js → registry-generator-VDBSUg0k.js} +1 -1
- package/dist/{registry-generator-BYdAlox6.cjs → registry-generator-ji57sjZC.cjs} +1 -1
- package/dist/{rehydrate-BtwY0ima.cjs → rehydrate-BOhDMI4r.cjs} +2 -2
- package/dist/{rehydrate-4xHubfOY.js → rehydrate-Do67YKWz.js} +2 -2
- package/dist/relevance/index.cjs +2 -2
- package/dist/relevance/index.js +2 -2
- package/dist/storage/constants.cjs +1 -1
- package/dist/storage/constants.js +1 -1
- package/dist/storage/domains/knowledge/base.d.ts +11 -0
- package/dist/storage/domains/knowledge/inmemory.d.ts +1 -0
- package/dist/storage/domains/knowledge/pages-inmemory.d.ts +4 -0
- package/dist/storage/domains/knowledge/pages.d.ts +1 -1
- package/dist/storage/domains/observability/tracing.d.ts +12 -0
- package/dist/storage/index.cjs +4 -3
- package/dist/storage/index.js +4 -4
- package/dist/stream/index.cjs +2 -2
- package/dist/stream/index.js +2 -2
- package/dist/{stream-H_wVxqdK.js → stream-DlzW_BXE.js} +1 -1
- package/dist/{stream-DqKDB3nL.cjs → stream-HM3ei83E.cjs} +1 -1
- package/dist/test-utils/llm-mock.cjs +1 -1
- package/dist/test-utils/llm-mock.js +1 -1
- package/dist/tool-loop-agent/index.cjs +1 -1
- package/dist/tool-loop-agent/index.js +1 -1
- package/dist/{tool-loop-agent-DvZcOxWe.js → tool-loop-agent-BBlEpcl4.js} +3 -3
- package/dist/{tool-loop-agent-D4gSdYuN.cjs → tool-loop-agent-CLyS2mqD.cjs} +3 -3
- package/dist/{utils-Dd4m7z13.cjs → utils-CYmtHkJO.cjs} +1 -1
- package/dist/{utils-h5k_ChdS.js → utils-DlBS4OO7.js} +1 -1
- package/dist/utils.cjs +1 -1
- package/dist/utils.js +1 -1
- package/dist/{validate-DQB9spZ1.js → validate-C7Ltq3EW.js} +1 -1
- package/dist/{validate-u6_TUYSo.cjs → validate-CPda0kNf.cjs} +1 -1
- package/dist/vector/index.cjs +1 -1
- package/dist/vector/index.js +1 -1
- package/dist/worker/index.cjs +1 -1
- package/dist/worker/index.js +1 -1
- package/dist/{worker-0F7Nukyf.cjs → worker-BTLxhv5x.cjs} +2 -2
- package/dist/{worker-DmUkyJY_.js → worker-C75s75rt.js} +2 -2
- package/dist/{worker-DWOK2M_5.js → worker-CcLWNaev.js} +2 -2
- package/dist/{worker-D-cq8McN.cjs → worker-DkqCjpGQ.cjs} +2 -2
- package/dist/{workflow-DXE15e-w.cjs → workflow-BFlBk2d6.cjs} +3 -3
- package/dist/{workflow-DamOke3z.js → workflow-Dq4584lm.js} +3 -3
- package/dist/workflows/builder/index.cjs +1 -1
- package/dist/workflows/builder/index.js +1 -1
- package/dist/workflows/evented/index.cjs +1 -1
- package/dist/workflows/evented/index.js +1 -1
- package/dist/workflows/index.cjs +4 -4
- package/dist/workflows/index.js +4 -4
- package/dist/workspace/tools/media.d.ts +2 -2
- package/package.json +6 -6
- package/src/llm/model/provider-types.generated.d.ts +7693 -7570
|
@@ -184,7 +184,7 @@ Set `toolDisplay: 'text'` on an adapter to render tool calls as plain text inste
|
|
|
184
184
|
|
|
185
185
|
### Custom action handling
|
|
186
186
|
|
|
187
|
-
Use `handlers.onAction` to handle button clicks and select changes from cards you post yourself. The handler is called with the Chat SDK action event and the default handler, plus the same `ctx` the other channel handlers receive. Values you set on `ctx.requestContext` before delegating carry through to the resumed tool call. The default handler processes the built-in Approve and Deny buttons and ignores every other action ID, so call it for events you don't handle to keep tool approval working:
|
|
187
|
+
Use `handlers.onAction` to handle button clicks and select changes from cards you post yourself. The handler is called with the Chat SDK action event and the default handler, plus the same `ctx` the other channel handlers receive. Values you set on `ctx.requestContext` before delegating carry through to the resumed tool call. The default handler processes the built-in Approve and Deny buttons and the Continue button (`CONTINUE_RUN_ACTION_ID`), and ignores every other action ID, so call it for events you don't handle to keep tool approval and run continuation working:
|
|
188
188
|
|
|
189
189
|
```typescript
|
|
190
190
|
channels: {
|
|
@@ -294,6 +294,22 @@ Messages that come in over a channel carry a `platform` attribute (for example `
|
|
|
294
294
|
|
|
295
295
|
Replies on those runs go through the same adapter path as replies to a message. Mastra remembers the last person who wrote in the thread, so adapters that need a recipient, like Slack's native streaming, work the same way.
|
|
296
296
|
|
|
297
|
+
### Subscribe to threads the bot started
|
|
298
|
+
|
|
299
|
+
A thread the bot opened itself, such as a scheduled digest, has no Mastra thread until someone mentions the bot in it. Call `subscribeThread()` after posting to create that mapping and subscribe to the thread, so replies reach the agent without a mention. An existing mapping is reused and keeps its original owner.
|
|
300
|
+
|
|
301
|
+
```typescript
|
|
302
|
+
const channels = agent.getChannels()!
|
|
303
|
+
const sent = await channels.sdk!.channel('slack:C123ABC').post('Daily digest is ready.')
|
|
304
|
+
|
|
305
|
+
await channels.subscribeThread({
|
|
306
|
+
thread: channels.sdk!.thread(sent.threadId),
|
|
307
|
+
resourceId: 'digest-bot',
|
|
308
|
+
})
|
|
309
|
+
```
|
|
310
|
+
|
|
311
|
+
`resourceId` owns the Mastra thread if a new one is created. Pass `threadId` to choose its ID, otherwise Mastra generates one.
|
|
312
|
+
|
|
297
313
|
## Multi-user awareness
|
|
298
314
|
|
|
299
315
|
In group conversations, Mastra prefixes each message with the sender's name and platform ID so the agent can distinguish between speakers:
|
|
@@ -360,6 +376,31 @@ channels: {
|
|
|
360
376
|
},
|
|
361
377
|
```
|
|
362
378
|
|
|
379
|
+
To let people continue a stopped run from the chat, return a card with a `CONTINUE_RUN_ACTION_ID` button from `formatError`. Pressing the button sends `Continue.` to the agent from the person who pressed it, through `onSubscribedMessage`, the same way a reply in the thread would:
|
|
380
|
+
|
|
381
|
+
```typescript
|
|
382
|
+
import { CONTINUE_RUN_ACTION_ID } from '@mastra/core/channels'
|
|
383
|
+
import { Actions, Button, Card, CardText } from 'chat'
|
|
384
|
+
|
|
385
|
+
channels: {
|
|
386
|
+
adapters: {
|
|
387
|
+
slack: {
|
|
388
|
+
adapter: createSlackAdapter(),
|
|
389
|
+
formatError: error =>
|
|
390
|
+
Card({
|
|
391
|
+
title: 'Run stopped',
|
|
392
|
+
children: [
|
|
393
|
+
CardText(error.message),
|
|
394
|
+
Actions([Button({ id: CONTINUE_RUN_ACTION_ID, label: 'Continue' })]),
|
|
395
|
+
],
|
|
396
|
+
}),
|
|
397
|
+
},
|
|
398
|
+
},
|
|
399
|
+
},
|
|
400
|
+
```
|
|
401
|
+
|
|
402
|
+
The button does nothing when `onSubscribedMessage` or `onAction` is set to `false`.
|
|
403
|
+
|
|
363
404
|
Platform retries sometimes deliver an event more than once. Adapters use channel state for deduplication, which [storage](https://mastra.ai/docs/storage) can preserve across restarts. Because this protection is best effort, custom-handler side effects should be idempotent so duplicate delivery can't repeat work such as ticket creation.
|
|
364
405
|
|
|
365
406
|
### Batched messages
|
|
@@ -100,6 +100,8 @@ yarn dlx skills update mastra
|
|
|
100
100
|
bun x skills update mastra
|
|
101
101
|
```
|
|
102
102
|
|
|
103
|
+
From version 1.87, the `@mastra/core` package includes the `mastra` skill, so tools that sync skills from installed packages, such as [`skills`](https://github.com/vercel-labs/skills#sync-skills-from-npm-packages) and [pnpm](https://pnpm.io/agent-skills), can use it.
|
|
104
|
+
|
|
103
105
|
> **Note:** When you create a project with [create mastra](https://mastra.ai/docs), the command automatically installs the Mastra skills so your coding agent can discover and use them.
|
|
104
106
|
|
|
105
107
|
### Mastra CLI
|
|
@@ -246,6 +246,8 @@ Omitting `scorerIds` from an update preserves its current value. Each item versi
|
|
|
246
246
|
|
|
247
247
|
Mastra resolves scorer IDs the same way at every level by checking registered scorers first and then asking the Editor to load a stored scorer, so stored scorers work even in a durable run's worker that never loaded them. Mastra doesn't resolve IDs from lower-priority sources that the precedence rules ignore.
|
|
248
248
|
|
|
249
|
+
When an Editor is configured, creating an experiment pins the current version of every stored scorer it can use, at the experiment, dataset, and item level. Each item is scored with the pinned version, even if someone edits the scorer while the experiment runs. Scorers registered in code aren't versioned, so they aren't pinned.
|
|
250
|
+
|
|
249
251
|
An unknown ID in the experiment's `scorers` option rejects `startExperiment()`, `startExperimentAsync()`, or `createExperiment()` with the `EXPERIMENT_SCORER_NOT_FOUND` code before Mastra creates the experiment. The server returns a `400` response for this error.
|
|
250
252
|
|
|
251
253
|
If an item's scorer can't be found once the experiment is running, that item fails with the `EXPERIMENT_ITEM_SCORER_NOT_FOUND` code. This happens for a stale item-level or dataset-level ID, or for a scorer deleted after the experiment started. Mastra skips target execution without retrying that item, while the rest of the experiment continues.
|
|
@@ -392,4 +392,8 @@ const toneOfVoice = createRubricScorer({
|
|
|
392
392
|
|
|
393
393
|
### Limit response length
|
|
394
394
|
|
|
395
|
-
Use `checks.matches(/^[\s\S]{1,1000}$/)` to require an answer between 1 and 1,000 characters. Choose a limit appropriate to the task. See [Text checks](https://mastra.ai/docs/evals/quick-checks).
|
|
395
|
+
Use `checks.matches(/^[\s\S]{1,1000}$/)` to require an answer between 1 and 1,000 characters. Choose a limit appropriate to the task. See [Text checks](https://mastra.ai/docs/evals/quick-checks).
|
|
396
|
+
|
|
397
|
+
### Test stateful agents
|
|
398
|
+
|
|
399
|
+
When an agent has memory, context stored during one test case can leak into the next. See [Testing stateful agents](https://mastra.ai/docs/guides/testing-stateful-agents) to isolate threads and resources, seed known memory, and check what the agent stores.
|
|
@@ -12,4 +12,5 @@ These guides explain how Mastra's features work together when building AI applic
|
|
|
12
12
|
- [Authentication and identity](https://mastra.ai/docs/guides/authentication-identity)
|
|
13
13
|
- [MCP authentication](https://mastra.ai/docs/guides/mcp-authentication-authorization)
|
|
14
14
|
- [Streaming](https://mastra.ai/docs/guides/streaming)
|
|
15
|
-
- [Build an eval loop](https://mastra.ai/docs/guides/build-an-eval-loop)
|
|
15
|
+
- [Build an eval loop](https://mastra.ai/docs/guides/build-an-eval-loop)
|
|
16
|
+
- [Testing stateful agents](https://mastra.ai/docs/guides/testing-stateful-agents)
|
|
@@ -195,6 +195,14 @@ The first run prints `succeeded` with every article counted as `created`. Run it
|
|
|
195
195
|
|
|
196
196
|
Knowledge doesn't schedule runs. Call `run()` from your own scheduler, such as a cron job or a scheduled workflow. Only one run of a binding goes at a time. A second call while one is going returns `skipped`.
|
|
197
197
|
|
|
198
|
+
By default a flush holds up to `bufferSize` items, whatever their size. When your host limits request size, set `maxFlushBytes` so a batch of large items is sent in parts instead of failing at the same items on every run:
|
|
199
|
+
|
|
200
|
+
```typescript
|
|
201
|
+
await knowledge.importers!.run('acme-help-desk', { maxFlushBytes: 8 * 1024 * 1024 })
|
|
202
|
+
```
|
|
203
|
+
|
|
204
|
+
The limit counts the request encoded as JSON. A host can also send its own limit when a run starts, and the runner keeps under the lower of the two. An item or saved cursor too big for a request on its own ends the run with the error code `flush_too_large`, before anything more is sent.
|
|
205
|
+
|
|
198
206
|
### Read the run result
|
|
199
207
|
|
|
200
208
|
A finished run has an `outcome` of `succeeded`, `failed` or `canceled`, and `counts` of what changed. `succeeded` means the run processed everything your importer sent. It doesn't mean the source and Knowledge are in sync: items can still be refused. Check `counts.refused`, and `refused` for each refused item's `sourceId` and reason. When a run fails, `error.code` says why and `error.retryable` says whether running it again may help. When a run returns `status: 'unfinished'`, it ended but the runner couldn't confirm that Knowledge recorded its result, for example because a reply was lost. Errors from Knowledge that retrying can't fix are thrown from `run()`.
|
|
@@ -207,7 +215,9 @@ Use `ctx.reportBacklog()` in your importer when it stops early on purpose, for e
|
|
|
207
215
|
|
|
208
216
|
When a page already sits at the binding's target, it becomes the importer's folder: its body and the pages under it are kept, and items are added under it. Folders are shared: if that page is another binding's folder or item, it stays that too, and both bindings keep writing and removing their own items under it. When the source removes an item whose page is another binding's folder, the page is kept as a stub, so that binding's folder keeps its ID. When an item's place is already taken by a page, your importer takes that page over, whoever wrote it. The page keeps its ID and anything nested under it, and the item's title and description replace its own. Its body replaces the page's body when the item sends one. A declare sends none. The page keeps its body until an upsert sends one. Unless the page was another importer's item, the body it had before the import is kept in a note on the page. From then on the importer updates it like a page it created. When the source removes the item, the page is never deleted: it gets that saved body back, or becomes a stub when no body was saved. Each takeover saves the body the page has at that moment and replaces the note an earlier takeover left, so edits made after a removal are what the next removal gives back. A page whose body is empty at that moment keeps no note, and its next removal leaves a stub. That includes the item coming back from the source after a removal. If someone deletes the note, the page becomes a stub instead, until a later takeover saves a new one.
|
|
209
217
|
|
|
210
|
-
Importers write where they're configured. When an item of your importer takes over a page another binding imported as an item, that binding stops tracking it, and its next run writes its item again. When two bindings write the same page, the one that ran last owns it. When a binding moves its pages, pages other bindings imported under them move too, and those bindings' links to them are fixed on their next run, even one that sends nothing. Each run takes the page back and rewrites it, so give bindings separate targets unless you want that. When someone moves an imported page elsewhere in the same scope, it stays where they put it and keeps getting the item's updates. If the source then removes the item, the page is deleted where they put it. When someone moves it into another scope, it stays there as an ordinary page and the
|
|
218
|
+
Importers write where they're configured. When an item of your importer takes over a page another binding imported as an item, that binding stops tracking it, and its next run writes its item again. When two bindings write the same page, the one that ran last owns it. When a binding moves its pages, pages other bindings imported under them move too, and those bindings' links to them are fixed on their next run, even one that sends nothing. Each run takes the page back and rewrites it, so give bindings separate targets unless you want that. When someone moves an imported page elsewhere in the same scope, it stays where they put it and keeps getting the item's updates. If the source then removes the item, the page is deleted where they put it. When someone moves it into another scope, it stays there as an ordinary page, and the item is written again at the target the next time your importer sends it. People can add their own pages under imported pages. Those move along with their parent.
|
|
219
|
+
|
|
220
|
+
When someone merges an imported page into another page, the importer leaves it alone. It keeps tracking the item, but later upserts of that item are skipped and counted in `counts.merged`, removing the item does nothing, and the page it was merged into is never touched. A new child of that item goes under its `fallbackParent` page when one exists, otherwise in the importer's folder, and it stays there. Existing children move under the page it was merged into. When that page is in the same scope, they keep getting their items' updates. When it's in another scope, they stay there as ordinary pages. Their items return to the importer's folder only when the source sends them again, which an incremental importer may not do.
|
|
211
221
|
|
|
212
222
|
An item is refused when it can't be written, for example when someone changes the page at the same moment. A binding whose folder was deleted still removes the items it tracks. Its next write makes the folder again. Refused items are counted in `counts.refused`, and the run result lists them in `refused`, each with its `sourceId` and a `reason`. The list holds the first 100. Send the item again. An importer that reads from a cursor may already have saved a cursor past the refused item, so a normal next run doesn't always send it. Reset that cursor, or have your importer send the item again some other way.
|
|
213
223
|
|
|
@@ -148,6 +148,32 @@ export const faq = new Agent({
|
|
|
148
148
|
|
|
149
149
|
The function must return every `resource:` and `thread:` scope it receives. Memory uses them to identify the user and thread. The run fails if one is missing.
|
|
150
150
|
|
|
151
|
+
### Agent identities
|
|
152
|
+
|
|
153
|
+
Spread `knowledgeAgentScopes()` into your `scopes` to give each agent run an identity of its own. A run of an agent then also holds `agent:<agentId>`. With an `org:` scope it holds `agent:<agentId>:org:<orgId>`, and with a Memory resource it holds `agent:<agentId>:user:<resourceId>`. When the agent's `metadata.persona` has a `role` or `teamId`, the run also holds `agent:persona:role:<role>` or `agent:persona:team:<teamId>` scopes:
|
|
154
|
+
|
|
155
|
+
```typescript
|
|
156
|
+
import { Knowledge, knowledgeAgentScopes, knowledgeMemoryScopes } from '@mastra/core/knowledge'
|
|
157
|
+
|
|
158
|
+
const knowledge = new Knowledge({
|
|
159
|
+
storage,
|
|
160
|
+
scopes: { ...knowledgeMemoryScopes(), ...knowledgeAgentScopes() },
|
|
161
|
+
})
|
|
162
|
+
|
|
163
|
+
export const support = new Agent({
|
|
164
|
+
id: 'support',
|
|
165
|
+
name: 'Support',
|
|
166
|
+
instructions: 'You help customers with billing questions.',
|
|
167
|
+
model: 'openai/gpt-6.2-sol',
|
|
168
|
+
metadata: { persona: { role: 'support', teamId: 'billing' } },
|
|
169
|
+
knowledge,
|
|
170
|
+
})
|
|
171
|
+
```
|
|
172
|
+
|
|
173
|
+
These identities grant nothing on their own. Name them in an access rule, for example `{ principal: 'agent:support:org:$orgId', role: 'viewer' }`, to give that agent access to a scope within the run's organization. `agent:support` binds no organization, so a rule naming it on a per-organization scope such as `team:$orgId:$teamId` grants access in every organization. Use it only for access you mean to share across organizations.
|
|
174
|
+
|
|
175
|
+
`knowledgePersonaScopes()` adds a read-only convention on top: each agent reads its own `#persona` page, and every agent of a role or team reads that scope's `#rules` page, pinned into its context. To let one agent edit those rules, pass `agent:persona:role:<role>:edit` or `agent:persona:team:<teamId>:edit` in that run's scopes.
|
|
176
|
+
|
|
151
177
|
## How access is decided
|
|
152
178
|
|
|
153
179
|
Each time a tool runs, Knowledge works out which scopes the run can reach and with which role:
|
|
@@ -212,6 +212,66 @@ Platform adds these fields and grouping options:
|
|
|
212
212
|
|
|
213
213
|
All traces are retained for six months. This retention period is subject to change for all month-to-month plans. See [pricing](https://mastra.ai/pricing) for current plan limits.
|
|
214
214
|
|
|
215
|
+
### Search span content
|
|
216
|
+
|
|
217
|
+
Word search finds traces and spans by the words in span input, output, and error text. In the filter bar, pick a content field with the **contains words** operator: **Any span content**, **Span input**, **Span output**, or **Span error** on the **Traces** page, and **Any Content**, **Input**, **Output**, or **Error** on the **Spans** page. A search over more than 7 days can take up to a minute.
|
|
218
|
+
|
|
219
|
+
Through the API, use the [`hasAllTokens` predicate](https://mastra.ai/reference/observability/tracing/advanced-queries). This query finds failed tool calls whose error contains both "connection" and "refused":
|
|
220
|
+
|
|
221
|
+
```bash
|
|
222
|
+
npx mastra api span query '{
|
|
223
|
+
"timeRange": {
|
|
224
|
+
"from": "2026-08-07T00:00:00.000Z",
|
|
225
|
+
"to": "2026-08-08T00:00:00.000Z"
|
|
226
|
+
},
|
|
227
|
+
"where": {
|
|
228
|
+
"op": "and",
|
|
229
|
+
"args": [
|
|
230
|
+
{ "op": "eq", "left": { "path": "spanType" }, "right": { "literal": "tool_call" } },
|
|
231
|
+
{ "op": "hasAllTokens", "left": { "path": "error" }, "right": { "literal": "connection refused" } }
|
|
232
|
+
]
|
|
233
|
+
},
|
|
234
|
+
"page": { "limit": 25 }
|
|
235
|
+
}'
|
|
236
|
+
```
|
|
237
|
+
|
|
238
|
+
In `trace query` and `trace aggregate`, put `hasAllTokens` inside `spans.some`. `span query` and `span aggregate` accept it directly in `where`.
|
|
239
|
+
|
|
240
|
+
Platform matches words this way:
|
|
241
|
+
|
|
242
|
+
- A span matches when the field contains every word, in any order. Phrase search isn't supported: `"connection refused"` also matches `refused connection`.
|
|
243
|
+
- Words match whole. `time` doesn't match `timeout`.
|
|
244
|
+
- Any ASCII character other than a letter or digit separates words, including spaces, quotes, `-`, `_`, and `.`. `user_id` searches for `user` and `id`. Other characters, such as accented letters and CJK text, don't separate words.
|
|
245
|
+
- Matching ignores the case of ASCII letters.
|
|
246
|
+
- With `all`, one field must contain every word. Words found in different fields don't combine.
|
|
247
|
+
|
|
248
|
+
Word search has these limits:
|
|
249
|
+
|
|
250
|
+
| Limit | Value |
|
|
251
|
+
| ---------------------------- | -------------------------------------------------------------- |
|
|
252
|
+
| Words per request | 5 distinct words, counted across all `hasAllTokens` predicates |
|
|
253
|
+
| Search text | 256 characters per predicate |
|
|
254
|
+
| Time range | 120 days |
|
|
255
|
+
| Request time, up to 7 days | Same as other queries |
|
|
256
|
+
| Request time, over 7 days | Up to 60 seconds |
|
|
257
|
+
| Searches over 7 days at once | 2 running and 4 waiting per organization |
|
|
258
|
+
|
|
259
|
+
A span is searched when it starts within the time range. A span that runs longer than 30 days can be missed.
|
|
260
|
+
|
|
261
|
+
`mastra api` stops waiting after 30 seconds by default. For a search over more than 7 days, pass a longer timeout in milliseconds, such as `--timeout 90000`.
|
|
262
|
+
|
|
263
|
+
Word search returns these errors:
|
|
264
|
+
|
|
265
|
+
| Status | Response | What to do |
|
|
266
|
+
| -------------- | ------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------ |
|
|
267
|
+
| `404` | `Text search is not available` | Word search isn't enabled for your organization. Check the capabilities below. |
|
|
268
|
+
| `422` | `TRACE_QUERY_INVALID` with issue `time_range_too_large` | Search at most 120 days. |
|
|
269
|
+
| `422` | `TRACE_QUERY_INVALID` with issue `invalid_literal` | Search at most 5 words. |
|
|
270
|
+
| `422` or `504` | `name: "search_too_expensive"` | Narrow the time range or select one project. |
|
|
271
|
+
| `429` | `name: "search_busy"` with `Retry-After: 60` | Other searches over 7 days are running in your organization. Retry after a minute or search a shorter range. |
|
|
272
|
+
|
|
273
|
+
Check `traceQueryTokenSearch`, `traceAggregateTokenSearch`, `spanQueryTokenSearch`, and `spanAggregateTokenSearch` from `getObservabilityCapabilities()` before searching. A `false` value means the operation doesn't accept word search for your organization. The [Platform MCP server](https://mastra.ai/docs/mastra-platform/mcp) doesn't offer word search.
|
|
274
|
+
|
|
215
275
|
### Other observability data
|
|
216
276
|
|
|
217
277
|
You can query exported feedback over HTTP. See the [Feedback API](https://mastra.ai/docs/mastra-platform/api) for its current status, regional endpoints, authentication, project scoping, and supported query parameters such as `traceId` and `environment`.
|
|
@@ -47,21 +47,7 @@ yarn add @mastra/memory@latest @mastra/libsql@latest
|
|
|
47
47
|
bun add @mastra/memory@latest @mastra/libsql@latest
|
|
48
48
|
```
|
|
49
49
|
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
```typescript
|
|
53
|
-
import { Mastra } from '@mastra/core'
|
|
54
|
-
import { LibSQLStore } from '@mastra/libsql'
|
|
55
|
-
|
|
56
|
-
export const mastra = new Mastra({
|
|
57
|
-
storage: new LibSQLStore({
|
|
58
|
-
id: 'mastra-storage',
|
|
59
|
-
url: 'file:./mastra.db',
|
|
60
|
-
}),
|
|
61
|
-
})
|
|
62
|
-
```
|
|
63
|
-
|
|
64
|
-
Instantiate a [`Memory`](https://mastra.ai/reference/memory/memory-class) instance in your agent:
|
|
50
|
+
Create an agent with a [`Memory`](https://mastra.ai/reference/memory/memory-class) instance. Set `OPENAI_API_KEY` to run this example or choose a model from another [configured provider](https://mastra.ai/models/environment-variables).
|
|
65
51
|
|
|
66
52
|
```typescript
|
|
67
53
|
import { Memory } from '@mastra/memory'
|
|
@@ -69,6 +55,9 @@ import { Agent } from '@mastra/core/agent'
|
|
|
69
55
|
|
|
70
56
|
export const agent = new Agent({
|
|
71
57
|
id: 'test-agent',
|
|
58
|
+
name: 'Test Agent',
|
|
59
|
+
instructions: 'Help the user and remember details they share.',
|
|
60
|
+
model: 'openai/gpt-6.2-sol',
|
|
72
61
|
memory: new Memory({
|
|
73
62
|
options: {
|
|
74
63
|
lastMessages: 10,
|
|
@@ -77,7 +66,23 @@ export const agent = new Agent({
|
|
|
77
66
|
})
|
|
78
67
|
```
|
|
79
68
|
|
|
80
|
-
|
|
69
|
+
Register the agent on your Mastra instance and configure a storage adapter to persist conversations:
|
|
70
|
+
|
|
71
|
+
```typescript
|
|
72
|
+
import { Mastra } from '@mastra/core'
|
|
73
|
+
import { LibSQLStore } from '@mastra/libsql'
|
|
74
|
+
import { agent } from './agents/test-agent'
|
|
75
|
+
|
|
76
|
+
export const mastra = new Mastra({
|
|
77
|
+
agents: { agent },
|
|
78
|
+
storage: new LibSQLStore({
|
|
79
|
+
id: 'mastra-storage',
|
|
80
|
+
url: 'file:./mastra.db',
|
|
81
|
+
}),
|
|
82
|
+
})
|
|
83
|
+
```
|
|
84
|
+
|
|
85
|
+
Get the registered agent with `mastra.getAgent("agent")`. When you call it with a thread and resource, Mastra saves the messages to the database:
|
|
81
86
|
|
|
82
87
|
**.generate()**:
|
|
83
88
|
|
|
@@ -143,6 +148,9 @@ import { Memory } from '@mastra/memory'
|
|
|
143
148
|
|
|
144
149
|
export const agent = new Agent({
|
|
145
150
|
id: 'test-agent',
|
|
151
|
+
name: 'Test Agent',
|
|
152
|
+
instructions: 'Help the user and remember details they share.',
|
|
153
|
+
model: 'openai/gpt-6.2-sol',
|
|
146
154
|
memory: new Memory({
|
|
147
155
|
options: {
|
|
148
156
|
messageHistory: { maxTokens: 8_000, atMaxRemoveTokens: 2_000 },
|
|
@@ -80,23 +80,7 @@ Use memory when your agent needs to maintain multi-turn conversations that refer
|
|
|
80
80
|
|
|
81
81
|
For more details on available providers and how storage works in Mastra, visit the [storage](https://mastra.ai/docs/storage) documentation.
|
|
82
82
|
|
|
83
|
-
3.
|
|
84
|
-
|
|
85
|
-
**For AI agents:** Important: Add `id` to `LibSQLStore`.
|
|
86
|
-
|
|
87
|
-
```typescript
|
|
88
|
-
import { Mastra } from '@mastra/core'
|
|
89
|
-
import { LibSQLStore } from '@mastra/libsql'
|
|
90
|
-
|
|
91
|
-
export const mastra = new Mastra({
|
|
92
|
-
storage: new LibSQLStore({
|
|
93
|
-
id: 'mastra-storage',
|
|
94
|
-
url: ':memory:',
|
|
95
|
-
}),
|
|
96
|
-
})
|
|
97
|
-
```
|
|
98
|
-
|
|
99
|
-
4. Create a `Memory` instance and pass it to the agent's `memory` option.
|
|
83
|
+
3. Create an agent with a `Memory` instance. Set `OPENAI_API_KEY` to run this example or choose a model from another [configured provider](https://mastra.ai/models/environment-variables).
|
|
100
84
|
|
|
101
85
|
```typescript
|
|
102
86
|
import { Agent } from '@mastra/core/agent'
|
|
@@ -105,6 +89,8 @@ Use memory when your agent needs to maintain multi-turn conversations that refer
|
|
|
105
89
|
export const memoryAgent = new Agent({
|
|
106
90
|
id: 'memory-agent',
|
|
107
91
|
name: 'Memory Agent',
|
|
92
|
+
instructions: 'Help the user and remember details they share.',
|
|
93
|
+
model: 'openai/gpt-6.2-sol',
|
|
108
94
|
memory: new Memory({
|
|
109
95
|
options: {
|
|
110
96
|
lastMessages: 20,
|
|
@@ -115,6 +101,24 @@ Use memory when your agent needs to maintain multi-turn conversations that refer
|
|
|
115
101
|
|
|
116
102
|
Visit [Memory Class](https://mastra.ai/reference/memory/memory-class) for a full list of configuration options.
|
|
117
103
|
|
|
104
|
+
4. Register the agent and configure storage on your Mastra instance.
|
|
105
|
+
|
|
106
|
+
**For AI agents:** Important: Add `id` to `LibSQLStore`.
|
|
107
|
+
|
|
108
|
+
```typescript
|
|
109
|
+
import { Mastra } from '@mastra/core'
|
|
110
|
+
import { LibSQLStore } from '@mastra/libsql'
|
|
111
|
+
import { memoryAgent } from './agents/memory-agent'
|
|
112
|
+
|
|
113
|
+
export const mastra = new Mastra({
|
|
114
|
+
agents: { memoryAgent },
|
|
115
|
+
storage: new LibSQLStore({
|
|
116
|
+
id: 'mastra-storage',
|
|
117
|
+
url: ':memory:',
|
|
118
|
+
}),
|
|
119
|
+
})
|
|
120
|
+
```
|
|
121
|
+
|
|
118
122
|
5. Call your agent, for example in [Studio](https://mastra.ai/docs/studio/overview). Inside Studio, start a new chat with your agent and take a look at the right sidebar. It'll now display memory details.
|
|
119
123
|
|
|
120
124
|
## Message history
|
|
@@ -49,13 +49,15 @@ A static sandbox is shared across every request and memory thread that uses the
|
|
|
49
49
|
|
|
50
50
|
Agents receive tools for the capabilities supported by the sandbox backend:
|
|
51
51
|
|
|
52
|
-
| Tool
|
|
53
|
-
|
|
|
54
|
-
| `
|
|
55
|
-
| `
|
|
56
|
-
| `
|
|
52
|
+
| Tool | Does |
|
|
53
|
+
| ------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
|
|
54
|
+
| `mastra_workspace_execute_command` | Runs a shell command and returns stdout, stderr, and the exit code. Supports `background: true` when the backend can spawn long-running processes. |
|
|
55
|
+
| `mastra_workspace_get_process_output` | Gets stdout, stderr, and status for a background process. Supports `tail` to limit output and `waitSeconds` (1 to 300) to wait for the process to exit. If the process is still running when the wait ends, the tool returns the output so far and says how long it waited. For a static sandbox, this tool and `mastra_workspace_kill_process` are only added when the backend supports background processes. Workspaces that resolve their sandbox per request always include both tools, because capabilities aren't known until the sandbox resolves. |
|
|
56
|
+
| `mastra_workspace_kill_process` | Stops a background process and returns its recent output. |
|
|
57
57
|
|
|
58
|
-
Configured capabilities determine which tools are available.
|
|
58
|
+
Configured capabilities determine which tools are available. Use the IDs in the table or their corresponding `WORKSPACE_TOOLS.SANDBOX` constants as keys in `tools`. Mastra ignores unrecognized keys such as `execute_command`.
|
|
59
|
+
|
|
60
|
+
The following example disables the shell tool.
|
|
59
61
|
|
|
60
62
|
```typescript
|
|
61
63
|
import { LocalSandbox, Workspace, WORKSPACE_TOOLS } from '@mastra/core/workspace'
|
|
@@ -261,7 +263,7 @@ Because a [resolver-backed sandbox](#sandboxes-per-user-or-thread) isn't known u
|
|
|
261
263
|
|
|
262
264
|
## Background processes
|
|
263
265
|
|
|
264
|
-
When agents start background processes through `
|
|
266
|
+
When agents start background processes through `mastra_workspace_execute_command`, you can receive lifecycle callbacks for stdout, stderr, and process exit. Configure these through the `backgroundProcesses` option on its `WORKSPACE_TOOLS.SANDBOX.EXECUTE_COMMAND` entry:
|
|
265
267
|
|
|
266
268
|
```typescript
|
|
267
269
|
import { Workspace, LocalSandbox, WORKSPACE_TOOLS } from '@mastra/core/workspace'
|
|
@@ -280,13 +282,13 @@ const workspace = new Workspace({
|
|
|
280
282
|
})
|
|
281
283
|
```
|
|
282
284
|
|
|
283
|
-
These callbacks fire for all background processes started by the agent through `
|
|
285
|
+
These callbacks fire for all background processes started by the agent through `mastra_workspace_execute_command`.
|
|
284
286
|
|
|
285
|
-
Each callback receives the process `pid` and, when available, the `toolCallId`, `agentId`, `threadId`, `resourceId`, and `runId` of the call that started it, so you can route an exit notice back to the right conversation. `onExit` also gets `killedByAbort`, which is `true` when the abort signal fired (the run's signal by default) and stopped the process, and `false` when it exited on its own or was stopped with `
|
|
287
|
+
Each callback receives the process `pid` and, when available, the `toolCallId`, `agentId`, `threadId`, `resourceId`, and `runId` of the call that started it, so you can route an exit notice back to the right conversation. `onExit` also gets `killedByAbort`, which is `true` when the abort signal fired (the run's signal by default) and stopped the process, and `false` when it exited on its own or was stopped with `mastra_workspace_kill_process`.
|
|
286
288
|
|
|
287
289
|
By default, background processes inherit the agent's abort signal and stop when the agent disconnects. Set `abortSignal` to a custom signal, or use `null` or `false` when the process should continue after the request ends.
|
|
288
290
|
|
|
289
|
-
The `timeout` input of `
|
|
291
|
+
The `timeout` input of `mastra_workspace_execute_command` also applies to background commands: the process is stopped after that many seconds. A `timeout` of `0` sets no timer in `LocalSandbox`. When `timeout` is omitted, the sandbox provider decides. `LocalSandbox` sets no timer for background commands, while `E2BSandbox` uses the `timeout` option it was created with, which defaults to 300 seconds. That option is in milliseconds, unlike the `mastra_workspace_execute_command` `timeout`, so a 60-second default needs `new E2BSandbox({ timeout: 60000 })`. The tool description tells agents to omit `timeout` for dev servers and other commands meant to keep running.
|
|
290
292
|
|
|
291
293
|
For the full `SandboxProcessManager` API, including programmatic process spawning, output, and standard input, see the [`SandboxProcessManager` reference](https://mastra.ai/reference/workspace/process-manager).
|
|
292
294
|
|
|
@@ -24,24 +24,33 @@ import { createWorkflow, createStep } from '@mastra/core/workflows'
|
|
|
24
24
|
import { z } from 'zod'
|
|
25
25
|
|
|
26
26
|
const step1 = createStep({
|
|
27
|
+
id: 'step-1',
|
|
27
28
|
inputSchema: z.object({
|
|
28
29
|
message: z.string(),
|
|
29
30
|
}),
|
|
30
31
|
outputSchema: z.object({
|
|
31
32
|
formatted: z.string(),
|
|
32
33
|
}),
|
|
34
|
+
execute: async ({ inputData }) => ({
|
|
35
|
+
formatted: inputData.message.toUpperCase(),
|
|
36
|
+
}),
|
|
33
37
|
})
|
|
34
38
|
|
|
35
39
|
const step2 = createStep({
|
|
40
|
+
id: 'step-2',
|
|
36
41
|
inputSchema: z.object({
|
|
37
42
|
formatted: z.string(),
|
|
38
43
|
}),
|
|
39
44
|
outputSchema: z.object({
|
|
40
45
|
emphasized: z.string(),
|
|
41
46
|
}),
|
|
47
|
+
execute: async ({ inputData }) => ({
|
|
48
|
+
emphasized: `${inputData.formatted}!`,
|
|
49
|
+
}),
|
|
42
50
|
})
|
|
43
51
|
|
|
44
52
|
export const testWorkflow = createWorkflow({
|
|
53
|
+
id: 'test-workflow',
|
|
45
54
|
inputSchema: z.object({
|
|
46
55
|
message: z.string(),
|
|
47
56
|
}),
|
|
@@ -64,10 +73,20 @@ import { z } from 'zod'
|
|
|
64
73
|
|
|
65
74
|
const step1 = createStep({
|
|
66
75
|
id: 'step-1',
|
|
76
|
+
inputSchema: z.object({ message: z.string() }),
|
|
77
|
+
outputSchema: z.object({ formatted: z.string() }),
|
|
78
|
+
execute: async ({ inputData }) => ({
|
|
79
|
+
formatted: inputData.message.toUpperCase(),
|
|
80
|
+
}),
|
|
67
81
|
})
|
|
68
82
|
|
|
69
83
|
const step2 = createStep({
|
|
70
84
|
id: 'step-2',
|
|
85
|
+
inputSchema: z.object({ message: z.string() }),
|
|
86
|
+
outputSchema: z.object({ emphasized: z.string() }),
|
|
87
|
+
execute: async ({ inputData }) => ({
|
|
88
|
+
emphasized: `${inputData.message}!`,
|
|
89
|
+
}),
|
|
71
90
|
})
|
|
72
91
|
|
|
73
92
|
const step3 = createStep({
|
|
@@ -93,6 +112,7 @@ const step3 = createStep({
|
|
|
93
112
|
})
|
|
94
113
|
|
|
95
114
|
export const testWorkflow = createWorkflow({
|
|
115
|
+
id: 'test-workflow',
|
|
96
116
|
inputSchema: z.object({
|
|
97
117
|
message: z.string(),
|
|
98
118
|
}),
|
|
@@ -47,7 +47,7 @@ Arthur Engine associates traces with tasks in two ways:
|
|
|
47
47
|
- **By service name**: Set `serviceName` in the observability config. Arthur Engine automatically routes traces to the task matching that name, creating it if needed.
|
|
48
48
|
- **By task ID**: Pass a pre-existing `taskId` to the exporter to send traces to a specific task directly.
|
|
49
49
|
|
|
50
|
-
If both are provided, `
|
|
50
|
+
If both are provided, Arthur Engine routes traces by `serviceName` and ignores `taskId`.
|
|
51
51
|
|
|
52
52
|
### Environment variables
|
|
53
53
|
|
|
@@ -200,7 +200,7 @@ The same `id` returns the same `Session` instance. Sessions with different ids a
|
|
|
200
200
|
|
|
201
201
|
**id** (`string`): Session identifier and live-session registry key. Defaults to resourceId.
|
|
202
202
|
|
|
203
|
-
**ownerId** (`string`): Stable identity of the process-local Session host. Defaults to id. New threads use it as their initial owner, but later transfers do not change this value.
|
|
203
|
+
**ownerId** (`string`): Stable identity of the process-local Session host. Defaults to the controller id. New threads use it as their initial owner, but later transfers do not change this value.
|
|
204
204
|
|
|
205
205
|
**tags** (`Record<string, string>`): Tags copied to threads created by the session.
|
|
206
206
|
|
|
@@ -90,6 +90,15 @@ unsubscribe()
|
|
|
90
90
|
|
|
91
91
|
Returns: `() => void`
|
|
92
92
|
|
|
93
|
+
When a processor such as Mastra Code's model rotation emits a `data-mastracode-model-fallback` part after moving a request to a fallback model, the reply gets that part under the same message ID the reply is saved with. The part is held until the reply's `step-start` arrives, so it isn't sent if the stream ends before then. If the reply hasn't started yet, the part arrives in its `message_start` event. Otherwise it arrives in a `message_update` event of type `part`, with its index. Its data holds `from` and `to` (each with `entryId` and `label`), `reason` (`'pool-exhausted'` or `'persistent-outage'`), `at`, and an optional `failure.kind`. To check a stored failure kind at runtime, compare it against `PROVIDER_FAILURE_KINDS` from `@mastra/core/error`:
|
|
94
|
+
|
|
95
|
+
```typescript
|
|
96
|
+
import { PROVIDER_FAILURE_KINDS, type ProviderFailureKind } from '@mastra/core/error'
|
|
97
|
+
|
|
98
|
+
const isFailureKind = (value: string): value is ProviderFailureKind =>
|
|
99
|
+
(PROVIDER_FAILURE_KINDS as readonly string[]).includes(value)
|
|
100
|
+
```
|
|
101
|
+
|
|
93
102
|
#### `initialStateEvents()`
|
|
94
103
|
|
|
95
104
|
Return what a subscriber joining mid-run is missing, as ordinary events the session never emits itself. The list holds a `message_start` for the reply in flight, the latest `om_status` for the active thread, and a `usage_update` whose `total` is the thread's token total. Deliver them to the joining subscriber right before calling `subscribe()`, in the same synchronous block, so no live event lands between the two.
|
|
@@ -330,7 +330,7 @@ do {
|
|
|
330
330
|
reindexLinks(): Promise<number>
|
|
331
331
|
```
|
|
332
332
|
|
|
333
|
-
Rebuilds the page link index from every page body, and resolves to how many pages it indexed. Writes keep the index current, so this is for pages that predate it or were written straight to the store, and for links a write left as they were. A write re-resolves at most 100 linking pages, and checks at most 99 pages sharing a name. Past either limit it logs a warning that names `reindexLinks()`. It needs no vector store.
|
|
333
|
+
Rebuilds the page link index from every page body, and resolves to how many pages it indexed. Writes keep the index current, so this is for pages that predate it or were written straight to the store, and for links a write left as they were. A write re-resolves at most 100 linking pages, and checks at most 99 pages sharing a name. Past either limit it logs a warning that names `reindexLinks()`. An importer flush re-resolves up to 1,000 linking pages in batches of 100. Later flushes re-resolve the rest, and a run that ends with some left chains another run for them when it re-resolved any linking pages. A host whose settle budget is 0 or less doesn't chain for them. It needs no vector store.
|
|
334
334
|
|
|
335
335
|
#### `renameScopeDeclaration()`
|
|
336
336
|
|
|
@@ -51,7 +51,7 @@ A read of a page that doesn't exist lists up to three close matches by `ref`.
|
|
|
51
51
|
|
|
52
52
|
Searches the pages and notes the run can read.
|
|
53
53
|
|
|
54
|
-
The query is split into words, and quote marks are ignored. Each word matches case-insensitively as part of any word, so `refund` matches `refunds`. A page matches when its name, description or body contains at least one of the words. A note matches when its own text does.
|
|
54
|
+
The query is split into words, and quote marks are ignored. Each word matches case-insensitively as part of any word, so `refund` matches `refunds`. A page matches when its name, description or body contains at least one of the words. A note matches when its own text does. A search uses the first 16 distinct words. A word longer than 128 characters fails the search with a `KnowledgeInvalidSearchError` instead of being dropped or cut.
|
|
55
55
|
|
|
56
56
|
Keyword results are ranked in this order:
|
|
57
57
|
|
|
@@ -45,7 +45,7 @@ createSpan(options: CreateSpanOptions<SpanType>): SpanIds | undefined
|
|
|
45
45
|
|
|
46
46
|
Called by the Mastra observability instance during span construction. Creates a dd-trace APM span eagerly via `tracer.startSpan()` and returns Mastra-compatible identifiers. The returned IDs are used by Mastra throughout the span's lifetime. The dd-trace span object is stored internally and used for scope activation.
|
|
47
47
|
|
|
48
|
-
**Returns:** `SpanIds | undefined` - `{ spanId, traceId, parentSpanId }
|
|
48
|
+
**Returns:** `SpanIds | undefined` - `{ spanId, traceId, parentSpanId }` when the parent is a Mastra span, `{ spanId, traceId, externalParentSpanId }` when the parent is an external Datadog span, or `undefined` if the bridge is disabled.
|
|
49
49
|
|
|
50
50
|
### `executeInContext`
|
|
51
51
|
|
|
@@ -176,16 +176,17 @@ See the [DatadogBridge Guide](https://mastra.ai/integrations/observability/datad
|
|
|
176
176
|
|
|
177
177
|
Mastra span types are mapped to Datadog LLM Observability span kinds. When your `@mastra/core` and `@mastra/observability` versions emit `MODEL_INFERENCE` spans (the `model-inference-span` feature), `MODEL_INFERENCE` is the `llm` span and `MODEL_STEP` becomes a `workflow` span that wraps it:
|
|
178
178
|
|
|
179
|
-
| Mastra SpanType
|
|
180
|
-
|
|
|
181
|
-
| `AGENT_RUN`
|
|
182
|
-
| `MODEL_GENERATION`
|
|
183
|
-
| `MODEL_STEP`
|
|
184
|
-
| `MODEL_INFERENCE`
|
|
185
|
-
| `TOOL_CALL`
|
|
186
|
-
| `MCP_TOOL_CALL`
|
|
187
|
-
| `
|
|
188
|
-
|
|
|
179
|
+
| Mastra SpanType | Datadog Kind |
|
|
180
|
+
| -------------------- | ------------------------------------------------------------- |
|
|
181
|
+
| `AGENT_RUN` | `agent` |
|
|
182
|
+
| `MODEL_GENERATION` | `workflow` |
|
|
183
|
+
| `MODEL_STEP` | `llm`, or `workflow` when `MODEL_INFERENCE` spans are emitted |
|
|
184
|
+
| `MODEL_INFERENCE` | `llm` |
|
|
185
|
+
| `TOOL_CALL` | `tool` |
|
|
186
|
+
| `MCP_TOOL_CALL` | `tool` |
|
|
187
|
+
| `PROVIDER_TOOL_CALL` | `tool` |
|
|
188
|
+
| `WORKFLOW_RUN` | `workflow` |
|
|
189
|
+
| All other types | `task` |
|
|
189
190
|
|
|
190
191
|
## Tags support
|
|
191
192
|
|
|
@@ -351,7 +351,7 @@ The object form can return any combination of these properties:
|
|
|
351
351
|
|
|
352
352
|
**systemMessages** (`CoreMessage[]`): Replace all system messages for this step only.
|
|
353
353
|
|
|
354
|
-
**providerOptions** (`
|
|
354
|
+
**providerOptions** (`SharedProviderOptions`): Change provider-specific options for this step.
|
|
355
355
|
|
|
356
356
|
**modelSettings** (`CallSettings`): Change model settings for this step.
|
|
357
357
|
|
|
@@ -47,7 +47,7 @@ The schema definitions below cover the built-in database-backed tables documente
|
|
|
47
47
|
|
|
48
48
|
Stores conversation messages and their metadata. Each message belongs to a thread and contains the actual content along with metadata about the sender role and message type.
|
|
49
49
|
|
|
50
|
-
idtextPRIMARYKEYNOT NULLUnique identifier for the messagethread_idtextNOT NULLParent thread reference (`threads.id`). Postgres and libSQL store `mastra-queue:pending:<threadId>` or `mastra-queue:taken:<threadId>` instead while the row is a queued \[pending signal]\(/docs/server/pubsub#signals-sent-to-a-running-evented-agent), which no read by thread or resource returns, so that value matches no thread.resourceIdtextCAN BE NULLID of the resource that owns this message. Postgres and libSQL store `NULL` while the row is a pending signal.contenttextNOT NULLJSON of the message content in V2 format. Example: `{ format: 2, parts: [...] }`roletextNOT NULLEnum of `user | assistant`createdAttimestampNOT NULLUsed for thread message ordering
|
|
50
|
+
idtextPRIMARYKEYNOT NULLUnique identifier for the messagethread_idtextNOT NULLParent thread reference (`threads.id`). Postgres and libSQL store `mastra-queue:pending:<threadId>` or `mastra-queue:taken:<threadId>` instead while the row is a queued \[pending signal]\(/docs/server/pubsub#signals-sent-to-a-running-evented-agent), which no read by thread or resource returns, so that value matches no thread.resourceIdtextCAN BE NULLID of the resource that owns this message. Postgres and libSQL store `NULL` while the row is a pending signal.contenttextNOT NULLJSON of the message content in V2 format. Example: `{ format: 2, parts: [...] }`roletextNOT NULLEnum of `user | assistant | system | signal`createdAttimestampNOT NULLUsed for thread message ordering
|
|
51
51
|
|
|
52
52
|
The message `content` column contains a JSON object conforming to the `MastraMessageContentV2` type, which is designed to align with the AI SDK `UIMessage` message shape.
|
|
53
53
|
|