@mastra/core 1.86.0-alpha.6 → 1.86.0-alpha.8
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/memory/index.d.ts +25 -0
- package/dist/agent/agent.d.ts +87 -12
- package/dist/agent/agent.types.d.ts +34 -2
- package/dist/agent/durable/create-durable-agent.d.ts +1 -1
- package/dist/agent/durable/create-evented-agent.d.ts +6 -0
- package/dist/agent/durable/durable-agent.d.ts +30 -514
- package/dist/agent/durable/durable-stream-until-idle.d.ts +2 -1
- package/dist/agent/durable/evented-agent.d.ts +2 -5
- package/dist/agent/durable/execution-engine.d.ts +20 -3
- package/dist/agent/durable/index.cjs +61 -6351
- package/dist/agent/durable/index.d.ts +3 -2
- package/dist/agent/durable/index.js +50 -6340
- package/dist/agent/durable/stream-adapter.d.ts +5 -5
- package/dist/agent/durable/types.d.ts +454 -3
- package/dist/agent/durable/workflows/durable-loop-builder.d.ts +7 -9
- package/dist/agent/helpers.d.ts +1 -1
- package/dist/agent/index.cjs +4 -4
- package/dist/agent/index.d.ts +1 -1
- package/dist/agent/index.js +4 -4
- package/dist/agent/streams/execution-capability.d.ts +3 -2
- package/dist/agent/streams/execution-policy.d.ts +1 -1
- package/dist/agent/streams/types.d.ts +3 -3
- package/dist/agent/types.d.ts +30 -5
- package/dist/agent-builder/ee/index.cjs +1 -1
- package/dist/agent-builder/ee/index.js +1 -1
- package/dist/agent-controller/index.cjs +2 -2
- package/dist/agent-controller/index.js +2 -2
- package/dist/{agent-controller-c4KbZ8DY.js → agent-controller-B7POPub5.js} +9 -9
- package/dist/{agent-controller-6ORqG6hK.cjs → agent-controller-DEPayioq.cjs} +9 -9
- package/dist/{agent-skills-resolver-BIeWsb01.cjs → agent-skills-resolver-BMoCDoaK.cjs} +1 -1
- package/dist/{agent-skills-resolver-k04IRam7.js → agent-skills-resolver-CUEIMDbx.js} +1 -1
- package/dist/background-tasks/index.cjs +1 -1
- package/dist/background-tasks/index.js +1 -1
- package/dist/{background-tasks-Da0c3R-J.cjs → background-tasks-7iftnRK_.cjs} +1 -1
- package/dist/{background-tasks-CEglmAt7.js → background-tasks-Cv1ecD6S.js} +1 -1
- package/dist/browser/index.cjs +2 -2
- package/dist/browser/index.js +2 -2
- package/dist/{builder-DS826dWf.cjs → builder-DuJBbQDH.cjs} +3 -3
- package/dist/{builder-0V9N8S15.js → builder-Gg-xnX_E.js} +3 -3
- package/dist/capabilities/302ai.json +198 -198
- package/dist/capabilities/abliteratedllm.json +38 -38
- package/dist/capabilities/abliteration-ai.json +6 -6
- package/dist/capabilities/above.json +23 -23
- package/dist/capabilities/adaption.json +14 -14
- package/dist/capabilities/adzuki.json +22 -22
- package/dist/capabilities/agentrouter.json +7 -7
- package/dist/capabilities/agnes.json +2 -2
- package/dist/capabilities/ai-router.json +5 -5
- package/dist/capabilities/aiand.json +23 -23
- package/dist/capabilities/aigrow.json +15 -15
- package/dist/capabilities/aimlapi.json +143 -143
- package/dist/capabilities/aipg.json +2 -2
- package/dist/capabilities/aixy.json +16 -16
- package/dist/capabilities/aki-io.json +12 -12
- package/dist/capabilities/alibaba-cn.json +84 -84
- package/dist/capabilities/alibaba-coding-plan-cn.json +5 -5
- package/dist/capabilities/alibaba-coding-plan.json +5 -5
- package/dist/capabilities/alibaba-token-plan-cn.json +51 -51
- package/dist/capabilities/alibaba-token-plan.json +52 -52
- package/dist/capabilities/alibaba.json +69 -69
- package/dist/capabilities/ambient.json +12 -12
- package/dist/capabilities/amd.json +10 -10
- package/dist/capabilities/anthropic.json +64 -40
- package/dist/capabilities/anyapi.json +12 -12
- package/dist/capabilities/apiko.json +5 -5
- package/dist/capabilities/arcee.json +7 -7
- package/dist/capabilities/augure.json +8 -8
- package/dist/capabilities/auriko.json +21 -21
- package/dist/capabilities/bailing.json +2 -2
- package/dist/capabilities/baseten.json +26 -26
- package/dist/capabilities/bee.json +4 -4
- package/dist/capabilities/berget.json +4 -4
- package/dist/capabilities/bothub.json +17 -17
- package/dist/capabilities/boundless.json +41 -41
- package/dist/capabilities/bumo.json +43 -43
- package/dist/capabilities/byteplus.json +31 -31
- package/dist/capabilities/cerebras.json +4 -4
- package/dist/capabilities/cheapaimodel.json +6 -6
- package/dist/capabilities/cheapest-token.json +32 -32
- package/dist/capabilities/chutes.json +10 -10
- package/dist/capabilities/cline-pass.json +43 -43
- package/dist/capabilities/cloudcode.json +8 -8
- package/dist/capabilities/cloudferro-sherlock.json +4 -4
- package/dist/capabilities/cloudflare-workers-ai.json +31 -31
- package/dist/capabilities/commandcode.json +151 -151
- package/dist/capabilities/concentrate.json +287 -263
- package/dist/capabilities/cortecs.json +106 -106
- package/dist/capabilities/crossmodel.json +189 -189
- package/dist/capabilities/crusoe.json +3 -3
- package/dist/capabilities/daoxe.json +9 -9
- package/dist/capabilities/databricks.json +62 -62
- package/dist/capabilities/deepinfra.json +97 -88
- package/dist/capabilities/deepseek.json +3 -3
- package/dist/capabilities/digitalocean.json +114 -114
- package/dist/capabilities/dothoosh.json +36 -36
- package/dist/capabilities/doubleword.json +29 -29
- package/dist/capabilities/edenai.json +443 -442
- package/dist/capabilities/empiriolabs.json +172 -172
- package/dist/capabilities/engy.json +20 -20
- package/dist/capabilities/entrim.json +8 -8
- package/dist/capabilities/evroc.json +15 -15
- package/dist/capabilities/ezkielyna.json +7 -7
- package/dist/capabilities/fastrouter.json +82 -82
- package/dist/capabilities/fireworks-ai.json +50 -50
- package/dist/capabilities/freemodel.json +24 -24
- package/dist/capabilities/friendli.json +6 -6
- package/dist/capabilities/frogbot.json +98 -98
- package/dist/capabilities/gisoo.json +20 -20
- package/dist/capabilities/gmicloud.json +14 -14
- package/dist/capabilities/google.json +60 -60
- package/dist/capabilities/graphn.json +12 -12
- package/dist/capabilities/greenpt.json +33 -33
- package/dist/capabilities/groq.json +9 -9
- package/dist/capabilities/helicone.json +81 -81
- package/dist/capabilities/hopper.json +2 -2
- package/dist/capabilities/hostinger-router.json +12 -12
- package/dist/capabilities/hpc-ai.json +10 -10
- package/dist/capabilities/huawei-maas.json +15 -15
- package/dist/capabilities/hubris.json +27 -27
- package/dist/capabilities/huggingface.json +59 -50
- package/dist/capabilities/humain.json +2 -2
- package/dist/capabilities/hyper.json +25 -25
- package/dist/capabilities/impossibl.json +140 -140
- package/dist/capabilities/inception.json +2 -2
- package/dist/capabilities/inceptron.json +8 -8
- package/dist/capabilities/inco.json +4 -4
- package/dist/capabilities/infer.json +14 -14
- package/dist/capabilities/inferall.json +7 -7
- package/dist/capabilities/inference-coop.json +15 -15
- package/dist/capabilities/inferenceapis.json +18 -18
- package/dist/capabilities/inferris.json +4 -4
- package/dist/capabilities/infersia.json +13 -13
- package/dist/capabilities/infomaniak.json +2 -2
- package/dist/capabilities/io-net.json +5 -5
- package/dist/capabilities/isoquant.json +4 -4
- package/dist/capabilities/iteracompute.json +54 -54
- package/dist/capabilities/jalapeno.json +12 -12
- package/dist/capabilities/jiekou.json +63 -63
- package/dist/capabilities/joingonka.json +4 -4
- package/dist/capabilities/jzstoken.json +56 -56
- package/dist/capabilities/keln.json +27 -27
- package/dist/capabilities/kenari.json +117 -111
- package/dist/capabilities/kilo.json +625 -649
- 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 +21 -21
- package/dist/capabilities/korouter.json +33 -33
- package/dist/capabilities/kunavo.json +9 -9
- package/dist/capabilities/liquid.json +8 -8
- package/dist/capabilities/lithosai.json +3 -3
- package/dist/capabilities/llmgateway-providers.json +932 -905
- package/dist/capabilities/llmgateway.json +343 -343
- package/dist/capabilities/llmtr.json +25 -25
- package/dist/capabilities/longcat.json +2 -2
- package/dist/capabilities/lowrouter.json +48 -48
- package/dist/capabilities/lyceum.json +13 -13
- package/dist/capabilities/melious.json +13 -13
- package/dist/capabilities/merge-gateway.json +294 -294
- package/dist/capabilities/meta.json +10 -10
- package/dist/capabilities/minimax-cn-coding-plan.json +6 -6
- package/dist/capabilities/minimax-coding-plan.json +6 -6
- package/dist/capabilities/mistral.json +20 -20
- package/dist/capabilities/mixlayer.json +3 -3
- package/dist/capabilities/modal.json +14 -14
- package/dist/capabilities/model-oracle-ai.json +19 -19
- package/dist/capabilities/modelis.json +19 -19
- package/dist/capabilities/modular.json +5 -5
- package/dist/capabilities/moneo.json +17 -17
- package/dist/capabilities/moonshotai-cn.json +5 -5
- package/dist/capabilities/moonshotai.json +5 -5
- package/dist/capabilities/morph.json +14 -14
- package/dist/capabilities/munito-eu.json +8 -8
- package/dist/capabilities/munito.json +10 -10
- package/dist/capabilities/nan.json +28 -28
- package/dist/capabilities/nano-gpt.json +597 -567
- package/dist/capabilities/nearai.json +89 -89
- package/dist/capabilities/nebius.json +40 -31
- package/dist/capabilities/neon.json +135 -135
- package/dist/capabilities/neuralwatt.json +39 -39
- package/dist/capabilities/nokeep.json +2 -2
- package/dist/capabilities/novita-ai.json +158 -158
- package/dist/capabilities/nvidia.json +35 -35
- package/dist/capabilities/oathbreaker.json +2 -2
- package/dist/capabilities/obscurify.json +26 -26
- package/dist/capabilities/oci.json +6 -6
- package/dist/capabilities/ofox.json +352 -352
- package/dist/capabilities/ollama-cloud.json +52 -52
- package/dist/capabilities/openai.json +49 -56
- package/dist/capabilities/opencode-go.json +82 -81
- package/dist/capabilities/openreason.json +5 -5
- package/dist/capabilities/openrouter.json +557 -567
- package/dist/capabilities/opper.json +28 -22
- package/dist/capabilities/orcarouter.json +230 -230
- package/dist/capabilities/outerlabs.json +33 -33
- package/dist/capabilities/ovhcloud.json +6 -6
- package/dist/capabilities/pareto.json +6 -6
- package/dist/capabilities/perplexity-agent.json +58 -58
- package/dist/capabilities/perplexity.json +2 -2
- package/dist/capabilities/phala.json +22 -22
- package/dist/capabilities/pioneer.json +30 -30
- package/dist/capabilities/poe.json +122 -122
- package/dist/capabilities/poolside.json +3 -3
- package/dist/capabilities/powerspring.json +10 -10
- package/dist/capabilities/primalabs.json +8 -8
- package/dist/capabilities/prime.json +114 -97
- package/dist/capabilities/privatemode-ai.json +11 -11
- package/dist/capabilities/proxystacks.json +7 -7
- package/dist/capabilities/qiniu-ai.json +13 -13
- package/dist/capabilities/refuseless.json +7 -7
- package/dist/capabilities/regolo-ai.json +6 -6
- package/dist/capabilities/requesty.json +172 -189
- package/dist/capabilities/ruapi.json +18 -18
- package/dist/capabilities/runcrate.json +17 -17
- package/dist/capabilities/runinfra.json +16 -16
- package/dist/capabilities/sakana.json +6 -6
- package/dist/capabilities/sambanova.json +4 -4
- package/dist/capabilities/sandbase.json +24 -24
- package/dist/capabilities/sarvam.json +12 -12
- package/dist/capabilities/scaleway.json +19 -19
- package/dist/capabilities/scnet-token-plan.json +10 -10
- package/dist/capabilities/scx-ai.json +23 -23
- package/dist/capabilities/sensenova.json +14 -14
- package/dist/capabilities/siliconflow-cn.json +64 -64
- package/dist/capabilities/siliconflow.json +63 -63
- package/dist/capabilities/snowflake-cortex.json +23 -23
- package/dist/capabilities/sokkan.json +12 -12
- package/dist/capabilities/sparrowcodes.json +23 -23
- package/dist/capabilities/standardcompute.json +83 -83
- package/dist/capabilities/steadyrouter.json +39 -39
- package/dist/capabilities/stepfun-ai-step-plan.json +5 -5
- package/dist/capabilities/stepfun-ai.json +5 -5
- package/dist/capabilities/stepfun-step-plan.json +5 -5
- package/dist/capabilities/stepfun.json +5 -5
- package/dist/capabilities/stepping-stone.json +16 -16
- package/dist/capabilities/superbot-gg.json +4 -4
- package/dist/capabilities/synthetic.json +14 -14
- package/dist/capabilities/synthorai.json +29 -29
- package/dist/capabilities/teamorouter.json +26 -26
- package/dist/capabilities/teapot-router.json +13 -13
- package/dist/capabilities/tencent-coding-plan.json +2 -2
- package/dist/capabilities/tencent-token-plan.json +30 -30
- package/dist/capabilities/tencent-tokenhub.json +8 -8
- package/dist/capabilities/tensorx.json +45 -45
- package/dist/capabilities/tenstorrent.json +8 -8
- package/dist/capabilities/the-grid-ai.json +35 -35
- package/dist/capabilities/thinkingmachines.json +59 -59
- package/dist/capabilities/tinfoil.json +5 -5
- package/dist/capabilities/toapis.json +2 -2
- package/dist/capabilities/togetherai.json +59 -59
- package/dist/capabilities/tokengo.json +24 -24
- package/dist/capabilities/tokenify.json +9 -9
- package/dist/capabilities/trustedrouter.json +5 -5
- package/dist/capabilities/trustedtokens.json +18 -18
- package/dist/capabilities/umans-ai-coding-plan.json +18 -18
- package/dist/capabilities/umans-ai.json +15 -15
- package/dist/capabilities/uncensuredai.json +4 -4
- package/dist/capabilities/unrestricted.json +4 -4
- package/dist/capabilities/uplinkswitch.json +21 -21
- package/dist/capabilities/upstage.json +7 -7
- package/dist/capabilities/vancine.json +20 -20
- package/dist/capabilities/vercel.json +568 -576
- package/dist/capabilities/vivgrid.json +78 -78
- package/dist/capabilities/volcengine-coding-plan.json +30 -30
- package/dist/capabilities/volcengine.json +35 -35
- package/dist/capabilities/vultr.json +27 -27
- package/dist/capabilities/wafer.ai.json +16 -16
- package/dist/capabilities/wallaby.json +5 -5
- package/dist/capabilities/wally.json +11 -11
- package/dist/capabilities/wandb.json +21 -21
- package/dist/capabilities/watt.json +26 -26
- package/dist/capabilities/xai.json +7 -7
- package/dist/capabilities/xiaomi-token-plan-ams.json +2 -2
- package/dist/capabilities/xiaomi-token-plan-cn.json +3 -3
- package/dist/capabilities/xiaomi-token-plan-sgp.json +2 -2
- package/dist/capabilities/xiaomi.json +6 -6
- package/dist/capabilities/xpersona.json +12 -12
- package/dist/capabilities/xxapi.json +31 -31
- package/dist/capabilities/zai-coding-plan.json +13 -13
- package/dist/capabilities/zai.json +27 -27
- package/dist/capabilities/zenifra.json +27 -27
- package/dist/capabilities/zenmux.json +195 -195
- package/dist/capabilities/zerogpu.json +12 -12
- package/dist/capabilities/zhipuai-coding-plan.json +8 -8
- package/dist/capabilities/zhipuai.json +27 -27
- package/dist/capabilities/zro.json +6 -6
- package/dist/channels/agent-channels.d.ts +11 -0
- package/dist/channels/chat-tools.d.ts +156 -0
- package/dist/channels/index.cjs +7 -2
- package/dist/channels/index.d.ts +2 -0
- package/dist/channels/index.js +3 -3
- package/dist/{channels-C5DxhFRc.js → channels-BRVCOutx.js} +1 -1
- package/dist/{channels-B57qQolh.cjs → channels-MjTA9bFp.cjs} +1 -1
- package/dist/coding-agent/index.cjs +4 -4
- package/dist/coding-agent/index.js +4 -4
- package/dist/{constants-DaBkXs5H.cjs → constants-B9ZDvXZ4.cjs} +41 -0
- package/dist/{constants-BDHIyN28.js → constants-BmdTvEYN.js} +30 -1
- package/dist/datasets/dataset.d.ts +13 -6
- package/dist/datasets/experiment/durable.d.ts +16 -0
- package/dist/datasets/experiment/index.d.ts +2 -1
- package/dist/datasets/experiment/item.d.ts +26 -4
- package/dist/datasets/experiment/retries.d.ts +18 -0
- package/dist/datasets/experiment/types.d.ts +18 -0
- package/dist/datasets/experiment/workflow-id.d.ts +7 -0
- package/dist/datasets/experiment/workflow.d.ts +74 -0
- package/dist/datasets/index.cjs +3 -2
- package/dist/datasets/index.d.ts +2 -1
- package/dist/datasets/index.js +3 -3
- package/dist/docs/SKILL.md +2 -2
- package/dist/docs/assets/SOURCE_MAP.json +1309 -1304
- package/dist/docs/references/docs-deployment-workers.md +1 -1
- package/dist/docs/references/docs-evals-experiments.md +29 -1
- package/dist/docs/references/docs-harness-durable-agents.md +9 -5
- package/dist/docs/references/docs-knowledge-agents-and-tools.md +1 -0
- package/dist/docs/references/docs-knowledge-load-your-content.md +1 -1
- package/dist/docs/references/docs-mastra-platform-observability-overview.md +1 -1
- package/dist/docs/references/docs-server-pubsub.md +51 -8
- package/dist/docs/references/docs-signals-running-across-processes.md +2 -0
- package/dist/docs/references/docs-workflows-overview.md +1 -1
- package/dist/docs/references/docs-workflows-scheduled-workflows.md +1 -1
- package/dist/docs/references/integrations-channels-slack.md +4 -2
- package/dist/docs/references/integrations.md +6 -0
- package/dist/docs/references/reference-agents-agent.md +3 -1
- package/dist/docs/references/reference-agents-channels.md +146 -24
- package/dist/docs/references/reference-agents-durable-agent.md +28 -2
- package/dist/docs/references/reference-datasets-runExperimentItem.md +13 -1
- package/dist/docs/references/reference-datasets-startExperimentAsync.md +3 -1
- package/dist/docs/references/reference-editor-mastra-editor.md +3 -1
- package/dist/docs/references/reference-knowledge-knowledge-class.md +2 -2
- package/dist/docs/references/reference-knowledge-knowledge-tools.md +43 -20
- package/dist/docs/references/reference-processors-moderation-processor.md +2 -2
- package/dist/docs/references/reference-pubsub-base.md +5 -1
- package/dist/docs/references/reference-pubsub-event-emitter.md +2 -0
- package/dist/docs/references/reference-pubsub-redis-streams.md +1 -1
- package/dist/docs/references/reference-pubsub-unix-socket-pubsub.md +2 -0
- package/dist/docs/references/reference-streaming-ChunkType.md +1 -1
- package/dist/docs/references/reference-workers-overview.md +1 -1
- package/dist/docs/references/reference-workflows-run-methods-start.md +23 -0
- package/dist/docs/references/reference-workflows-run-methods-timeTravel.md +4 -0
- package/dist/docs/references/reference-workflows-run.md +1 -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 +1 -0
- package/dist/events/event-emitter/index.d.ts +12 -5
- package/dist/events/index.cjs +15 -1
- package/dist/events/index.js +15 -1
- package/dist/events/pubsub.d.ts +29 -0
- package/dist/events/reach.d.ts +11 -0
- package/dist/events/unix-socket-pubsub.d.ts +14 -0
- package/dist/{filesystem-CUj0vclS.cjs → filesystem-B0AZrbj8.cjs} +1 -1
- package/dist/{filesystem-BBqrAmKK.js → filesystem-B3s0WRud.js} +1 -1
- package/dist/{filesystem-B_HACoLS.js → filesystem-B5X-5G0x.js} +1 -1
- package/dist/{filesystem-pZNvxjuW.cjs → filesystem-BDSpwBke.cjs} +1 -1
- package/dist/{filesystem-5Z777gYZ.js → filesystem-BsdkC311.js} +1 -1
- package/dist/{filesystem-BNHPgtjJ.cjs → filesystem-C-cyJfi1.cjs} +1 -1
- package/dist/{filesystem-U5o28b5w.cjs → filesystem-CEbD_77-.cjs} +1 -1
- package/dist/{filesystem-yHKEz2Pr.cjs → filesystem-CUAgLugE.cjs} +1 -1
- package/dist/{filesystem-Cb8iTPM-.js → filesystem-Cv79mHRk.js} +1 -1
- package/dist/{filesystem-DhiaddZe.cjs → filesystem-DsCQiBl2.cjs} +1 -1
- package/dist/{filesystem-DSYDB3ek.js → filesystem-DzM9pcQ8.js} +1 -1
- package/dist/{filesystem-gpIfFMed.js → filesystem-DzfqVTO_.js} +1 -1
- package/dist/{filesystem-versioned-CxbiSJF-.js → filesystem-versioned-Bijb_p9l.js} +44 -44
- package/dist/harness/index.cjs +2 -2
- package/dist/harness/index.js +2 -2
- package/dist/index.cjs +1 -1
- package/dist/index.js +1 -1
- package/dist/knowledge/index.cjs +1 -1
- package/dist/knowledge/index.js +1 -1
- package/dist/llm/index.cjs +3 -3
- package/dist/llm/index.js +3 -3
- package/dist/llm/model/provider-types.generated.d.ts +7720 -7720
- package/dist/llm/model/shared.types.d.ts +31 -0
- package/dist/{llm-B0VtQDgT.js → llm-Djd8Qzi0.js} +2 -2
- package/dist/{llm-ByskI6z3.cjs → llm-DmUucguC.cjs} +2 -2
- package/dist/loop/base-loop-builder.d.ts +60 -0
- package/dist/loop/index.cjs +2 -2
- package/dist/loop/index.js +2 -2
- package/dist/loop/loop-builder.d.ts +10 -32
- package/dist/loop/workflows/agentic-execution/index.d.ts +1 -1
- package/dist/loop/workflows/agentic-execution/llm-execution-step.d.ts +2 -2
- package/dist/loop/workflows/agentic-loop/index.d.ts +1 -1
- package/dist/{manager-C2RGNH68.js → manager-CO_Xz2zR.js} +461 -95
- package/dist/{manager-BJKx4lQf.cjs → manager-D27PkIPo.cjs} +477 -93
- package/dist/mastra/index.cjs +1 -1
- package/dist/mastra/index.d.ts +13 -0
- package/dist/mastra/index.js +1 -1
- package/dist/{mastra-zUTq9ilk.js → mastra-Ch00nEAJ.js} +66 -25
- package/dist/{mastra-FXCeC5rF.cjs → mastra-qsVWpOTi.cjs} +66 -25
- package/dist/memory/index.cjs +2 -2
- package/dist/memory/index.js +2 -2
- package/dist/{model-BTNRPDgQ.js → model-CW-mfGYA.js} +1 -1
- package/dist/{model-BmTFNo62.cjs → model-Do6DTJoj.cjs} +1 -1
- package/dist/{netlify-B_XdjYPY.cjs → netlify-DU32SDT6.cjs} +1 -1
- package/dist/{netlify-BCSVhO5q.js → netlify-DZSAbdve.js} +1 -1
- package/dist/notifications/index.cjs +1 -1
- package/dist/notifications/index.js +1 -1
- package/dist/{output-helpers-CncZ3y-g.cjs → output-helpers-1Zu4Vt9C.cjs} +112 -69
- package/dist/{output-helpers-RlvE2WPA.js → output-helpers-CedRCE17.js} +113 -70
- 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/processors/processors/pii-detector.d.ts +1 -0
- package/dist/{provider-registry-Ble43Wb4.js → provider-registry-deA0x-Gd.js} +21349 -21338
- package/dist/{provider-registry-D8O1G18A.cjs → provider-registry-zGezZVsL.cjs} +21349 -21338
- package/dist/provider-registry.json +21695 -21680
- package/dist/{registry-generator-BQ1noftK.cjs → registry-generator-BkQ1AxZn.cjs} +1 -1
- package/dist/{registry-generator-D1Zslex6.js → registry-generator-VvBfOKAD.js} +1 -1
- package/dist/{rehydrate-CgxEur9m.js → rehydrate-BjLV643n.js} +2 -2
- package/dist/{rehydrate-BiA_HUJH.cjs → rehydrate-DDYFpQsV.cjs} +2 -2
- package/dist/relevance/index.cjs +2 -2
- package/dist/relevance/index.js +2 -2
- package/dist/{run-registry-aomba2_Z.cjs → run-registry-5Suldxz3.cjs} +83965 -77543
- package/dist/{run-registry-BUFmc_78.js → run-registry-CGRPldLH.js} +84057 -77017
- package/dist/{scheduler-BuivoTeD.js → scheduler-B-VZUvv_.js} +1 -1
- package/dist/{scheduler-COSuIH7R.cjs → scheduler-D00X03jQ.cjs} +1 -1
- package/dist/schedules/index.cjs +1 -1
- package/dist/schedules/index.js +1 -1
- package/dist/{schedules-Dmu9qOgc.js → schedules-DZfSx-7P.js} +94 -94
- package/dist/{signal-provider-CicwpNwY.cjs → signal-provider-BFAvh_AJ.cjs} +1 -1
- package/dist/{signal-provider-BOtSN-_0.js → signal-provider-BslnAjWG.js} +1 -1
- package/dist/signals/index.cjs +3 -3
- package/dist/signals/index.js +3 -3
- package/dist/{signals-6EBDPHQX.cjs → signals-B1JSj-Ew.cjs} +2 -2
- package/dist/{signals-BH__LS8Y.js → signals-De9VnwL2.js} +2 -2
- package/dist/skills/index.cjs +2 -2
- package/dist/skills/index.js +2 -2
- package/dist/{source-8qxr6KJv.cjs → source-DDwx-87N.cjs} +1 -1
- package/dist/{source-DRqDgbCv.js → source-Did_2XQc.js} +1 -1
- package/dist/{state-processor-BRk8t1OR.js → state-processor-B9kxpM53.js} +140 -140
- package/dist/{state-processor-Bfs9LkY8.cjs → state-processor-kRNZ38Nf.cjs} +139 -139
- package/dist/storage/constants.cjs +1 -1
- package/dist/storage/constants.js +1 -1
- package/dist/storage/domains/agents/index.cjs +1 -1
- package/dist/storage/domains/agents/index.js +1 -1
- package/dist/storage/domains/knowledge/base.d.ts +5 -0
- package/dist/storage/domains/knowledge/inmemory.d.ts +1 -0
- package/dist/storage/domains/knowledge/pages.d.ts +24 -7
- package/dist/storage/domains/mcp-clients/index.cjs +1 -1
- package/dist/storage/domains/mcp-clients/index.js +1 -1
- package/dist/storage/domains/mcp-servers/index.cjs +1 -1
- package/dist/storage/domains/mcp-servers/index.js +1 -1
- package/dist/storage/domains/memory/base.d.ts +3 -1
- package/dist/storage/domains/memory/observational-memory-lifecycle.d.ts +1 -1
- package/dist/storage/domains/prompt-blocks/index.cjs +1 -1
- package/dist/storage/domains/prompt-blocks/index.js +1 -1
- package/dist/storage/domains/scorer-definitions/index.cjs +1 -1
- package/dist/storage/domains/scorer-definitions/index.js +1 -1
- package/dist/storage/domains/skills/index.cjs +1 -1
- package/dist/storage/domains/skills/index.js +1 -1
- package/dist/storage/domains/workspaces/index.cjs +1 -1
- package/dist/storage/domains/workspaces/index.js +1 -1
- package/dist/storage/index.cjs +12 -11
- package/dist/storage/index.js +12 -12
- package/dist/storage/types.d.ts +13 -0
- package/dist/stream/base/output.d.ts +42 -15
- package/dist/stream/index.cjs +2 -2
- package/dist/stream/index.js +2 -2
- package/dist/stream/types.d.ts +19 -0
- package/dist/{stream-S_NC5v9e.js → stream-Dpwx0whf.js} +1 -1
- package/dist/{stream-DUrp3Fcy.cjs → stream-Dvy_0o14.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-BhCzpGfr.js → tool-loop-agent-PbWrEj1k.js} +3 -3
- package/dist/{tool-loop-agent-DU0BiemT.cjs → tool-loop-agent-UxOv3FoK.cjs} +3 -3
- package/dist/tools/index.cjs +1 -1
- package/dist/tools/index.js +1 -1
- package/dist/tools/types.d.ts +27 -1
- package/dist/{utils-CeEt4K7t.cjs → utils-BbMTlyBO.cjs} +1 -1
- package/dist/{utils-DYIai19q.js → utils-BnNi1BYM.js} +1 -1
- package/dist/utils.cjs +1 -1
- package/dist/utils.js +1 -1
- package/dist/{validate-BRikrNhF.js → validate-HSBcm96b.js} +1 -1
- package/dist/{validate-BckgxuJ0.cjs → validate-Skps-cM3.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-BfhUD77l.cjs → worker-BE-0DyKL.cjs} +3 -3
- package/dist/{worker-DcBfwJqD.js → worker-BKrKHZzU.js} +3 -3
- package/dist/{worker-D9WwmcJa.cjs → worker-BNS5A3qP.cjs} +3 -3
- package/dist/{worker-Du5ybt5o.js → worker-DehaD4qD.js} +3 -3
- package/dist/{workflow-BWV5m9Mx.cjs → workflow-BjUTwaK9.cjs} +4 -4
- package/dist/{workflow-jNWVBYDJ.js → workflow-Bvw6yDjc.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 +18 -0
- package/dist/workflows/evented/workflow-event-processor/run-status.d.ts +37 -0
- package/dist/workflows/evented/workflow.d.ts +11 -1
- package/dist/workflows/index.cjs +6 -6
- package/dist/workflows/index.js +6 -6
- package/dist/workflows/workflow.d.ts +6 -1
- package/dist/workspace/index.cjs +2 -2
- package/dist/workspace/index.js +2 -2
- package/dist/{workspace-D7JRhn1Z.js → workspace-C05xDH60.js} +564 -411
- package/dist/{workspace-BQ2wZj5D.cjs → workspace-D1OzzlLw.cjs} +564 -411
- package/dist/{workspace-skills-CGiXfKzA.js → workspace-skills-38OY32_b.js} +531 -531
- package/package.json +6 -6
- package/src/llm/model/provider-types.generated.d.ts +7720 -7720
- package/dist/agent/durable/evented-execution-engine.d.ts +0 -20
- package/dist/{filesystem-versioned-D-OCaYSl.cjs → filesystem-versioned-DZGyPbNC.cjs} +43 -43
- package/dist/{schedules-qIHUKsj4.cjs → schedules-BZS8McF7.cjs} +93 -93
- package/dist/{workspace-skills-CUSjYHdi.cjs → workspace-skills-BcquhPDn.cjs} +530 -530
|
@@ -83,7 +83,7 @@ The server generated by `mastra build` starts these workers automatically. If yo
|
|
|
83
83
|
|
|
84
84
|
This setup needs no external infrastructure beyond your storage adapter. It doesn't survive process crashes, and you can't scale individual components.
|
|
85
85
|
|
|
86
|
-
> **Warning:** The in-memory PubSub delivers events only inside the process that published them. Running several Mastra instances on one storage with it isn't supported for evented workflows
|
|
86
|
+
> **Warning:** The in-memory PubSub delivers events only inside the process that published them. Running several Mastra instances on one storage with it isn't supported for evented workflows or agents. Each instance restarts the others' active evented workflow runs when it boots. A multi-instance deployment needs a PubSub backend that redelivers unacknowledged events and a storage adapter with workflow step guards. See [evented workflows and agents](https://mastra.ai/docs/server/pubsub).
|
|
87
87
|
|
|
88
88
|
### Split processes
|
|
89
89
|
|
|
@@ -487,6 +487,34 @@ while (experiment.status === 'pending' || experiment.status === 'running') {
|
|
|
487
487
|
console.log(experiment.status) // 'completed' | 'failed'
|
|
488
488
|
```
|
|
489
489
|
|
|
490
|
+
### Durable experiments
|
|
491
|
+
|
|
492
|
+
By default, `startExperimentAsync()` runs the experiment inside the process that started it. If that process stops or redeploys, the experiment stays `running`. Pass `durable: true` to run it as an [evented workflow](https://mastra.ai/docs/deployment/workers) instead, with one workflow step per item:
|
|
493
|
+
|
|
494
|
+
```typescript
|
|
495
|
+
const { experimentId } = await dataset.startExperimentAsync({
|
|
496
|
+
durable: true,
|
|
497
|
+
targetType: 'agent',
|
|
498
|
+
targetId: 'translation-agent',
|
|
499
|
+
scorers: ['accuracy'],
|
|
500
|
+
maxConcurrency: 5,
|
|
501
|
+
})
|
|
502
|
+
```
|
|
503
|
+
|
|
504
|
+
The workflow's run ID is the experiment ID. Each item's result is upserted on `(experimentId, itemId, attempt)`, so an item that runs again after a crash still leaves one row. A target error is recorded on the item's row and doesn't fail the run. When every item is done, Mastra finalizes the experiment.
|
|
505
|
+
|
|
506
|
+
Durable runs need [workers](https://mastra.ai/docs/deployment/workers) and a pubsub that redelivers unacknowledged events, such as Redis Streams, Valkey Streams, or Google Cloud Pub/Sub. A process that only handles pushed events through `mastra.handleWorkflowEvent()` can run the steps too, without starting workers. On the default in-memory pubsub, the run works but stays in one process, so it isn't durable.
|
|
507
|
+
|
|
508
|
+
Everything in a durable run must be serializable, so `durable: true` accepts registered targets, scorer IDs, `version`, `maxConcurrency`, `itemTimeout`, `maxRetries`, `agentModel` as a `provider/modelId` string, `requestContext` with plain JSON values, `unmockedToolPolicy`, and `versions`. It throws a `MastraError` with the `id` `EXPERIMENT_NOT_DURABLE` before creating anything when the config uses an inline `task`, lifecycle hooks, `onEvent`, `signal`, scorer objects or step scorers, `persistence` set to `'none'`, or `requestContext` values that aren't plain JSON, such as functions or dates.
|
|
509
|
+
|
|
510
|
+
A durable run doesn't keep the signed-in user from the request that started it. Mastra removes the auth token, user, roles, and permissions from `requestContext` before the run is published or stored, so targets in a durable run don't see them.
|
|
511
|
+
|
|
512
|
+
Keep these limits in mind:
|
|
513
|
+
|
|
514
|
+
- **Recovery waits for the broker.** With Redis or Valkey Streams, an item cut off by a crash runs again after `reclaimIdleMs` (60 seconds by default).
|
|
515
|
+
- **A pull worker runs one step at a time.** Items run in parallel only across workers, so `maxConcurrency` above the worker count doesn't speed up the run.
|
|
516
|
+
- **Workflow targets can run twice after a crash.** Workflow recovery can restart the cut-off target run while the item also runs again. The item still counts once.
|
|
517
|
+
|
|
490
518
|
## Caller-driven experiments
|
|
491
519
|
|
|
492
520
|
`startExperiment()` puts Mastra in charge of the whole run. If a durable orchestrator (for example Temporal, Airflow, or a custom worker fleet) owns the loop instead, create the experiment first and drive it yourself in one of these shapes:
|
|
@@ -520,7 +548,7 @@ const { result, scores } = await dataset.runExperimentItem({
|
|
|
520
548
|
})
|
|
521
549
|
```
|
|
522
550
|
|
|
523
|
-
|
|
551
|
+
By default each `runExperimentItem` call executes the item once. Pass `maxRetries` and `itemTimeout` to retry and time out inside the call, or leave both to your orchestrator. The item's tool mocks apply as in native runs. Scorers resolve with the same precedence as native runs: experiment `scorers` win over item `scorerIds`, which win over dataset `scorerIds`.
|
|
524
552
|
|
|
525
553
|
### Ingest external results
|
|
526
554
|
|
|
@@ -78,11 +78,11 @@ A durable agent adds three layers on top of a regular agent:
|
|
|
78
78
|
|
|
79
79
|
Mastra provides three factory functions that produce durable agents. They differ in how the workflow is executed:
|
|
80
80
|
|
|
81
|
-
| Factory | Package | Best for
|
|
82
|
-
| ---------------------- | ----------------- |
|
|
83
|
-
| `createDurableAgent()` | `@mastra/core` | Local development and single-process servers. You get a stream you can await directly.
|
|
84
|
-
| `createEventedAgent()` | `@mastra/core` | Background execution. The workflow starts without blocking, and you consume chunks through PubSub. |
|
|
85
|
-
| `createInngestAgent()` | `@mastra/inngest` | Production deployments. Inngest adds step memoization, retries, and a monitoring dashboard.
|
|
81
|
+
| Factory | Package | Best for |
|
|
82
|
+
| ---------------------- | ----------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
|
|
83
|
+
| `createDurableAgent()` | `@mastra/core` | Local development and single-process servers. You get a stream you can await directly. |
|
|
84
|
+
| `createEventedAgent()` | `@mastra/core` | Background execution. The workflow starts without blocking, and you consume chunks through PubSub. Running it on several processes needs a [supported PubSub backend and storage adapter](https://mastra.ai/docs/server/pubsub). |
|
|
85
|
+
| `createInngestAgent()` | `@mastra/inngest` | Production deployments. Inngest adds step memoization, retries, and a monitoring dashboard. |
|
|
86
86
|
|
|
87
87
|
All three return an object you register with `Mastra` the same way as a regular agent. `createDurableAgent()` and `createEventedAgent()` return class instances that extend `Agent`. `createInngestAgent()` returns a Proxy-backed object that forwards `Agent` methods to the underlying agent. When a signal wakes an idle thread, all three start that run with the durable `stream()`. `sendSignal()` and `sendNotificationSignal()` both work this way.
|
|
88
88
|
|
|
@@ -120,6 +120,8 @@ const agent = new Agent({
|
|
|
120
120
|
export const eventedWriter = createEventedAgent({ agent })
|
|
121
121
|
```
|
|
122
122
|
|
|
123
|
+
In one process, an evented agent runs on the default PubSub backend with no extra setup, which is how you try it locally. To run its steps on several processes, such as dedicated [workers](https://mastra.ai/docs/deployment/workers), configure a PubSub backend that redelivers unacknowledged events and a storage adapter with workflow step guards. `EventEmitterPubSub` and `UnixSocketPubSub` don't qualify. See [evented workflows and agents](https://mastra.ai/docs/server/pubsub) for the supported backends and adapters.
|
|
124
|
+
|
|
123
125
|
### Resumable streams for stored agents
|
|
124
126
|
|
|
125
127
|
Agents created with [`createStoredAgent()`](https://mastra.ai/reference/client-js/agents) use the `durable` field to configure resumable streams only. The server hydrates a plain `Agent` with stream publishing and replay enabled:
|
|
@@ -415,6 +417,8 @@ Recovery can start the same tool call before the previous execution detects owne
|
|
|
415
417
|
|
|
416
418
|
Every replica can start with `recovery.durableAgents: 'auto'`. Replicas that boot together race to recover the same orphaned runs, but only one claim succeeds per run and the other replicas skip it. This requires a claim that every replica shares: a workflows store that supports run fencing, or a PubSub backend whose lease every replica shares. Without either, gate recovery behind your own leader election or run it from a single replica.
|
|
417
419
|
|
|
420
|
+
Evented agents whose steps run on several processes have further requirements. See [evented workflows and agents](https://mastra.ai/docs/server/pubsub).
|
|
421
|
+
|
|
418
422
|
## Database load
|
|
419
423
|
|
|
420
424
|
Mastra doesn't publish a benchmarked hardware reference for durable agents, so size your database from your own workload. This section covers what drives the load and what to watch.
|
|
@@ -83,6 +83,7 @@ With the read tools, an agent can:
|
|
|
83
83
|
- Browse how a scope is organized.
|
|
84
84
|
- Search pages and notes by keyword, or by meaning when you [add semantic search](https://mastra.ai/docs/knowledge/search).
|
|
85
85
|
- Read a page, including its notes and the notes on other pages that mention it.
|
|
86
|
+
- List what changed over a period, such as everything since the start of a quarter, including note changes. See [`knowledge_activity`](https://mastra.ai/reference/knowledge/knowledge-tools).
|
|
86
87
|
|
|
87
88
|
A long page comes back in parts. The first read shows the page's headings. The agent then reads the section it needs, continues from a line, or reads only the lines that match a term.
|
|
88
89
|
|
|
@@ -59,7 +59,7 @@ export async function seedDocs(orgId: string, docs: Doc[]) {
|
|
|
59
59
|
|
|
60
60
|
Agents whose runs hold `org:acme` can now find these pages with search and read them. If you set `vector` and `embedder`, `upsertPage()` also embeds each page for [search by meaning](https://mastra.ai/docs/knowledge/search).
|
|
61
61
|
|
|
62
|
-
To add a dated fact or a comment to a page, add a note. The `[[docs:acme#releases/2026-12]]` mention becomes a link
|
|
62
|
+
To add a dated fact or a comment to a page, add a note. The `[[docs:acme#releases/2026-12]]` mention becomes a link only if that page already exists when you add the note. Creating the page later doesn't turn an earlier mention into a link, so add the note after the target page exists, or update the note once it does:
|
|
63
63
|
|
|
64
64
|
```typescript
|
|
65
65
|
await knowledge.addNote({
|
|
@@ -208,7 +208,7 @@ Platform adds these fields and grouping options:
|
|
|
208
208
|
| `aggregateTraces()` | Supports `groupBy: ['projectId']` and `countDistinct.projectId`. |
|
|
209
209
|
| `aggregateSpans()` | Supports `groupBy: ['projectId']`, but not `countDistinct.projectId`. |
|
|
210
210
|
|
|
211
|
-
Data retention depends on your plan: 15 days for Starter,
|
|
211
|
+
Data retention depends on your plan: 15 days for Free, 60 days for Starter, 180 days for Team, and custom retention for Enterprise. See [pricing](https://mastra.ai/pricing) for current plan limits.
|
|
212
212
|
|
|
213
213
|
### Other observability data
|
|
214
214
|
|
|
@@ -46,18 +46,19 @@ Because it runs in process, events aren't persisted and don't reach other proces
|
|
|
46
46
|
|
|
47
47
|
Set the `pubsub` option on the `Mastra` instance to choose a backend. Each backend implements the same [`PubSub`](https://mastra.ai/reference/pubsub/base) contract, so the rest of your application doesn't change.
|
|
48
48
|
|
|
49
|
-
The deciding
|
|
49
|
+
The deciding questions are where the subscriber runs and whether [evented workflows and agents](#evented-workflows-and-agents) run on more than one process.
|
|
50
50
|
|
|
51
|
-
| Backend | Scope | Mode | Package |
|
|
52
|
-
| ----------------------------------------------------------------------------- | ---------------------------- | ------------- | ----------------------------- |
|
|
53
|
-
| [`EventEmitterPubSub`](https://mastra.ai/reference/pubsub/event-emitter) | Single process | Pull and push | `@mastra/core` |
|
|
54
|
-
| [`UnixSocketPubSub`](https://mastra.ai/reference/pubsub/unix-socket-pubsub) | Multiple processes, one host | Push | `@mastra/core` |
|
|
55
|
-
| [`RedisStreamsPubSub`](https://mastra.ai/reference/pubsub/redis-streams) | Distributed, multiple hosts | Pull | `@mastra/redis-streams` |
|
|
56
|
-
| [`
|
|
51
|
+
| Backend | Scope | Evented runs on several processes | Mode | Package |
|
|
52
|
+
| ----------------------------------------------------------------------------- | ---------------------------- | --------------------------------- | ------------- | ----------------------------- |
|
|
53
|
+
| [`EventEmitterPubSub`](https://mastra.ai/reference/pubsub/event-emitter) | Single process | No | Pull and push | `@mastra/core` |
|
|
54
|
+
| [`UnixSocketPubSub`](https://mastra.ai/reference/pubsub/unix-socket-pubsub) | Multiple processes, one host | No | Push | `@mastra/core` |
|
|
55
|
+
| [`RedisStreamsPubSub`](https://mastra.ai/reference/pubsub/redis-streams) | Distributed, multiple hosts | Yes | Pull | `@mastra/redis-streams` |
|
|
56
|
+
| [`ValkeyStreamsPubSub`](https://mastra.ai/reference/pubsub/valkey-streams) | Distributed, multiple hosts | Yes | Pull | `@mastra/valkey-streams` |
|
|
57
|
+
| [`GoogleCloudPubSub`](https://mastra.ai/reference/pubsub/google-cloud-pubsub) | Distributed, multiple hosts | Yes | Pull | `@mastra/google-cloud-pubsub` |
|
|
57
58
|
|
|
58
59
|
### Multiple processes on one host
|
|
59
60
|
|
|
60
|
-
Use [`UnixSocketPubSub`](https://mastra.ai/reference/pubsub/unix-socket-pubsub) when several processes on the same machine need to share
|
|
61
|
+
Use [`UnixSocketPubSub`](https://mastra.ai/reference/pubsub/unix-socket-pubsub) when several processes on the same machine need to share streams and signals. It delivers events over a Unix domain socket and elects one process as a broker. If the broker exits, the remaining processes elect a new one. It doesn't redeliver the events a stopped process held, so it isn't a backend for evented workflows or agents that run on several processes.
|
|
61
62
|
|
|
62
63
|
```typescript
|
|
63
64
|
import { Mastra } from '@mastra/core'
|
|
@@ -104,6 +105,48 @@ export const mastra = new Mastra({
|
|
|
104
105
|
})
|
|
105
106
|
```
|
|
106
107
|
|
|
108
|
+
## Evented workflows and agents
|
|
109
|
+
|
|
110
|
+
Workflows on the [evented execution engine](https://mastra.ai/docs/workflows/scheduled-workflows) and agents created with [`createEventedAgent()`](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 both of the following:
|
|
111
|
+
|
|
112
|
+
- **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
|
+
- **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).
|
|
114
|
+
|
|
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.
|
|
116
|
+
|
|
117
|
+
[`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
|
+
|
|
119
|
+
- `EventEmitterPubSub` delivers inside one process. An event never reaches another instance, and each instance that boots restarts the active evented workflow runs of the others.
|
|
120
|
+
- `UnixSocketPubSub` reaches the other processes on the host, but no other process picks up the step of a process that stopped, and each process that boots restarts the active evented workflow runs of the others.
|
|
121
|
+
|
|
122
|
+
### Warning for unsupported setups
|
|
123
|
+
|
|
124
|
+
Mastra logs a warning the first time an evented run is created in a setup that can't support several processes:
|
|
125
|
+
|
|
126
|
+
- The PubSub backend delivers to other processes and doesn't redeliver unacknowledged events.
|
|
127
|
+
- The PubSub backend redelivers unacknowledged events and the storage adapter has no workflow step guards.
|
|
128
|
+
|
|
129
|
+
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.
|
|
130
|
+
|
|
131
|
+
If you see the warning with your own [`PubSub`](https://mastra.ai/reference/pubsub/base) implementation, override the properties that describe its transport. Mastra reads them instead of checking which class the backend is:
|
|
132
|
+
|
|
133
|
+
```typescript
|
|
134
|
+
import { PubSub } from '@mastra/core/events'
|
|
135
|
+
|
|
136
|
+
export class MyBrokerPubSub extends PubSub {
|
|
137
|
+
// The broker hands an unacknowledged event to another consumer in the group.
|
|
138
|
+
override get redeliversUnacked(): boolean {
|
|
139
|
+
return true
|
|
140
|
+
}
|
|
141
|
+
|
|
142
|
+
// publish(), subscribe(), unsubscribe(), flush()
|
|
143
|
+
}
|
|
144
|
+
```
|
|
145
|
+
|
|
146
|
+
Return `true` from `redeliversUnacked` only when the broker redelivers an abandoned event to another consumer of the same group, and only after 30 seconds or more. If your implementation delivers only inside the publishing process, return `false` from `deliversAcrossProcesses` instead. See the [`PubSub` properties](https://mastra.ai/reference/pubsub/base).
|
|
147
|
+
|
|
148
|
+
To disable the warning for a setup that one process uses, set the `MASTRA_DISABLE_EVENTED_SETUP_WARNING` environment variable to `true`.
|
|
149
|
+
|
|
107
150
|
## Resumable streams
|
|
108
151
|
|
|
109
152
|
Resumable streams let a client reconnect and replay events it missed, which requires the backend to keep recent history. Distributed backends such as [`RedisStreamsPubSub`](https://mastra.ai/reference/pubsub/redis-streams) persist events, so they support replay on their own.
|
|
@@ -31,6 +31,8 @@ Choose a backend based on where the processes run.
|
|
|
31
31
|
|
|
32
32
|
[`UnixSocketPubSub`](https://mastra.ai/reference/pubsub/unix-socket-pubsub) elects one process as the socket broker and re-elects a new one if it exits. It doesn't work across machines.
|
|
33
33
|
|
|
34
|
+
This table covers signal delivery and thread leases. Evented workflows and agents that run on several processes have stricter requirements, which `EventEmitterPubSub` and `UnixSocketPubSub` don't meet. See [evented workflows and agents](https://mastra.ai/docs/server/pubsub).
|
|
35
|
+
|
|
34
36
|
[`GoogleCloudPubSub`](https://mastra.ai/reference/pubsub/google-cloud-pubsub) delivers events across processes but doesn't implement leases. Mastra can't tell which instance owns a thread, so any instance receiving a signal can try to run it. Use it only when another layer guarantees one process per thread.
|
|
35
37
|
|
|
36
38
|
## Thread ownership and leases
|
|
@@ -504,7 +504,7 @@ While a run executes, Mastra holds a storage lease on it and renews it in the ba
|
|
|
504
504
|
|
|
505
505
|
`mastra.restartAllActiveWorkflowRuns()`, which the server calls on boot, restarts a default-engine run only once it stopped: no instance holds its lease, and neither the run nor its lease changed for `recovery.workflowGraceMs` (2 seconds by default). A run that's still running, or stopped more recently, is left to the [recovery loop](#recovery-loop).
|
|
506
506
|
|
|
507
|
-
Evented runs on a pubsub whose broker redelivers unacknowledged events
|
|
507
|
+
Evented runs on a pubsub whose broker redelivers unacknowledged events are left to the broker: when a worker stops mid-step, the broker redelivers the step's event to another worker, and booting instances don't restart the run. Scheduled runs are the exception, because their events stay in the process that fired them, so recovery restarts them. On any other pubsub, including the default in-process one, recovery restarts every active evented run at once. The in-process pubsub delivers events only inside one process, so running several instances on one storage with it isn't supported for evented workflows or agents. See [evented workflows and agents](https://mastra.ai/docs/server/pubsub) for the PubSub backends and storage adapters that support several instances.
|
|
508
508
|
|
|
509
509
|
A restarted run runs the interrupted step again, even if that step finished before the process stopped but its result wasn't saved. On the evented engine, a step that already saved its result doesn't run again when its event arrives late, for example after a broker redelivery or a `restart()` that ran while the step was saving its result. The run continues from the saved result instead. This needs a storage adapter with run-ownership support. Workflows that set `autoRestartActiveRuns: false`, including durable agent workflows, run the step again. Make steps with side effects idempotent, so a repeated step has no additional effect.
|
|
510
510
|
|
|
@@ -50,7 +50,7 @@ Declaring `schedule` doesn't change how the workflow runs. Scheduled fires run i
|
|
|
50
50
|
|
|
51
51
|
Split-worker deployments are the exception. When the [`MASTRA_WORKERS`](https://mastra.ai/reference/workers/overview) environment variable is set to any value, including `false`, `createWorkflow` builds scheduled workflows on the **evented execution engine** so that every process in the deployment runs them the same way. Scheduled fires then run on the [orchestration worker](https://mastra.ai/docs/deployment/workers), and Mastra logs a warning to the console when the workflow is created. The public API (`workflow.start()`, `workflow.startAsync()`, `resume()`) doesn't change.
|
|
52
52
|
|
|
53
|
-
Evented runs require a storage adapter that applies concurrent updates atomically, such as `@mastra/libsql` or `@mastra/pg`. With any other adapter, `createRun()` throws an error that lists the supported adapters.
|
|
53
|
+
Evented runs require a storage adapter that applies concurrent updates atomically, such as `@mastra/libsql` or `@mastra/pg`. With any other adapter, `createRun()` throws an error that lists the supported adapters. A split deployment also needs a PubSub backend that redelivers unacknowledged events and a storage adapter with workflow step guards. See [evented workflows and agents](https://mastra.ai/docs/server/pubsub).
|
|
54
54
|
|
|
55
55
|
Only the environment variable triggers the switch, because `createWorkflow` runs before `Mastra` reads its `workers` option. If you split workers with the `workers` option instead, import `createWorkflow` from `@mastra/core/workflows/evented` for your scheduled workflows.
|
|
56
56
|
|
|
@@ -58,7 +58,7 @@ Your server needs a public URL that Slack can reach for webhook delivery and OAu
|
|
|
58
58
|
|
|
59
59
|
1. Open [Slack apps](https://api.slack.com/apps), then open **Your App Configuration Tokens**.
|
|
60
60
|
|
|
61
|
-
2. Generate an app configuration token for the workspace where the agent will run.
|
|
61
|
+
2. Generate an app configuration token for the workspace where the agent will run. Slack shows an access token (`xoxe.xoxp-1-...`) that expires in 12 hours, followed by a refresh token (`xoxe-1-...`). Copy the refresh token. Mastra rotates it after you connect, so don't use it anywhere else.
|
|
62
62
|
|
|
63
63
|
3. Run `mastra connect add slack-channels` and complete the authorization flow. The platform stores and rotates the configuration credential.
|
|
64
64
|
|
|
@@ -79,10 +79,12 @@ Your server needs a public URL that Slack can reach for webhook delivery and OAu
|
|
|
79
79
|
|
|
80
80
|
5. Start your Mastra application.
|
|
81
81
|
|
|
82
|
-
6. In Studio, connect the Slack channel to an agent. Mastra creates a Slack app and returns an authorization URL. Open it, choose the workspace, and approve the bot scopes.
|
|
82
|
+
6. In Studio, connect the Slack channel to an agent. The Connect page on the Mastra platform only stores the connection, so you link it to an agent in Studio. Mastra creates a Slack app and returns an authorization URL. Open it, choose the workspace, and approve the bot scopes.
|
|
83
83
|
|
|
84
84
|
The [default Slack manifest](https://mastra.ai/reference/channels/slack-provider) lists the requested scopes and event subscriptions.
|
|
85
85
|
|
|
86
|
+
To let the agent post structured cards with tables, charts, and fields, see [Generative UI cards](https://mastra.ai/reference/agents/channels).
|
|
87
|
+
|
|
86
88
|
## Self-managed setup
|
|
87
89
|
|
|
88
90
|
Create a Slack app yourself and store its credentials in your Mastra environment. Use this path for agent chat when you want to control the Slack app directly.
|
|
@@ -20,6 +20,7 @@
|
|
|
20
20
|
- [Gmail](https://mastra.ai/integrations/email-calendar/google-mail)
|
|
21
21
|
- [Google Calendar](https://mastra.ai/integrations/email-calendar/google-calendar)
|
|
22
22
|
- [Microsoft Outlook](https://mastra.ai/integrations/email-calendar/outlook)
|
|
23
|
+
- [SendGrid](https://mastra.ai/integrations/email-calendar/sendgrid)
|
|
23
24
|
|
|
24
25
|
## Documents
|
|
25
26
|
|
|
@@ -129,8 +130,10 @@
|
|
|
129
130
|
|
|
130
131
|
## Tools
|
|
131
132
|
|
|
133
|
+
- [Anthropic](https://mastra.ai/integrations/tools/anthropic)
|
|
132
134
|
- [Bright Data](https://mastra.ai/integrations/tools/brightdata)
|
|
133
135
|
- [Firecrawl](https://mastra.ai/integrations/tools/firecrawl)
|
|
136
|
+
- [GitLab](https://mastra.ai/integrations/tools/gitlab)
|
|
134
137
|
- [Parallel](https://mastra.ai/integrations/tools/parallel)
|
|
135
138
|
- [Perplexity](https://mastra.ai/integrations/tools/perplexity)
|
|
136
139
|
- [Sanity Context](https://mastra.ai/integrations/tools/sanity-context)
|
|
@@ -223,7 +226,10 @@
|
|
|
223
226
|
## Other providers
|
|
224
227
|
|
|
225
228
|
- [Canva](https://mastra.ai/integrations/other/canva)
|
|
229
|
+
- [Cloudflare Workers](https://mastra.ai/integrations/other/cloudflare-workers)
|
|
230
|
+
- [Digits](https://mastra.ai/integrations/other/digits)
|
|
226
231
|
- [Fireflies.ai](https://mastra.ai/integrations/other/fireflies)
|
|
232
|
+
- [Google Analytics](https://mastra.ai/integrations/other/google-analytics)
|
|
227
233
|
- [incident.io](https://mastra.ai/integrations/other/incident-io)
|
|
228
234
|
- [Resend](https://mastra.ai/integrations/other/resend)
|
|
229
235
|
- [Robinhood](https://mastra.ai/integrations/other/robinhood)
|
|
@@ -432,6 +432,8 @@ const result = await agent.sendNotificationSignal(
|
|
|
432
432
|
|
|
433
433
|
**options.ifIdle** (`object`): Controls what happens when the target thread is idle.
|
|
434
434
|
|
|
435
|
+
**options.ifIdle.behavior** (`'wake' | 'persist' | 'discard'`): What to do when the notification signal reaches an idle thread. Defaults to wake. persist is stored on the record, so a deferred or summarized delivery also persists without waking the thread. A summary covering several records persists only when every record asked to persist.
|
|
436
|
+
|
|
435
437
|
**options.ifIdle.streamOptions** (`AgentExecutionOptions`): Options for the stream that starts when an immediate notification wakes an idle thread.
|
|
436
438
|
|
|
437
439
|
Returns `{ record: NotificationRecord, decision: NotificationDeliveryDecision, runId?: string, signal?: CreatedAgentSignal, persisted?: Promise<void>, accepted?: Promise<SendAgentSignalAccepted> }`. `record` is the stored inbox record. `decision` is the delivery-policy result. `signal` and `runId` are present when ingress emits a signal immediately, including the immediate summary emitted for active high-priority notifications. `persisted` is present when the emitted signal is persisted without waking an idle thread. `accepted` is present when a signal is emitted and resolves at decision-time, once Mastra decides what to do with it: `{ action: 'wake', runId, output }` when this process runs the agent (it started or won the lease to start the run), `{ action: 'deliver', runId }` when the signal is forwarded onto an existing run, or `{ action: 'persist' }` / `{ action: 'discard' }` when nothing ran. `runId` on the accepted result is present only on `wake` and `deliver`. On the `wake` action, `output` is the agent stream for in-process consumption.
|
|
@@ -601,7 +603,7 @@ Returns an `AgentThreadSubscription` object with these members:
|
|
|
601
603
|
|
|
602
604
|
**requestContextSchema** (`StandardJSONSchemaV1`): Standard JSON Schema for validating request context values. When provided, the context is validated at the start of generate() or stream(), throwing a MastraError if validation fails.
|
|
603
605
|
|
|
604
|
-
**durable** (`boolean | { pubsub?: PubSub; cache?: MastraServerCache | false; shouldCache?: (topic: string) => boolean; cleanupTimeoutMs?: number }`): Publishes
|
|
606
|
+
**durable** (`boolean | { pubsub?: PubSub; cache?: MastraServerCache | false; shouldCache?: (topic: string) => boolean; cleanupTimeoutMs?: number }`): Publishes run events for observe() and reconnecting clients. Set executionEngine to "default" or "evented" for checkpointed execution, or false for the plain loop. Explicit agent settings override Mastra.durable defaults, and the engine is fixed at registration or first execution. Pass durable: false to opt out of publication and inherited defaults. Native streams keep MastraModelOutput APIs. See Native agent execution.
|
|
605
607
|
|
|
606
608
|
**editor** (`false | { instructions?: boolean; tools?: boolean | { description?: boolean }; model?: boolean }`): Controls which fields the editor can override for this code-defined agent. Omit to allow editing instructions and tools. See Editor overrides below.
|
|
607
609
|
|
|
@@ -15,10 +15,10 @@ import { Agent } from '@mastra/core/agent'
|
|
|
15
15
|
import { createSlackAdapter } from '@chat-adapter/slack'
|
|
16
16
|
import { createDiscordAdapter } from '@chat-adapter/discord'
|
|
17
17
|
|
|
18
|
-
|
|
19
|
-
id: '
|
|
20
|
-
name: '
|
|
21
|
-
instructions: 'You are a helpful
|
|
18
|
+
const agent = new Agent({
|
|
19
|
+
id: 'channels-agent',
|
|
20
|
+
name: 'Channels Agent',
|
|
21
|
+
instructions: 'You are a helpful assistant.',
|
|
22
22
|
model: 'openai/gpt-6.1-sol',
|
|
23
23
|
channels: {
|
|
24
24
|
adapters: {
|
|
@@ -43,7 +43,7 @@ The `channels` property accepts a `ChannelConfig` object with the following fiel
|
|
|
43
43
|
|
|
44
44
|
**maxAttachmentStorageBytes** (`number`): Total size of attachments the agent may store under channel-attachments/ in its workspace. Binary attachments that need an authenticated download, such as Slack files, are saved there (up to 10 MiB each) so workspace tools can open them. When saving a file would go over this limit, the agent gets the attachment URL instead and nothing is written. (Default: `104857600 (100 MiB)`)
|
|
45
45
|
|
|
46
|
-
**tools** (`boolean`): Whether getTools() returns the channel-specific tools (add_reaction, remove_reaction). Set to false for models that do not support function calling. Channel tools are never added to the agent automatically — pass them explicitly via tools: { ...channels.getTools() }. They work on any run in a channel-backed thread, including runs that did not start from a chat message, such as a schedule or a Studio prompt. (Default: `true`)
|
|
46
|
+
**tools** (`boolean`): Whether getTools() returns the channel-specific tools (add_reaction, remove_reaction). Set to false for models that do not support function calling. Channel tools are never added to the agent automatically — pass them explicitly via tools: { ...channels.getTools() }. For tools that read and post messages, see Channel tools. They work on any run in a channel-backed thread, including runs that did not start from a chat message, such as a schedule or a Studio prompt. (Default: `true`)
|
|
47
47
|
|
|
48
48
|
**state** (`StateAdapter`): State adapter for subscriptions and deduplication. Defaults to MastraStateAdapter backed by the Mastra instance storage. Channels require storage to be configured. (Default: `MastraStateAdapter (from Mastra storage)`)
|
|
49
49
|
|
|
@@ -236,7 +236,7 @@ const agent = new Agent({
|
|
|
236
236
|
|
|
237
237
|
> **Experimental:** `generativeUI` is experimental and may change in a minor release.
|
|
238
238
|
|
|
239
|
-
Set `generativeUI: true` on
|
|
239
|
+
Set `generativeUI: true` on Slack to let the agent post structured cards (status summaries, key/value fields, tables, charts, images, and link buttons) instead of long markdown replies. Install the optional peer first:
|
|
240
240
|
|
|
241
241
|
**npm**:
|
|
242
242
|
|
|
@@ -266,24 +266,46 @@ bun add @json-render/chat
|
|
|
266
266
|
|
|
267
267
|
`@mastra/core` loads `@json-render/chat` at runtime, so `mastra build` and `mastra deploy` don't pick it up on their own. Add it to [`bundler.dynamicPackages`](https://mastra.ai/reference/core/mastra-class) so it's included in the build output:
|
|
268
268
|
|
|
269
|
+
```typescript
|
|
270
|
+
export const mastra = new Mastra({
|
|
271
|
+
// ...
|
|
272
|
+
bundler: { dynamicPackages: ['@json-render/chat'] },
|
|
273
|
+
})
|
|
274
|
+
```
|
|
275
|
+
|
|
276
|
+
Runs on Slack then get a `render_card` tool. The tool call itself isn't rendered as a tool card.
|
|
277
|
+
|
|
278
|
+
### Enable with Mastra Connect
|
|
279
|
+
|
|
280
|
+
When Slack chat runs through [Mastra Connect](https://mastra.ai/integrations/channels/slack), set `generativeUI` in the Slack provider options. `channels()` forwards `providerOptions` to [`SlackProvider`](https://mastra.ai/reference/channels/slack-provider):
|
|
281
|
+
|
|
269
282
|
```typescript
|
|
270
283
|
import { Mastra } from '@mastra/core'
|
|
271
|
-
import {
|
|
284
|
+
import { channels } from '@mastra/connect'
|
|
272
285
|
|
|
273
286
|
export const mastra = new Mastra({
|
|
274
|
-
|
|
287
|
+
// ...
|
|
288
|
+
channels: await channels({
|
|
289
|
+
providers: { slack: { providerOptions: { generativeUI: true } } },
|
|
290
|
+
}),
|
|
275
291
|
bundler: { dynamicPackages: ['@json-render/chat'] },
|
|
276
292
|
})
|
|
277
293
|
```
|
|
278
294
|
|
|
295
|
+
The agent doesn't need `channels.adapters`. Connect the Slack channel to the agent in Studio.
|
|
296
|
+
|
|
297
|
+
### Enable with `createSlackAdapter()`
|
|
298
|
+
|
|
299
|
+
When you manage your own Slack app with the [self-managed setup](https://mastra.ai/integrations/channels/slack), set `generativeUI` on the agent's Slack adapter instead:
|
|
300
|
+
|
|
279
301
|
```typescript
|
|
280
302
|
import { Agent } from '@mastra/core/agent'
|
|
281
303
|
import { createSlackAdapter } from '@chat-adapter/slack'
|
|
282
304
|
|
|
283
|
-
|
|
284
|
-
id: '
|
|
285
|
-
name: '
|
|
286
|
-
instructions: '
|
|
305
|
+
const agent = new Agent({
|
|
306
|
+
id: 'generative-ui-agent',
|
|
307
|
+
name: 'Generative UI Agent',
|
|
308
|
+
instructions: '...',
|
|
287
309
|
model: 'openai/gpt-6.1-sol',
|
|
288
310
|
channels: {
|
|
289
311
|
adapters: {
|
|
@@ -293,21 +315,54 @@ export const supportAgent = new Agent({
|
|
|
293
315
|
})
|
|
294
316
|
```
|
|
295
317
|
|
|
296
|
-
|
|
318
|
+
### Card spec
|
|
297
319
|
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
}
|
|
320
|
+
The agent passes `render_card` a [json-render](https://json-render.dev/docs) spec. See the json-render docs for the spec format and components. Image URLs, including a `Card` `imageUrl`, must be public HTTPS images that Slack can fetch.
|
|
321
|
+
|
|
322
|
+
The tool returns `{ ok: true, messageId }` once the card is posted. When the spec is invalid or exceeds the [Slack limits](#slack-card-limits), it returns `{ ok: false, issues }` without posting, so the agent can fix the spec and call it again. When Slack rejects the post, it returns `{ ok: false, error }`.
|
|
323
|
+
|
|
324
|
+
### Agent instructions
|
|
325
|
+
|
|
326
|
+
A generic prompt usually produces only a basic table or chart. Name the components the agent should use and when to use them. When `render_card` returns issues, agents also tend to simplify the card by dropping images or fields instead of fixing the spec, so tell the agent to keep every component:
|
|
327
|
+
|
|
328
|
+
```typescript
|
|
329
|
+
import { Agent } from '@mastra/core/agent'
|
|
330
|
+
|
|
331
|
+
const agent = new Agent({
|
|
332
|
+
id: 'generative-ui-agent',
|
|
333
|
+
name: 'Generative UI Agent',
|
|
334
|
+
instructions: `You are a support assistant for an internal deploy service.
|
|
335
|
+
|
|
336
|
+
Use render_card for status updates and reports. Start each card with a Card that has a title.
|
|
337
|
+
- Use Fields and Field for key facts such as environment, version, and owner.
|
|
338
|
+
- Use a Table for lists of items and a Chart for trends over time.
|
|
339
|
+
- Use an Image only when you have a public HTTPS image URL.
|
|
340
|
+
- Put links to dashboards or logs in LinkButton elements inside Actions.
|
|
341
|
+
|
|
342
|
+
If render_card returns issues, fix the spec and call it again. Keep every component you planned, including images and fields. Don't remove content to make the card pass.`,
|
|
343
|
+
model: 'openai/gpt-6.1-sol',
|
|
344
|
+
})
|
|
308
345
|
```
|
|
309
346
|
|
|
310
|
-
|
|
347
|
+
### How cards look in Slack
|
|
348
|
+
|
|
349
|
+
`@chat-adapter/slack` renders a `Card` as a header block and a context block, followed by the blocks for its children. It doesn't use Slack's [card block](https://docs.slack.dev/reference/block-kit/blocks/card-block), so the card has no visible container or border around it.
|
|
350
|
+
|
|
351
|
+
### Slack card limits
|
|
352
|
+
|
|
353
|
+
`render_card` checks these limits before posting. The Slack adapter would otherwise turn an oversized chart or table into plain text.
|
|
354
|
+
|
|
355
|
+
| Element | Limit per card |
|
|
356
|
+
| ------- | ------------------------------------------------------------------------------------------------------------------------------------------------------- |
|
|
357
|
+
| Table | 1 table, up to 100 rows, 20 columns, and 10,000 characters of cell text |
|
|
358
|
+
| Fields | 10 `Field` elements per `Fields` group |
|
|
359
|
+
| Chart | 2 charts, each with up to 20 points and 12 series. Titles and axis labels up to 50 characters. Category and series names up to 20 characters and unique |
|
|
360
|
+
|
|
361
|
+
### Not supported yet
|
|
362
|
+
|
|
363
|
+
- Interactive `Button` elements. Cards can only link out with `LinkButton`.
|
|
364
|
+
- Streaming cards. A card is posted once, after the agent calls `render_card`.
|
|
365
|
+
- Adapters other than Slack. `generativeUI` is ignored on them.
|
|
311
366
|
|
|
312
367
|
## Custom typing status
|
|
313
368
|
|
|
@@ -341,6 +396,23 @@ const agent = new Agent({
|
|
|
341
396
|
})
|
|
342
397
|
```
|
|
343
398
|
|
|
399
|
+
With [Mastra Connect](https://mastra.ai/integrations/channels/slack), pass the function in the Slack provider options:
|
|
400
|
+
|
|
401
|
+
```typescript
|
|
402
|
+
import type { TypingStatusFn } from '@mastra/core/channels'
|
|
403
|
+
|
|
404
|
+
const typingStatus: TypingStatusFn = (chunk, ctx) => {
|
|
405
|
+
// ...
|
|
406
|
+
}
|
|
407
|
+
|
|
408
|
+
export const mastra = new Mastra({
|
|
409
|
+
// ...
|
|
410
|
+
channels: await channels({
|
|
411
|
+
providers: { slack: { providerOptions: { typingStatus } } },
|
|
412
|
+
}),
|
|
413
|
+
})
|
|
414
|
+
```
|
|
415
|
+
|
|
344
416
|
## Handlers
|
|
345
417
|
|
|
346
418
|
Override built-in event handlers. Each handler can be:
|
|
@@ -374,6 +446,23 @@ const agent = new Agent({
|
|
|
374
446
|
})
|
|
375
447
|
```
|
|
376
448
|
|
|
449
|
+
With [Mastra Connect](https://mastra.ai/integrations/channels/slack), pass `handlers` in the Slack provider options instead. They apply to every agent connected to Slack:
|
|
450
|
+
|
|
451
|
+
```typescript
|
|
452
|
+
import type { ChannelHandlers } from '@mastra/core/channels'
|
|
453
|
+
|
|
454
|
+
const handlers: ChannelHandlers = {
|
|
455
|
+
// ...
|
|
456
|
+
}
|
|
457
|
+
|
|
458
|
+
export const mastra = new Mastra({
|
|
459
|
+
// ...
|
|
460
|
+
channels: await channels({
|
|
461
|
+
providers: { slack: { providerOptions: { handlers } } },
|
|
462
|
+
}),
|
|
463
|
+
})
|
|
464
|
+
```
|
|
465
|
+
|
|
377
466
|
**onDirectMessage** (`ChannelHandler | false`): Called when the bot receives a direct message.
|
|
378
467
|
|
|
379
468
|
**onMention** (`ChannelHandler | false`): Called when the bot is @mentioned in a channel or thread.
|
|
@@ -596,6 +685,39 @@ Extra log arguments become fields on the record:
|
|
|
596
685
|
|
|
597
686
|
An `Error` passed directly or under an object's `error` key is normalized so it keeps its message and stack when serialized.
|
|
598
687
|
|
|
688
|
+
## Channel tools
|
|
689
|
+
|
|
690
|
+
`createChannelTools()` from `@mastra/core/channels` returns tools that read and post in the agent's chat platforms through the Chat SDK: `fetchMessages`, `fetchChannelMessages`, `fetchThread`, `listThreads`, `getThreadParticipants`, `getChannelInfo`, `postMessage` and `postChannelMessage`, plus `sendDirectMessage` when `directMessages` is `'anyone'`. Nothing is added to the agent for you. Spread the tools into `tools`:
|
|
691
|
+
|
|
692
|
+
```typescript
|
|
693
|
+
import { Agent } from '@mastra/core/agent'
|
|
694
|
+
import { createChannelTools } from '@mastra/core/channels'
|
|
695
|
+
import { createSlackAdapter } from '@chat-adapter/slack'
|
|
696
|
+
|
|
697
|
+
const agent = new Agent({
|
|
698
|
+
id: 'channel-tools-agent',
|
|
699
|
+
name: 'Channel Tools Agent',
|
|
700
|
+
instructions: 'You are a helpful assistant.',
|
|
701
|
+
model: 'openai/gpt-6.1-sol',
|
|
702
|
+
tools: {
|
|
703
|
+
...(await createChannelTools({ channels: 'selected', channelIds: ['slack:C0123ABC'] })),
|
|
704
|
+
},
|
|
705
|
+
channels: { adapters: { slack: createSlackAdapter() } },
|
|
706
|
+
})
|
|
707
|
+
```
|
|
708
|
+
|
|
709
|
+
Each call works out the channel thread of the run that makes it, the same way `add_reaction` does, so the tools also work on schedules and Studio prompts in a channel-backed thread. A call outside a channel-backed run fails with an error. The tools post without asking for approval. The tools require zod 4.2 or newer.
|
|
710
|
+
|
|
711
|
+
**channels** (`'session' | 'selected' | 'all'`): Which channels the tools may read and post in: only the conversation's own channel, that channel plus channelIds, or any channel the bot is a member of. (Default: `'session'`)
|
|
712
|
+
|
|
713
|
+
**channelIds** (`string[]`): Full channel ids, such as 'slack:C0123ABC', the tools may use when channels is 'selected'. createChannelTools() throws on ids without a platform prefix. (Default: `[]`)
|
|
714
|
+
|
|
715
|
+
**access** (`'read' | 'post'`): With 'read', the tools read every allowed channel but post only in the conversation's own channel. sendDirectMessage is refused. (Default: `'post'`)
|
|
716
|
+
|
|
717
|
+
**directMessages** (`'none' | 'anyone'`): With 'anyone', adds sendDirectMessage. Other people's direct messages with the bot, including group DMs, can never be read, whatever the other options grant. (Default: `'none'`)
|
|
718
|
+
|
|
719
|
+
**scope** (`ChannelToolScope`): A fixed conversation for every call, built with createChannelToolScope(). Its settings replace the options above. Use it when you build tools for one conversation yourself instead of resolving the run.
|
|
720
|
+
|
|
599
721
|
## Related
|
|
600
722
|
|
|
601
723
|
- [Channels overview](https://mastra.ai/docs/channels): Concepts, quickstart, and platform setup
|
|
@@ -41,9 +41,33 @@ const text = await output.text
|
|
|
41
41
|
cleanup()
|
|
42
42
|
```
|
|
43
43
|
|
|
44
|
-
###
|
|
44
|
+
### Native agent execution
|
|
45
45
|
|
|
46
|
-
|
|
46
|
+
Set `durable.executionEngine` on an `Agent` to enable checkpointed execution without wrapping it:
|
|
47
|
+
|
|
48
|
+
```typescript
|
|
49
|
+
import { Agent, type AgentStreamOutput } from '@mastra/core/agent'
|
|
50
|
+
|
|
51
|
+
const agent = new Agent({
|
|
52
|
+
id: 'support',
|
|
53
|
+
name: 'Support agent',
|
|
54
|
+
instructions: 'Help customers with their orders.',
|
|
55
|
+
model: 'openai/gpt-6.1-sol',
|
|
56
|
+
durable: { executionEngine: 'default' },
|
|
57
|
+
})
|
|
58
|
+
|
|
59
|
+
const output: AgentStreamOutput = await agent.stream('Where is my order?')
|
|
60
|
+
console.log(await output.text)
|
|
61
|
+
output.cleanup?.()
|
|
62
|
+
```
|
|
63
|
+
|
|
64
|
+
Both engines checkpoint each step. Use `'default'` to run on the default in-process engine, `'evented'` to run on workers over pubsub, or `false` for the plain agent loop, which doesn't checkpoint. Evented execution falls back to in-process durable execution when the agent has no Mastra host, or when the host's workflows store doesn't support concurrent updates. A host with no workflows store keeps evented execution.
|
|
65
|
+
|
|
66
|
+
Set `Mastra.durable.executionEngine` to provide a default for agents registered through `agents` or `addAgent()`. An agent's explicit setting takes precedence. The engine selection is fixed at registration or first execution, carries over to editor forks, and remains unchanged when the agent is wrapped.
|
|
67
|
+
|
|
68
|
+
Native `stream()` and `resumeStream()` return `MastraModelOutput`. When durable execution is selected, the output also carries `abort()`, `cleanup()`, `threadId`, and `resourceId`. Type it as `AgentStreamOutput` to access them. `generate()` keeps its usual result shape. The wrapper factories keep returning `DurableAgentStreamResult`, whose model output is in `.output`.
|
|
69
|
+
|
|
70
|
+
`durable: true` enables resumable-stream publication and inherits any Mastra execution default. `durable: false` opts out of both publication and inherited execution defaults. Without a Mastra execution default, neither boolean form enables checkpoint execution. Set `executionEngine` explicitly to select an execution backend. Configure `shouldPersistSnapshot` alongside it to control snapshot persistence.
|
|
47
71
|
|
|
48
72
|
## `createDurableAgent(options)`
|
|
49
73
|
|
|
@@ -81,6 +105,8 @@ Returns: `DurableAgent`
|
|
|
81
105
|
|
|
82
106
|
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.
|
|
83
107
|
|
|
108
|
+
An evented agent runs in one process on any PubSub backend. Running its steps on several processes needs a backend that redelivers unacknowledged events and a storage adapter with workflow step guards. See [evented workflows and agents](https://mastra.ai/docs/server/pubsub).
|
|
109
|
+
|
|
84
110
|
```typescript
|
|
85
111
|
import { createEventedAgent } from '@mastra/core/agent/durable'
|
|
86
112
|
|