@mastra/core 1.87.0 → 1.88.0-alpha.1
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_ai-v6@0.0.100/dist/index.d.ts +97 -2049
- package/dist/_types/@internal_core@0.1.4/dist/knowledge-compat/index.d.ts +17 -1
- package/dist/agent/agent.d.ts +10 -2
- package/dist/agent/durable/create-evented-agent.d.ts +2 -1
- package/dist/agent/durable/execution-engine.d.ts +4 -2
- package/dist/agent/durable/index.cjs +3 -2
- package/dist/agent/durable/index.js +3 -2
- package/dist/agent/durable/segment-spans.d.ts +7 -0
- package/dist/agent/durable/stored-signal-drain.d.ts +1 -1
- package/dist/agent/durable/types.d.ts +6 -0
- package/dist/agent/index.cjs +2 -2
- package/dist/agent/index.js +2 -2
- package/dist/agent/request-context-snapshot.d.ts +5 -0
- package/dist/agent/thread-stream-runtime.d.ts +26 -4
- 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-DckvJ7bq.cjs → agent-controller-C-WK9bMA.cjs} +67 -57
- package/dist/{agent-controller-vUU_atR-.js → agent-controller-Wxbc6702.js} +67 -57
- package/dist/background-tasks/index.cjs +1 -1
- package/dist/background-tasks/index.js +1 -1
- package/dist/{background-tasks-HAzB0JtC.js → background-tasks-DSMkHpbu.js} +1 -1
- package/dist/{background-tasks-By_1e9Gf.cjs → background-tasks-DcKNctMR.cjs} +1 -1
- package/dist/browser/index.cjs +1 -1
- package/dist/browser/index.js +1 -1
- package/dist/{builder-Dx8GMhFn.cjs → builder-CybmqbZt.cjs} +2 -2
- package/dist/{builder-CmtDqFLe.js → builder-PXwZnGYe.js} +2 -2
- package/dist/capabilities/302ai.json +197 -197
- package/dist/capabilities/abliteratedllm.json +35 -35
- package/dist/capabilities/abliteration-ai.json +10 -10
- package/dist/capabilities/above.json +19 -19
- package/dist/capabilities/adaption.json +15 -15
- package/dist/capabilities/adzuki.json +19 -19
- package/dist/capabilities/agentrouter.json +6 -6
- package/dist/capabilities/agnes.json +4 -4
- package/dist/capabilities/ai-router.json +8 -8
- package/dist/capabilities/aiand.json +25 -17
- package/dist/capabilities/aigrow.json +14 -14
- package/dist/capabilities/aimlapi.json +153 -153
- package/dist/capabilities/aixy.json +20 -20
- package/dist/capabilities/aki-io.json +11 -11
- package/dist/capabilities/alibaba-cn.json +93 -93
- 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 +47 -47
- package/dist/capabilities/alibaba-token-plan.json +49 -49
- package/dist/capabilities/alibaba.json +72 -72
- package/dist/capabilities/ambient.json +9 -9
- package/dist/capabilities/amd-tokenlab.json +5 -5
- package/dist/capabilities/amd.json +11 -11
- package/dist/capabilities/anthropic.json +40 -40
- package/dist/capabilities/anyapi.json +48 -48
- package/dist/capabilities/apiko.json +5 -5
- package/dist/capabilities/arcee.json +10 -10
- package/dist/capabilities/augure.json +5 -5
- package/dist/capabilities/auriko.json +18 -18
- package/dist/capabilities/bailing.json +4 -4
- package/dist/capabilities/baseten.json +41 -32
- package/dist/capabilities/bee.json +4 -4
- package/dist/capabilities/bothub.json +10 -10
- package/dist/capabilities/boundless.json +33 -33
- package/dist/capabilities/bumo.json +48 -48
- package/dist/capabilities/byteplus.json +35 -35
- package/dist/capabilities/cerebras.json +4 -4
- package/dist/capabilities/cheapaimodel.json +3 -3
- package/dist/capabilities/cheapest-token.json +28 -28
- package/dist/capabilities/chutes.json +43 -41
- package/dist/capabilities/cline-pass.json +33 -33
- package/dist/capabilities/cloudcode.json +7 -7
- package/dist/capabilities/cloudferro-sherlock.json +4 -4
- package/dist/capabilities/cloudflare-workers-ai.json +18 -18
- package/dist/capabilities/commandcode.json +147 -147
- package/dist/capabilities/concentrate.json +288 -279
- package/dist/capabilities/cortecs.json +108 -108
- package/dist/capabilities/crossmodel.json +157 -157
- package/dist/capabilities/crusoe.json +16 -16
- package/dist/capabilities/daoxe.json +9 -9
- package/dist/capabilities/databricks.json +131 -123
- package/dist/capabilities/deepinfra.json +95 -95
- package/dist/capabilities/deepseek.json +2 -2
- package/dist/capabilities/digitalocean.json +114 -115
- package/dist/capabilities/dothoosh.json +32 -32
- package/dist/capabilities/doubleword.json +26 -26
- package/dist/capabilities/edenai.json +298 -280
- package/dist/capabilities/empiriolabs.json +164 -164
- package/dist/capabilities/engy.json +23 -17
- package/dist/capabilities/entrim.json +4 -4
- package/dist/capabilities/evroc.json +17 -17
- package/dist/capabilities/ezkielyna.json +8 -8
- package/dist/capabilities/fastrouter.json +94 -94
- package/dist/capabilities/fireworks-ai.json +106 -95
- package/dist/capabilities/freemodel.json +9 -9
- package/dist/capabilities/friendli.json +31 -10
- package/dist/capabilities/frogbot.json +100 -100
- package/dist/capabilities/gisoo.json +18 -18
- package/dist/capabilities/gmicloud.json +19 -19
- package/dist/capabilities/google.json +59 -59
- package/dist/capabilities/graphn.json +10 -10
- package/dist/capabilities/greenpt.json +31 -31
- package/dist/capabilities/groq.json +5 -5
- package/dist/capabilities/helicone.json +87 -87
- package/dist/capabilities/hostinger-router.json +5 -5
- package/dist/capabilities/hpc-ai.json +9 -9
- package/dist/capabilities/huawei-maas.json +11 -11
- package/dist/capabilities/hubris.json +31 -31
- package/dist/capabilities/huggingface.json +95 -85
- package/dist/capabilities/humain.json +2 -2
- package/dist/capabilities/hyper.json +23 -23
- package/dist/capabilities/impossibl.json +157 -157
- package/dist/capabilities/inception.json +2 -2
- package/dist/capabilities/inceptron.json +4 -4
- package/dist/capabilities/inco.json +2 -2
- package/dist/capabilities/infer.json +11 -11
- package/dist/capabilities/inferall.json +8 -8
- package/dist/capabilities/inference-coop.json +6 -6
- package/dist/capabilities/inferenceapis.json +25 -25
- package/dist/capabilities/inferris.json +4 -4
- package/dist/capabilities/infersia.json +12 -12
- package/dist/capabilities/inferx.json +2 -2
- package/dist/capabilities/io-net.json +5 -5
- package/dist/capabilities/isoquant.json +4 -4
- package/dist/capabilities/iteracompute.json +43 -43
- package/dist/capabilities/jalapeno.json +10 -10
- package/dist/capabilities/jiekou.json +34 -34
- package/dist/capabilities/jzstoken.json +43 -43
- package/dist/capabilities/keln.json +21 -21
- package/dist/capabilities/kenari.json +120 -135
- package/dist/capabilities/kilo.json +671 -630
- package/dist/capabilities/kimchi.json +16 -16
- package/dist/capabilities/kimi-code-plan-cn.json +7 -7
- package/dist/capabilities/kimi-code-plan-global.json +7 -7
- package/dist/capabilities/kitani.json +2 -2
- package/dist/capabilities/klavo.json +25 -25
- package/dist/capabilities/korouter.json +31 -31
- package/dist/capabilities/kunavo.json +9 -9
- package/dist/capabilities/liquid.json +10 -10
- package/dist/capabilities/lithosai.json +2 -2
- package/dist/capabilities/llmgateway-providers.json +944 -906
- package/dist/capabilities/llmgateway.json +359 -348
- package/dist/capabilities/llmtr.json +25 -25
- package/dist/capabilities/logits.json +2 -2
- package/dist/capabilities/longcat.json +2 -2
- package/dist/capabilities/lowrouter.json +64 -64
- package/dist/capabilities/lyceum.json +14 -14
- package/dist/capabilities/melious.json +10 -10
- package/dist/capabilities/merge-gateway.json +268 -260
- 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 +23 -15
- package/dist/capabilities/mixlayer.json +5 -5
- package/dist/capabilities/modal.json +11 -11
- package/dist/capabilities/model-oracle-ai.json +22 -22
- package/dist/capabilities/modelis.json +21 -21
- package/dist/capabilities/modelscope.json +2 -2
- package/dist/capabilities/modular.json +15 -15
- package/dist/capabilities/moneo.json +7 -7
- package/dist/capabilities/moonshotai-cn.json +6 -6
- package/dist/capabilities/moonshotai.json +6 -6
- package/dist/capabilities/morph.json +19 -19
- package/dist/capabilities/munito-eu.json +4 -4
- package/dist/capabilities/munito.json +5 -5
- package/dist/capabilities/nan.json +21 -21
- package/dist/capabilities/nano-gpt.json +594 -598
- package/dist/capabilities/nearai.json +121 -121
- package/dist/capabilities/nebius.json +42 -34
- package/dist/capabilities/neon.json +125 -125
- package/dist/capabilities/neuralwatt.json +41 -41
- package/dist/capabilities/nokeep.json +4 -4
- package/dist/capabilities/novita-ai.json +136 -136
- package/dist/capabilities/nvidia.json +29 -29
- package/dist/capabilities/oathbreaker.json +4 -4
- package/dist/capabilities/obscurify.json +24 -24
- package/dist/capabilities/oci.json +7 -7
- package/dist/capabilities/ofox.json +251 -251
- package/dist/capabilities/ollama-cloud.json +57 -57
- package/dist/capabilities/openai.json +56 -59
- package/dist/capabilities/opencode-go.json +93 -84
- package/dist/capabilities/openreason.json +5 -5
- package/dist/capabilities/openrouter.json +534 -532
- package/dist/capabilities/opper.json +31 -31
- package/dist/capabilities/orcarouter.json +292 -276
- package/dist/capabilities/outerlabs.json +32 -32
- package/dist/capabilities/ovhcloud.json +23 -23
- package/dist/capabilities/perplexity-agent.json +64 -64
- package/dist/capabilities/phala.json +31 -31
- package/dist/capabilities/poe.json +139 -139
- package/dist/capabilities/poolside.json +2 -2
- package/dist/capabilities/powerspring.json +8 -8
- package/dist/capabilities/primalabs.json +8 -8
- package/dist/capabilities/prime.json +133 -125
- package/dist/capabilities/privatemode-ai.json +4 -4
- package/dist/capabilities/proxystacks.json +3 -3
- package/dist/capabilities/qiniu-ai.json +14 -14
- package/dist/capabilities/refuseless.json +6 -6
- package/dist/capabilities/regolo-ai.json +8 -8
- package/dist/capabilities/requesty.json +201 -201
- package/dist/capabilities/ruapi.json +24 -24
- package/dist/capabilities/runcrate.json +8 -8
- package/dist/capabilities/runinfra.json +13 -13
- package/dist/capabilities/sakana.json +2 -2
- package/dist/capabilities/sandbase.json +23 -23
- package/dist/capabilities/sarvam.json +11 -11
- package/dist/capabilities/scaleway.json +15 -15
- package/dist/capabilities/scnet-token-plan.json +13 -13
- package/dist/capabilities/scx-ai.json +23 -23
- package/dist/capabilities/sensenova.json +13 -13
- package/dist/capabilities/siliconflow-cn.json +46 -46
- package/dist/capabilities/siliconflow.json +57 -57
- package/dist/capabilities/snowflake-cortex.json +21 -21
- package/dist/capabilities/sokkan.json +6 -6
- package/dist/capabilities/sparrowcodes.json +19 -19
- package/dist/capabilities/standardcompute.json +69 -69
- package/dist/capabilities/steadyrouter.json +40 -40
- package/dist/capabilities/stepfun-ai-step-plan.json +6 -6
- package/dist/capabilities/stepfun-ai.json +6 -6
- package/dist/capabilities/stepfun-step-plan.json +6 -6
- package/dist/capabilities/stepfun.json +6 -6
- package/dist/capabilities/stepping-stone.json +21 -21
- package/dist/capabilities/superbot-gg.json +4 -4
- package/dist/capabilities/synthetic.json +10 -10
- package/dist/capabilities/synthorai.json +24 -24
- package/dist/capabilities/teamorouter.json +14 -14
- package/dist/capabilities/teapot-router.json +4 -4
- package/dist/capabilities/tencent-token-plan-intl.json +16 -16
- package/dist/capabilities/tencent-token-plan.json +35 -35
- package/dist/capabilities/tencent-tokenhub.json +44 -44
- package/dist/capabilities/tensorx.json +49 -49
- package/dist/capabilities/the-grid-ai.json +28 -28
- package/dist/capabilities/thinkingmachines.json +76 -76
- package/dist/capabilities/tinfoil.json +9 -9
- package/dist/capabilities/togetherai.json +55 -55
- package/dist/capabilities/tokengo.json +24 -24
- package/dist/capabilities/tokenharbor.json +214 -214
- package/dist/capabilities/tokenify.json +8 -8
- package/dist/capabilities/trustedrouter.json +6 -6
- package/dist/capabilities/trustedtokens.json +19 -19
- package/dist/capabilities/umans-ai-coding-plan.json +11 -11
- package/dist/capabilities/umans-ai.json +11 -11
- package/dist/capabilities/uncensuredai.json +5 -5
- package/dist/capabilities/unrestricted.json +6 -6
- package/dist/capabilities/uplinkswitch.json +18 -18
- package/dist/capabilities/upstage.json +2 -2
- package/dist/capabilities/vancine.json +12 -12
- package/dist/capabilities/vercel.json +562 -549
- package/dist/capabilities/verda.json +4 -4
- package/dist/capabilities/vivgrid.json +62 -62
- package/dist/capabilities/volcengine-coding-plan.json +24 -24
- package/dist/capabilities/volcengine.json +31 -31
- package/dist/capabilities/vultr.json +18 -18
- package/dist/capabilities/wafer.ai.json +18 -18
- package/dist/capabilities/wallaby.json +5 -5
- package/dist/capabilities/wally.json +9 -9
- package/dist/capabilities/wandb.json +20 -20
- package/dist/capabilities/watt.json +20 -20
- 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 +3 -3
- package/dist/capabilities/xpersona.json +13 -13
- package/dist/capabilities/xxapi.json +27 -27
- package/dist/capabilities/zai-coding-plan.json +15 -15
- package/dist/capabilities/zai.json +29 -29
- package/dist/capabilities/zenifra.json +22 -22
- package/dist/capabilities/zenmux.json +185 -185
- package/dist/capabilities/zerogpu.json +14 -14
- package/dist/capabilities/zhipuai-coding-plan.json +3 -3
- package/dist/capabilities/zhipuai.json +27 -27
- package/dist/capabilities/zro.json +4 -4
- package/dist/channels/index.cjs +2 -2
- package/dist/channels/index.js +2 -2
- package/dist/{channels-DChC1kXm.js → channels-Cxy4jW11.js} +1 -1
- package/dist/{channels-BamLzaJG.cjs → channels-DNOI029U.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 +1158 -1153
- package/dist/docs/references/docs-agents-human-in-the-loop.md +1 -1
- package/dist/docs/references/docs-agents-resumable-streams.md +3 -3
- package/dist/docs/references/docs-channels.md +50 -3
- package/dist/docs/references/docs-deployment-workers.md +10 -4
- 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-harness-durable-agents.md +17 -15
- 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-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-server-mcp.md +68 -0
- package/dist/docs/references/docs-server-pubsub.md +25 -16
- package/dist/docs/references/docs-signals-running-across-processes.md +9 -3
- package/dist/docs/references/docs-signals-sending-signals.md +1 -1
- package/dist/docs/references/docs-workflows-control-flow.md +20 -0
- package/dist/docs/references/docs-workflows-overview.md +3 -3
- 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-agents-agent.md +3 -1
- package/dist/docs/references/reference-agents-durable-agent.md +3 -3
- package/dist/docs/references/reference-configuration.md +60 -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-pubsub-base.md +1 -1
- package/dist/docs/references/reference-pubsub-caching-pubsub.md +1 -1
- package/dist/docs/references/reference-pubsub-google-cloud-pubsub.md +13 -7
- package/dist/docs/references/reference-pubsub-lease-provider.md +4 -0
- package/dist/docs/references/reference-pubsub-redis-streams.md +18 -9
- package/dist/docs/references/reference-pubsub-valkey-streams.md +25 -7
- 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/events/caching-pubsub.d.ts +3 -11
- package/dist/events/index.cjs +1 -1
- package/dist/events/index.js +1 -1
- package/dist/events/pubsub.d.ts +2 -1
- package/dist/{execution-fence-BBKnrhWR.cjs → execution-fence-C1nozqra.cjs} +1118 -309
- package/dist/{execution-fence--VdnD7p4.js → execution-fence-pJB0qqFJ.js} +1107 -310
- 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/provider-types.generated.d.ts +7574 -7544
- package/dist/llm/reasoning/account-switch.d.ts +50 -0
- package/dist/llm/reasoning/index.cjs +65 -0
- package/dist/llm/reasoning/index.d.ts +1 -0
- package/dist/llm/reasoning/index.js +61 -1
- package/dist/{llm-DknPJDW6.cjs → llm-VhPqyULU.cjs} +2 -2
- package/dist/{llm-ccA_1Q-H.js → llm-_z1lIfCN.js} +2 -2
- package/dist/loop/index.cjs +2 -2
- package/dist/loop/index.js +2 -2
- package/dist/loop/suspended-run-auto-resume.d.ts +15 -0
- 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/agentic-execution/tool-call-step.d.ts +1 -1
- package/dist/loop/workflows/schema.d.ts +13 -0
- package/dist/{manager-D9F0i7O2.cjs → manager-BT70SgFz.cjs} +3 -3
- package/dist/{manager-DWX6-Cx4.js → manager-C3Kx39p_.js} +3 -3
- package/dist/mastra/index.cjs +1 -1
- package/dist/mastra/index.d.ts +35 -11
- package/dist/mastra/index.js +1 -1
- package/dist/{mastra-BzWL4xI8.cjs → mastra-CQGD2RoN.cjs} +108 -20
- package/dist/{mastra-oUDN81l8.js → mastra-fJ0iKYGP.js} +108 -20
- package/dist/memory/index.cjs +2 -2
- package/dist/memory/index.js +2 -2
- package/dist/{model-BnD7SPlA.cjs → model-D9NDbf-e.cjs} +1 -1
- package/dist/{model-BwxfS6T_.js → model-DmBDBf-q.js} +1 -1
- package/dist/{netlify-CS0VDbb9.cjs → netlify-DNaNhels.cjs} +1 -1
- package/dist/{netlify-DcY9gHCJ.js → netlify-_yV5Nwud.js} +1 -1
- package/dist/notifications/index.cjs +1 -1
- package/dist/notifications/index.js +1 -1
- package/dist/{output-helpers-k2-48ssH.js → output-helpers-D-qplq22.js} +13 -15
- package/dist/{output-helpers-By5FbLpp.cjs → output-helpers-D4O_oFne.cjs} +12 -14
- 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-BvbEoScB.js → provider-registry-C4tv__fr.js} +22203 -21980
- package/dist/{provider-registry-OggbU6OE.cjs → provider-registry-_BUQuSKb.cjs} +21869 -21628
- package/dist/provider-registry.json +22243 -22188
- package/dist/{registry-generator-BFOQQHyt.js → registry-generator-CenhQnEi.js} +1 -1
- package/dist/{registry-generator-CDaf48a6.cjs → registry-generator-D7lsLJC-.cjs} +1 -1
- package/dist/{rehydrate-CFoKaNlm.js → rehydrate-CuWN_5No.js} +2 -2
- package/dist/{rehydrate-QeS0NjGw.cjs → rehydrate-SpC_gJCY.cjs} +2 -2
- package/dist/relevance/index.cjs +2 -2
- package/dist/relevance/index.js +2 -2
- package/dist/{scheduler-0ShtMM1I.js → scheduler-D1qdie5k.js} +4 -2
- package/dist/{scheduler-CMjK0LoQ.cjs → scheduler-DE5lcHJA.cjs} +4 -2
- package/dist/server/index.d.ts +1 -1
- package/dist/server/types.d.ts +57 -0
- 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/memory/base.d.ts +6 -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-D2rv1Ut1.js → stream-BfSwqzPi.js} +1 -1
- package/dist/{stream-CNqAlDJF.cjs → stream-CW3d1Xg6.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-CFsOjueT.js → tool-loop-agent-B4_o4-Me.js} +3 -3
- package/dist/{tool-loop-agent-Dusqj7-j.cjs → tool-loop-agent-JN_oKyfY.cjs} +3 -3
- package/dist/{utils-CIuOHPoS.cjs → utils-Bq606mC8.cjs} +1 -1
- package/dist/{utils-DLnCt6E9.js → utils-CnpMuTyD.js} +1 -1
- package/dist/utils.cjs +1 -1
- package/dist/utils.js +1 -1
- package/dist/{validate-1zReLtWc.cjs → validate-CFv6HWXx.cjs} +1 -1
- package/dist/{validate-ShLcQTA5.js → validate-Db2C7Sj_.js} +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.d.ts +1 -1
- package/dist/worker/index.js +1 -1
- package/dist/worker/workers/orchestration-worker.d.ts +13 -0
- package/dist/{worker-BPNrwCFs.cjs → worker-CNIBQPQy.cjs} +117 -32
- package/dist/{worker-CQ8rTJwQ.cjs → worker-IZeSOZjg.cjs} +2 -2
- package/dist/{worker-CKcQcPl8.js → worker-UXFAgWOK.js} +2 -2
- package/dist/{worker-ngt-F1Iv.js → worker-X0fAJfcx.js} +117 -32
- package/dist/{workflow-B_e5wMmz.cjs → workflow-CMLLlVDc.cjs} +4 -4
- package/dist/{workflow-XDIVRsu4.js → workflow-DfXq2p2f.js} +4 -4
- 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/evented/setup-warning.d.ts +20 -0
- package/dist/workflows/index.cjs +5 -5
- package/dist/workflows/index.js +5 -5
- package/dist/workflows/scheduler/types.d.ts +3 -0
- package/package.json +8 -8
- package/src/llm/model/provider-types.generated.d.ts +7574 -7544
|
@@ -408,6 +408,74 @@ claude mcp add --transport http mastra https://my-app.example.com/api/mcp \
|
|
|
408
408
|
|
|
409
409
|
The endpoint doesn't return `403` with `error="insufficient_scope"` yet. A caller without `mcp:read` gets a plain `403`, because Mastra permissions aren't OAuth scopes a client could request.
|
|
410
410
|
|
|
411
|
+
## Server card
|
|
412
|
+
|
|
413
|
+
The endpoint publishes an experimental [MCP Server Card](https://github.com/modelcontextprotocol/experimental-ext-server-card) at `/api/mcp/server-card`. MCP clients and registries read it before connecting to learn the server's name, version, endpoint URL, and supported protocol versions. It never lists tools, resources, or anything about a user.
|
|
414
|
+
|
|
415
|
+
The card is public, even when `server.auth` is configured, and any origin can read it. It's served whenever the endpoint is, and it follows `server.mcp.path`:
|
|
416
|
+
|
|
417
|
+
```bash
|
|
418
|
+
curl https://my-app.example.com/api/mcp/server-card
|
|
419
|
+
```
|
|
420
|
+
|
|
421
|
+
```json
|
|
422
|
+
{
|
|
423
|
+
"$schema": "https://static.modelcontextprotocol.io/schemas/v1/server-card.schema.json",
|
|
424
|
+
"name": "com.example.my-app/mastra",
|
|
425
|
+
"version": "1.0.0",
|
|
426
|
+
"description": "Mastra server exposing agents, workflows, and tools over MCP",
|
|
427
|
+
"title": "Mastra",
|
|
428
|
+
"remotes": [
|
|
429
|
+
{
|
|
430
|
+
"type": "streamable-http",
|
|
431
|
+
"url": "https://my-app.example.com/api/mcp",
|
|
432
|
+
"supportedProtocolVersions": [
|
|
433
|
+
"2026-07-28",
|
|
434
|
+
"2025-11-25",
|
|
435
|
+
"2025-06-18",
|
|
436
|
+
"2025-03-26",
|
|
437
|
+
"2024-11-05",
|
|
438
|
+
"2024-10-07"
|
|
439
|
+
]
|
|
440
|
+
}
|
|
441
|
+
]
|
|
442
|
+
}
|
|
443
|
+
```
|
|
444
|
+
|
|
445
|
+
The name, title, and version come from `server.mcp.serverInfo`, and the URL from the request. Behind a proxy, set `server.mcp.card.url`, or `server.mcp.oauth.resource`, to the public URL. A card with a set URL can also be stored by shared caches. Set `server.mcp.card` to change other fields, or to `false` to stop serving it:
|
|
446
|
+
|
|
447
|
+
```typescript
|
|
448
|
+
import { Mastra } from '@mastra/core'
|
|
449
|
+
|
|
450
|
+
export const mastra = new Mastra({
|
|
451
|
+
server: {
|
|
452
|
+
mcp: {
|
|
453
|
+
card: {
|
|
454
|
+
name: 'com.example/assistant',
|
|
455
|
+
url: 'https://my-app.example.com/api/mcp',
|
|
456
|
+
},
|
|
457
|
+
},
|
|
458
|
+
},
|
|
459
|
+
})
|
|
460
|
+
```
|
|
461
|
+
|
|
462
|
+
To publish a card for your own [`MCPServer`](https://mastra.ai/reference/tools/mcp-server), set its `serverCard` option.
|
|
463
|
+
|
|
464
|
+
An invalid `name`, `title`, `description`, `url`, or `websiteUrl` in `server.mcp.card`, such as a `name` without a slash, stops the server at startup with an error naming the field.
|
|
465
|
+
|
|
466
|
+
### CORS with a server adapter
|
|
467
|
+
|
|
468
|
+
`mastra dev` and `mastra build` send the card's CORS headers whatever `server.cors` is set to. When you mount Mastra in your own app with a [server adapter](https://mastra.ai/docs/server/server-adapters), your app's CORS middleware runs first. A plain cross-origin `GET` still gets `Access-Control-Allow-Origin: *`, but a browser that sends `If-None-Match` from a script first sends a preflight request, and your middleware answers it with its own origin rules. Skip your CORS middleware for the card path so the card answers the preflight itself:
|
|
469
|
+
|
|
470
|
+
```typescript
|
|
471
|
+
import cors from 'cors'
|
|
472
|
+
|
|
473
|
+
const appCors = cors({ origin: 'https://app.example.com' })
|
|
474
|
+
app.use((req, res, next) =>
|
|
475
|
+
req.path === '/api/mcp/server-card' ? next() : appCors(req, res, next),
|
|
476
|
+
)
|
|
477
|
+
```
|
|
478
|
+
|
|
411
479
|
## Limitations
|
|
412
480
|
|
|
413
481
|
- Workflows run synchronously within the MCP request. Long-running workflows are bounded by your server's request timeout.
|
|
@@ -16,7 +16,7 @@ Several built-in systems publish and subscribe to events through the same pub/su
|
|
|
16
16
|
- **Scheduled workflows**: The scheduler dispatches due runs by publishing to the workflow topic. See [Scheduled workflows](https://mastra.ai/docs/workflows/scheduled-workflows).
|
|
17
17
|
- **Background tasks**: A task manager dispatches work to a worker group and fans task lifecycle updates out to subscribers, which is how background task streams stay live. See [Background task streaming](https://mastra.ai/docs/harness/background-tasks).
|
|
18
18
|
- **Agent signals**: Sending a signal to an active agent run publishes an event on a thread topic. The event reaches the process that holds the run. A step of an evented run that executes in a different process gets the signal only through [storage that shares pending signals across processes](#signals-sent-to-a-running-evented-agent).
|
|
19
|
-
- **Resumable streams**: Stream chunks are published per run, so a client that reconnects can replay what it missed.
|
|
19
|
+
- **Resumable streams**: Stream chunks are published per run and recorded in the server cache, so a client that reconnects can replay what it missed.
|
|
20
20
|
|
|
21
21
|
Because these systems run on one bus, the backend you choose applies to all of them at once.
|
|
22
22
|
|
|
@@ -75,44 +75,49 @@ Use a distributed backend when you run more than one instance or host, and every
|
|
|
75
75
|
|
|
76
76
|
For example, sending a signal to an agent run requires the signal event to cross the process boundary to the instance that owns the run. With the in-process default, that instance never receives the event.
|
|
77
77
|
|
|
78
|
+
Configure a server cache (`cache`) that every instance shares in the same step. Each agent run keeps its ownership record and its numbered event log in that cache. With the default `InMemoryServerCache`, each instance has its own: the observe and abort routes only find a run on the instance that started it, and an [evented agent](#evented-workflows-and-agents) step that runs on another instance publishes events that a reconnecting client can't skip by offset.
|
|
79
|
+
|
|
78
80
|
[Durable agent](https://mastra.ai/docs/harness/durable-agents) crash recovery also depends on the backend when the storage adapter doesn't support run fencing. Recovery then uses the backend's leases to tell whether another instance still drives a run. `RedisStreamsPubSub` provides leases across hosts. `GoogleCloudPubSub` doesn't.
|
|
79
81
|
|
|
80
82
|
Both backends below deliver across processes and hosts and persist events for redelivery.
|
|
81
83
|
|
|
82
|
-
The following example uses [Redis Streams](https://redis.io/docs/latest/develop/data-types/streams/):
|
|
84
|
+
The following example uses [Redis Streams](https://redis.io/docs/latest/develop/data-types/streams/), with `RedisServerCache` from `@mastra/redis` on the same Redis:
|
|
83
85
|
|
|
84
86
|
```typescript
|
|
85
87
|
import { Mastra } from '@mastra/core'
|
|
88
|
+
import { RedisServerCache } from '@mastra/redis'
|
|
86
89
|
import { RedisStreamsPubSub } from '@mastra/redis-streams'
|
|
90
|
+
import { Redis } from 'ioredis'
|
|
87
91
|
|
|
88
92
|
export const mastra = new Mastra({
|
|
89
|
-
pubsub: new RedisStreamsPubSub({
|
|
90
|
-
|
|
91
|
-
}),
|
|
93
|
+
pubsub: new RedisStreamsPubSub({ url: process.env.REDIS_URL! }),
|
|
94
|
+
cache: new RedisServerCache({ client: new Redis(process.env.REDIS_URL!) }),
|
|
92
95
|
})
|
|
93
96
|
```
|
|
94
97
|
|
|
95
|
-
The following example uses [Google Cloud Pub/Sub](https://cloud.google.com/pubsub/docs):
|
|
98
|
+
The following example uses [Google Cloud Pub/Sub](https://cloud.google.com/pubsub/docs). Google Cloud Pub/Sub has no matching server cache, so use any cache that every process shares: `RedisServerCache` from `@mastra/redis` as below, `ValkeyServerCache` from `@mastra/valkey`, or `ConvexServerCache` from `@mastra/convex`.
|
|
96
99
|
|
|
97
100
|
```typescript
|
|
98
101
|
import { Mastra } from '@mastra/core'
|
|
99
102
|
import { GoogleCloudPubSub } from '@mastra/google-cloud-pubsub'
|
|
103
|
+
import { RedisServerCache } from '@mastra/redis'
|
|
104
|
+
import { Redis } from 'ioredis'
|
|
100
105
|
|
|
101
106
|
export const mastra = new Mastra({
|
|
102
|
-
pubsub: new GoogleCloudPubSub({
|
|
103
|
-
|
|
104
|
-
}),
|
|
107
|
+
pubsub: new GoogleCloudPubSub({ projectId: 'my-project' }),
|
|
108
|
+
cache: new RedisServerCache({ client: new Redis(process.env.REDIS_URL!) }),
|
|
105
109
|
})
|
|
106
110
|
```
|
|
107
111
|
|
|
108
112
|
## Evented workflows and agents
|
|
109
113
|
|
|
110
|
-
Workflows on the [evented execution engine](https://mastra.ai/docs/workflows/scheduled-workflows) and agents using [evented durable execution](https://mastra.ai/docs/harness/durable-agents) advance a run one event at a time. Any worker can take the next event, which lets several processes share one run. That only holds when the deployment has
|
|
114
|
+
Workflows on the [evented execution engine](https://mastra.ai/docs/workflows/scheduled-workflows) and agents using [evented durable execution](https://mastra.ai/docs/harness/durable-agents) advance a run one event at a time. Any worker can take the next event, which lets several processes share one run. That only holds when the deployment has the following:
|
|
111
115
|
|
|
112
116
|
- **A PubSub backend that redelivers unacknowledged events**: When a worker stops in the middle of a step, the backend gives the step's event to another worker.
|
|
113
117
|
- **A storage adapter with workflow step guards**: The backend can deliver the same event more than once, and the step guard keeps a later delivery from saving the step's result a second time. A step can still run more than once, so [make steps with side effects idempotent](https://mastra.ai/docs/workflows/overview).
|
|
118
|
+
- **For evented agents, a server cache that every process shares**: Each step appends its stream events to the run's log in the cache, which numbers them. With the default `InMemoryServerCache`, a step on another process publishes its events without a number, so a client that reconnects with an offset receives most of the run again.
|
|
114
119
|
|
|
115
|
-
The backends that redeliver are marked **Yes** in the [Choosing a backend](#choosing-a-backend) table. A backend's reference page says whether redelivery can be turned off. The storage adapters with workflow step guards are `@mastra/pg` and `@mastra/libsql`. With `@mastra/libsql`, see [evented agent worker takeover](https://mastra.ai/reference/pubsub/redis-streams) for the database setups that work across machines.
|
|
120
|
+
The backends that redeliver are marked **Yes** in the [Choosing a backend](#choosing-a-backend) table. A backend's reference page says whether redelivery can be turned off. The storage adapters with workflow step guards are `@mastra/pg` and `@mastra/libsql`. With `@mastra/libsql`, see [evented agent worker takeover](https://mastra.ai/reference/pubsub/redis-streams) for the database setups that work across machines. Set the cache as in the [distributed deployment examples](#distributed-deployments).
|
|
116
121
|
|
|
117
122
|
[`EventEmitterPubSub`](https://mastra.ai/reference/pubsub/event-emitter) and [`UnixSocketPubSub`](https://mastra.ai/reference/pubsub/unix-socket-pubsub) don't redeliver an event that a stopped process received and never acknowledged. On the default `EventEmitterPubSub`, evented workflows and agents run in one process, which is how you try the evented engine locally and run it in tests. Don't use either backend to run evented workflows or agents on several processes:
|
|
118
123
|
|
|
@@ -132,19 +137,23 @@ Messages and other signals sent to an evented agent's active run wait until a mo
|
|
|
132
137
|
| `@mastra/libsql` | Yes | [Depends on the connection](https://mastra.ai/integrations/databases/libsql) |
|
|
133
138
|
| `InMemoryStore` | Yes | No |
|
|
134
139
|
|
|
135
|
-
A run keeps its signals in storage when the agent's memory uses storage that keeps pending signals and the run is the thread's active run, with a thread and a `resourceId`. A run started with `prepare()` and a run with `readOnly` memory aren't the thread's active run. Any other evented run keeps its signals in the memory of the process that started it, and they reach the run only when that process executes the run's next step. Otherwise the agent answers them in a new turn after the run ends. Input from `queueMessage()` and `queueSignal()`
|
|
140
|
+
A run keeps its signals in storage when the agent's memory uses storage that keeps pending signals and the run is the thread's active run, with a thread and a `resourceId`. A run started with `prepare()` and a run with `readOnly` memory aren't the thread's active run. Any other evented run keeps its signals in the memory of the process that started it, and they reach the run only when that process executes the run's next step. Otherwise the agent answers them in a new turn after the run ends. Input from `queueMessage()` and `queueSignal()` waits in the memory of the process that queued it, and is lost if that process stops. When that process finds the thread held by another process's run instead of starting the turn itself, it passes the input to that process. If that run keeps its signals in storage, the passed input is stored as a row that waits for the run to end, and all rows the run releases start the thread's next turn together.
|
|
136
141
|
|
|
137
142
|
A stored signal that the run never takes waits for the thread's next run. The process that started the run starts that next run with the signal when the run ends, if that process is still up. When another run already holds the thread and reads the same storage, that run takes the signal at its next model request, or, if it already made its last one, the signal starts the thread's next turn when that run ends. Otherwise the signal waits for the thread's next run that reads the same storage. A run that fails deletes the signals its failed turn took, whether it fails in the process that started it or on a worker, and the thread's next run receives only the ones it never took. A failure that carries no saved progress is the exception, such as a step that runs out of deliveries with `storageVersion: 2`: the run then puts back the signals it took and never saved, and the thread's next run receives them again. When a run's `modelSettings.timeout.totalMs` deadline fires in the process that started it while another process executes its steps, the starting process saves only the turn's input, and the signals the interrupted step took and never saved go back to pending, so the thread's next run receives them again, also when the run saved earlier progress. A suspended run stops receiving signals once another run uses its thread, and signals sent to it afterwards wait for the thread's next run or are answered `blocked`, as [`sendSignal()`](https://mastra.ai/reference/agents/agent) describes. A signal taken by a step that crashes before the run saves its progress is taken again by the thread's next run if the crashed run never recovers or ends.
|
|
138
143
|
|
|
139
144
|
### Warning for unsupported setups
|
|
140
145
|
|
|
141
|
-
Mastra logs a warning
|
|
146
|
+
Mastra logs a warning when a setup can't support several processes:
|
|
142
147
|
|
|
143
148
|
- The PubSub backend delivers to other processes and doesn't redeliver unacknowledged events.
|
|
144
149
|
- The PubSub backend redelivers unacknowledged events and the storage adapter has no workflow step guards.
|
|
150
|
+
- The PubSub backend delivers to other processes, an evented agent is registered, and the server cache is `InMemoryServerCache`.
|
|
145
151
|
- The PubSub backend delivers to other processes and an evented agent's active run keeps its signals in one process.
|
|
146
152
|
|
|
147
|
-
|
|
153
|
+
The first two cases share one warning, logged the first time an evented run is created. The others are separate warnings:
|
|
154
|
+
|
|
155
|
+
- The server cache warning begins with `Evented agents aren't supported on several processes with this setup` and names the in-memory cache: `cache` on `Mastra`, or the cache of a `CachingPubSub` you configured as `pubsub`. Each process that can run an evented agent's steps logs it at startup, including dedicated workers. Mastra treats any other cache class as shared.
|
|
156
|
+
- The signals warning begins with `Signals sent to running evented agents aren't supported on several processes with this setup`, logged the first time such a run starts. It names the cause: the run has no memory, thread, or `resourceId`, the agent's memory storage doesn't keep pending signals, or that storage keeps them in one process.
|
|
148
157
|
|
|
149
158
|
The default `EventEmitterPubSub` doesn't trigger the warning, because its events never leave the process. `UnixSocketPubSub` triggers it even when one process uses the socket, because Mastra can't tell how many processes share it.
|
|
150
159
|
|
|
@@ -169,9 +178,9 @@ To disable the warning for a setup that one process uses, set the `MASTRA_DISABL
|
|
|
169
178
|
|
|
170
179
|
## Resumable streams
|
|
171
180
|
|
|
172
|
-
Resumable streams let a client reconnect and replay events it missed,
|
|
181
|
+
[Resumable streams](https://mastra.ai/docs/agents/resumable-streams) let a client reconnect and replay events it missed. Mastra records each agent run's events in the server cache before publishing them and numbers them, so a client can replay a run from the start or from an offset. Replay reaches across processes only when they share the cache, as in the [distributed deployment examples](#distributed-deployments). [`RedisStreamsPubSub`](https://mastra.ai/reference/pubsub/redis-streams) also retains events and replays a topic to a new subscriber, but only from the start.
|
|
173
182
|
|
|
174
|
-
|
|
183
|
+
To record other topics too, wrap the backend in [`CachingPubSub`](https://mastra.ai/reference/pubsub/caching-pubsub). It records events per topic, except those Mastra publishes for the local process only, such as per-run workflow watch events, so a late or reconnecting subscriber can catch up before continuing with live events.
|
|
175
184
|
|
|
176
185
|
```typescript
|
|
177
186
|
import { Mastra } from '@mastra/core'
|
|
@@ -105,12 +105,14 @@ Signal providers have their own lifecycle. Call [`provider.stop()`](https://mast
|
|
|
105
105
|
|
|
106
106
|
## Configuration
|
|
107
107
|
|
|
108
|
-
A shared Redis Streams backend handles both signal delivery and thread leases:
|
|
108
|
+
A shared Redis Streams backend handles both signal delivery and thread leases, and a Redis server cache goes with it:
|
|
109
109
|
|
|
110
110
|
```typescript
|
|
111
111
|
import { Mastra } from '@mastra/core'
|
|
112
112
|
import { PostgresStore } from '@mastra/pg'
|
|
113
|
+
import { RedisServerCache } from '@mastra/redis'
|
|
113
114
|
import { RedisStreamsPubSub } from '@mastra/redis-streams'
|
|
115
|
+
import { Redis } from 'ioredis'
|
|
114
116
|
|
|
115
117
|
export const mastra = new Mastra({
|
|
116
118
|
agents: { agent },
|
|
@@ -122,12 +124,16 @@ export const mastra = new Mastra({
|
|
|
122
124
|
url: process.env.REDIS_URL,
|
|
123
125
|
keyPrefix: 'mastra:my-app',
|
|
124
126
|
}),
|
|
127
|
+
cache: new RedisServerCache(
|
|
128
|
+
{ client: new Redis(process.env.REDIS_URL!) },
|
|
129
|
+
{ keyPrefix: 'mastra:my-app:cache:' },
|
|
130
|
+
),
|
|
125
131
|
})
|
|
126
132
|
```
|
|
127
133
|
|
|
128
|
-
Every instance points `storage` at the same database, so persisted signals, state signals, and notification records survive a restart and are visible to whichever process owns the thread.
|
|
134
|
+
Every instance points `storage` at the same database, so persisted signals, state signals, and notification records survive a restart and are visible to whichever process owns the thread. The shared `cache` holds each run's stream events and ownership record, so a client can observe a run and reconnect to it through any instance.
|
|
129
135
|
|
|
130
|
-
Use the same `keyPrefix` on every coordinating instance, and
|
|
136
|
+
Use the same `keyPrefix` values on every coordinating instance, and give environments sharing one Redis server their own prefix on both the pubsub and the cache. Vercel's managed Redis and Upstash Redis both work with `RedisStreamsPubSub`.
|
|
131
137
|
|
|
132
138
|
The lease settings are environment variables:
|
|
133
139
|
|
|
@@ -67,7 +67,7 @@ const result = agent.queueMessage('Also check whether the tests need updates.',
|
|
|
67
67
|
await result.accepted
|
|
68
68
|
```
|
|
69
69
|
|
|
70
|
-
Queued input waits for the active run to finish, then starts a new run. On an idle thread it starts immediately. [`cancelQueuedMessages()`](https://mastra.ai/reference/agents/agent) removes input that no run has taken yet, without stopping the active run. Its awaited result lists the IDs this process cancelled, including ones it deleted from memory storage when it knows the thread's store: this process started the thread's current run and that run hasn't ended, or the agent's memory is a fixed instance and this process knows the thread's run keeps its signals in storage. Other processes cancel matching input when they get the request, and those IDs aren't in the result. Input a run already took stays delivered.
|
|
70
|
+
Queued input waits for the active run to finish, then starts a new run. On an idle thread it starts immediately. A run paused on a tool's `suspend()` with `autoResumeSuspendedTools` enabled counts as finished. Queued input starts the next run, which [resumes the tool](https://mastra.ai/docs/agents/human-in-the-loop). Input passed to another process because that process holds the thread's run is the exception when that run [keeps its signals in storage](https://mastra.ai/docs/server/pubsub): it's stored, and all input passed to that run starts one new run together. [`cancelQueuedMessages()`](https://mastra.ai/reference/agents/agent) removes input that no run has taken yet, without stopping the active run. Its awaited result lists the IDs this process cancelled, including ones it deleted from memory storage when it knows the thread's store: this process started the thread's current run and that run hasn't ended, or the agent's memory is a fixed instance and this process knows the thread's run keeps its signals in storage. Other processes cancel matching input when they get the request, and those IDs aren't in the result. Input a run already took stays delivered.
|
|
71
71
|
|
|
72
72
|
[`queueSignal()`](https://mastra.ai/reference/agents/agent) queues typed context with the same behavior but keeps the signal's `type`, `tagName`, and attributes.
|
|
73
73
|
|
|
@@ -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
|
}),
|
|
@@ -127,7 +127,7 @@ export const testWorkflow = createWorkflow({
|
|
|
127
127
|
message: z.string()
|
|
128
128
|
}),
|
|
129
129
|
outputSchema: z.object({
|
|
130
|
-
|
|
130
|
+
formatted: z.string()
|
|
131
131
|
})
|
|
132
132
|
})
|
|
133
133
|
.then(step1)
|
|
@@ -149,7 +149,7 @@ export const testWorkflow = createWorkflow({
|
|
|
149
149
|
message: v.string()
|
|
150
150
|
})),
|
|
151
151
|
outputSchema: toStandardJsonSchema(v.object({
|
|
152
|
-
|
|
152
|
+
formatted: v.string()
|
|
153
153
|
}))
|
|
154
154
|
})
|
|
155
155
|
.then(step1)
|
|
@@ -170,7 +170,7 @@ export const testWorkflow = createWorkflow({
|
|
|
170
170
|
message: "string"
|
|
171
171
|
}),
|
|
172
172
|
outputSchema: type({
|
|
173
|
-
|
|
173
|
+
formatted: "string"
|
|
174
174
|
})
|
|
175
175
|
})
|
|
176
176
|
.then(step1)
|
|
@@ -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.
|
|
@@ -237,7 +237,9 @@ For an evented agent on [storage that keeps pending signals](https://mastra.ai/d
|
|
|
237
237
|
|
|
238
238
|
### `queueMessage(message, options)`
|
|
239
239
|
|
|
240
|
-
Queues a user message for the next turn on a thread. If the thread is active, Mastra waits for the active run to finish, then starts a new run with the queued message. If the thread is idle, Mastra starts a run immediately.
|
|
240
|
+
Queues a user message for the next turn on a thread. If the thread is active, Mastra waits for the active run to finish, then starts a new run with the queued message. If the thread is idle, Mastra starts a run immediately. Messages passed to another process because it holds the thread's run are stored when that run [keeps its signals in storage](https://mastra.ai/docs/server/pubsub), and start one new run together when that run ends.
|
|
241
|
+
|
|
242
|
+
A run paused on a tool's `suspend()` with `autoResumeSuspendedTools` enabled counts as finished, because it's waiting for the user's next message. The queued message starts the next run, which [resumes the tool](https://mastra.ai/docs/agents/human-in-the-loop). A run paused for a tool approval or without `autoResumeSuspendedTools` keeps the message queued until it finishes.
|
|
241
243
|
|
|
242
244
|
```typescript
|
|
243
245
|
agent.queueMessage('Also check whether the tests need updates.', {
|
|
@@ -111,7 +111,7 @@ Returns: `DurableAgent`
|
|
|
111
111
|
|
|
112
112
|
Wraps an `Agent` with fire-and-forget durable execution on the built-in evented workflow engine. Like `createDurableAgent`, it returns a result you stream from, but the run is started without being awaited: events on the Mastra instance's PubSub drive execution independently of the caller. Register the agent on a `Mastra` instance with storage to get evented execution; without one, the agent falls back to the default in-process engine and logs a warning. It doesn't accept `id` or `name` overrides.
|
|
113
113
|
|
|
114
|
-
An evented agent runs in one process on any PubSub backend. Running its steps on several processes needs a backend that redelivers unacknowledged events
|
|
114
|
+
An evented agent runs in one process on any PubSub backend. Running its steps on several processes needs a backend that redelivers unacknowledged events, a storage adapter with workflow step guards, and a server cache on `Mastra` that every process shares. See [evented workflows and agents](https://mastra.ai/docs/server/pubsub).
|
|
115
115
|
|
|
116
116
|
```typescript
|
|
117
117
|
import { createEventedAgent } from '@mastra/core/agent/durable'
|
|
@@ -125,7 +125,7 @@ Returns: `EventedAgent` (a subclass of `DurableAgent`)
|
|
|
125
125
|
|
|
126
126
|
**agent** (`Agent`): The Agent to wrap with evented durable execution capabilities.
|
|
127
127
|
|
|
128
|
-
**cache** (`MastraServerCache | false`): Cache for stored stream events, which enables resumable streams. If omitted, the agent inherits the cache from the Mastra instance, or uses an InMemoryServerCache. Set to false to disable caching.
|
|
128
|
+
**cache** (`MastraServerCache | false`): Cache for stored stream events, which enables resumable streams. If omitted, the agent inherits the cache from the Mastra instance, or uses an InMemoryServerCache. Once the agent is registered, evented run frames use the Mastra cache instead, because evented steps append there. Set to false to disable caching.
|
|
129
129
|
|
|
130
130
|
**pubsub** (`PubSub`): PubSub instance for streaming events. Once the agent is registered, evented run frames use mastra.pubsub instead, because evented steps publish there. (Default: `mastra.pubsub, or EventEmitterPubSub when unregistered`)
|
|
131
131
|
|
|
@@ -250,7 +250,7 @@ Indexed replay is limited to events still available in the configured cache. The
|
|
|
250
250
|
|
|
251
251
|
A failed cache write loses only that event from the cache. It has no `index`, and the events written before and after it still replay when the cache numbers and appends an event in one step. The in-memory and Valkey caches always do. `RedisServerCache` does while Redis scripting works, and switches to two steps when the client has no `eval` or Redis Cluster rejects the script with `CROSSSLOT`. A custom cache that keeps the default `listPushIndexed()` also takes two steps. A two-step cache can leave a gap that makes offset replay skip later events, so replay such a log without an `offset` and skip indexes already processed. Cache replay can't recover an event the cache never stored. A transport that retains it, such as `RedisStreamsPubSub`, can still deliver it without an `index`.
|
|
252
252
|
|
|
253
|
-
|
|
253
|
+
With a PubSub that reaches other processes, such as Redis Streams, set a server cache that every process shares, such as `RedisServerCache`, on the `Mastra` instance. With the default in-memory cache, a step of an evented agent (`createEventedAgent()`) that runs outside the process that started the run, such as on a dedicated worker, publishes its events without an index, so an offset can't skip them. An observer that reconnects through another process, such as a different server replica, can't replay from the starting process's cache either. Mastra logs a warning at startup when an evented agent runs on this setup. See [evented workflows and agents](https://mastra.ai/docs/server/pubsub).
|
|
254
254
|
|
|
255
255
|
By default `observe()` waits indefinitely for events. If the process running the run dies, the run stops producing events but never emits a completion event, so the observed stream would wait forever. Pass `idleTimeoutMs` to end the stream after a bounded period of silence. Before timing out, `observe()` can consult an optional `isAlive` check. Return `true` while work continues, such as during a long-running tool call or a pause for human input. A `false` result ends the stream with an error, as does omitting `isAlive`. A transient throw from `isAlive` is treated as "still alive", so a momentary check failure never ends a live stream.
|
|
256
256
|
|
|
@@ -746,6 +746,7 @@ Configures the [built-in MCP server](https://mastra.ai/docs/server/mcp) that exp
|
|
|
746
746
|
| `exclude` | `{ agents?: string[]; workflows?: string[]; tools?: string[] }` | `undefined` | Never exposed. Each entry matches a primitive's `id` or its registration key. Takes precedence over `include`. |
|
|
747
747
|
| `serverInfo` | `{ name?: string; version?: string; title?: string; instructions?: string }` | `undefined` | Server identity reported to MCP clients. |
|
|
748
748
|
| `oauth` | `{ resource?: string; requireAudience?: boolean; authorizationServers?: string[]; scopesSupported?: string[] }` | `undefined` | OAuth discovery and token audience settings. See [`server.mcp.oauth`](#servermcpoauth). |
|
|
749
|
+
| `card` | `object \| false` | `{}` | The endpoint's public [MCP Server Card](https://mastra.ai/docs/server/mcp). `false` stops serving it. See [`server.mcp.card`](#servermcpcard). |
|
|
749
750
|
|
|
750
751
|
```typescript
|
|
751
752
|
import { Mastra } from '@mastra/core'
|
|
@@ -791,6 +792,38 @@ export const mastra = new Mastra({
|
|
|
791
792
|
})
|
|
792
793
|
```
|
|
793
794
|
|
|
795
|
+
### `server.mcp.card`
|
|
796
|
+
|
|
797
|
+
**Type:** `object | false`\
|
|
798
|
+
**Default:** `{}`
|
|
799
|
+
|
|
800
|
+
Overrides for the [MCP Server Card](https://mastra.ai/docs/server/mcp) served at `<endpoint>/server-card`. Every field is optional. The card is experimental and its shape may change. Mastra checks `name`, `title`, `description`, `url`, and `websiteUrl` at startup, and an invalid value stops the server with an error naming the field. `repository` and `icons` are published as given.
|
|
801
|
+
|
|
802
|
+
| Property | Type | Default | Description | |
|
|
803
|
+
| ------------- | ----------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | - |
|
|
804
|
+
| `name` | `string` | `serverInfo.name` when it's already a valid card name, otherwise the endpoint host in reverse-DNS order, then `/mastra` | Reverse-DNS name with exactly one `/`, for example `com.example/assistant`. | |
|
|
805
|
+
| `title` | `string` | `serverInfo.title`, then `serverInfo.name`, skipping blank values | Display name, 1 to 100 characters. | |
|
|
806
|
+
| `description` | `string` | `'Mastra server exposing agents, workflows, and tools over MCP'` | 1 to 100 characters. | |
|
|
807
|
+
| `websiteUrl` | `string` | `undefined` | Homepage or documentation URL, as an absolute `http` or `https` URL that's a valid RFC 3986 URI as written. | |
|
|
808
|
+
| `repository` | `{ url: string; source: string; subfolder?: string; id?: string }` | `undefined` | Where the server's source code lives. | |
|
|
809
|
+
| `icons` | `{ src: string; mimeType?: string; sizes?: string[]; theme?: 'light' \| 'dark' }[]` | `undefined` | Icons clients can show for the server. | |
|
|
810
|
+
| `url` | `string` | `oauth.resource`, then the URL the card was requested under | Public URL of the MCP endpoint, as an absolute `http` or `https` URL without credentials. Templates such as `{baseUrl}/mcp` and URLs that aren't valid RFC 3986 URIs, such as ones with an invalid escape like `%zz`, aren't accepted. The card lists the URL in normalized form. Set it behind a proxy so the card names the public URL. | |
|
|
811
|
+
|
|
812
|
+
```typescript
|
|
813
|
+
import { Mastra } from '@mastra/core'
|
|
814
|
+
|
|
815
|
+
export const mastra = new Mastra({
|
|
816
|
+
server: {
|
|
817
|
+
mcp: {
|
|
818
|
+
card: {
|
|
819
|
+
name: 'com.example/assistant',
|
|
820
|
+
url: 'https://my-app.example.com/api/mcp',
|
|
821
|
+
},
|
|
822
|
+
},
|
|
823
|
+
},
|
|
824
|
+
})
|
|
825
|
+
```
|
|
826
|
+
|
|
794
827
|
### server.mcpOptions
|
|
795
828
|
|
|
796
829
|
**Type:** `object`\
|
|
@@ -1079,6 +1112,33 @@ export const mastra = new Mastra({
|
|
|
1079
1112
|
|
|
1080
1113
|
Sending either shutdown signal again during the drain bypasses it and terminates the process immediately.
|
|
1081
1114
|
|
|
1115
|
+
### server.drain
|
|
1116
|
+
|
|
1117
|
+
**Type:** `'run' | 'step'`\
|
|
1118
|
+
**Default:** `'run'`
|
|
1119
|
+
|
|
1120
|
+
How `mastra.shutdown()` drains evented workflow runs (including durable agent runs) after the server receives `SIGINT` or `SIGTERM`. Both values share the [`server.drainTimeout`](#serverdraintimeout) window.
|
|
1121
|
+
|
|
1122
|
+
- `'run'`: The instance keeps taking workflow events while it waits for its in-flight runs to reach a finished or suspended state.
|
|
1123
|
+
- `'step'`: Once the HTTP drain is over, the instance stops taking workflow events and finishes the steps it's executing. Another instance on the same PubSub backend continues each run from its next step. The instance still waits, up to `drainTimeout`, for the runs it started to finish there, so it doesn't exit sooner.
|
|
1124
|
+
|
|
1125
|
+
Use `'step'` for rolling deploys, where another instance is running while this one shuts down. It's supported on Redis Streams and Valkey Streams, while a PubSub backend that doesn't redeliver unacknowledged events makes Mastra log a warning and behave as `'run'`. Don't use it with Google Cloud Pub/Sub, where a step still running when shutdown begins can run twice.
|
|
1126
|
+
|
|
1127
|
+
An agent run that outlives this instance keeps executing on the other one, but clients subscribed to its thread stop receiving its output and their stream ends with an error.
|
|
1128
|
+
|
|
1129
|
+
```typescript
|
|
1130
|
+
import { Mastra } from '@mastra/core'
|
|
1131
|
+
|
|
1132
|
+
export const mastra = new Mastra({
|
|
1133
|
+
server: {
|
|
1134
|
+
drainTimeout: 60000,
|
|
1135
|
+
drain: 'step',
|
|
1136
|
+
},
|
|
1137
|
+
})
|
|
1138
|
+
```
|
|
1139
|
+
|
|
1140
|
+
See [hand runs over during a rolling deploy](https://mastra.ai/docs/deployment/mastra-server) for the limits of `'step'`.
|
|
1141
|
+
|
|
1082
1142
|
### server.studioBase
|
|
1083
1143
|
|
|
1084
1144
|
**Type:** `string`\
|
|
@@ -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
|
|
|
@@ -174,7 +174,7 @@ await pubsub.subscribeFromOffset('my-topic', 42, event => {
|
|
|
174
174
|
|
|
175
175
|
**supportsOffsets** (`boolean`): Whether subscribeFromOffset() honors numeric offsets. Defaults to false. A non-zero offset on an unsupported implementation falls back to replay subscription and logs a warning with console.warn. Implementations can override onUnsupportedOffset() to use their own logger.
|
|
176
176
|
|
|
177
|
-
**deliversAcrossProcesses** (`boolean`): Whether a published event can reach a subscriber in another process. Defaults to true, so Mastra coordinates runs with other processes unless the implementation says otherwise. Return false only when every subscriber lives in the publishing process, as EventEmitterPubSub does.
|
|
177
|
+
**deliversAcrossProcesses** (`boolean`): Whether a published event can reach a subscriber in another process. Defaults to true, so Mastra coordinates runs with other processes unless the implementation says otherwise. Return false only when every subscriber lives in the publishing process, as EventEmitterPubSub does. With true, set a server cache that every process shares on Mastra, because agent runs keep their stream events and ownership record there.
|
|
178
178
|
|
|
179
179
|
**redeliversUnacked** (`boolean`): Whether an event delivered to a consumer that neither acks nor nacks it, for example because its process stopped, is delivered again to another consumer of the same group once the broker considers it abandoned. Defaults to false. Workflow recovery doesn't restart evented runs on a pubsub that returns true, so return true only when the broker does this. Evented workflows and agents that run on several processes need true. See evented workflows and agents.
|
|
180
180
|
|
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
|
|
7
7
|
`CachingPubSub` wraps any [`PubSub`](https://mastra.ai/reference/pubsub/base) implementation and adds event caching and replay. It records published events per topic in a cache, so a subscriber that connects late or reconnects after a disconnect can replay the events it missed before continuing with live events.
|
|
8
8
|
|
|
9
|
-
|
|
9
|
+
Mastra already wraps agent run streams in `CachingPubSub` with the server cache of the `Mastra` instance. Use it yourself to add replay to other topics. Over a transport that reaches other processes, such as [`RedisStreamsPubSub`](https://mastra.ai/reference/pubsub/redis-streams), pass a cache that every process shares: each process otherwise records only the events it published itself.
|
|
10
10
|
|
|
11
11
|
`CachingPubSub` is transparent to batching: `subscribe()` forwards `options.batch` to the inner pub/sub, and `supportsNativeBatching` mirrors the inner's value. Wrapping an inner that doesn't support batching results in unbatched delivery even when `options.batch` is passed.
|
|
12
12
|
|