@mastra/core 1.0.0-beta.21 → 1.0.0-beta.22
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +356 -0
- package/dist/action/index.d.ts +7 -7
- package/dist/action/index.d.ts.map +1 -1
- package/dist/agent/agent-legacy.d.ts.map +1 -1
- package/dist/agent/agent.d.ts +100 -18
- package/dist/agent/agent.d.ts.map +1 -1
- package/dist/agent/agent.types.d.ts +22 -18
- package/dist/agent/agent.types.d.ts.map +1 -1
- package/dist/agent/index.cjs +13 -13
- package/dist/agent/index.d.ts +1 -1
- package/dist/agent/index.d.ts.map +1 -1
- package/dist/agent/index.js +2 -2
- package/dist/agent/message-list/adapters/AIV4Adapter.d.ts.map +1 -1
- package/dist/agent/message-list/index.cjs +18 -18
- package/dist/agent/message-list/index.js +1 -1
- package/dist/agent/message-list/message-list.d.ts +2 -1
- package/dist/agent/message-list/message-list.d.ts.map +1 -1
- package/dist/agent/trip-wire.d.ts +1 -2
- package/dist/agent/trip-wire.d.ts.map +1 -1
- package/dist/agent/types.d.ts +9 -10
- package/dist/agent/types.d.ts.map +1 -1
- package/dist/agent/utils.d.ts +7 -42
- package/dist/agent/utils.d.ts.map +1 -1
- package/dist/agent/workflows/prepare-stream/index.d.ts +6 -118
- package/dist/agent/workflows/prepare-stream/index.d.ts.map +1 -1
- package/dist/agent/workflows/prepare-stream/map-results-step.d.ts +7 -11
- package/dist/agent/workflows/prepare-stream/map-results-step.d.ts.map +1 -1
- package/dist/agent/workflows/prepare-stream/prepare-memory-step.d.ts +4 -68
- package/dist/agent/workflows/prepare-stream/prepare-memory-step.d.ts.map +1 -1
- package/dist/agent/workflows/prepare-stream/prepare-tools-step.d.ts +3 -45
- package/dist/agent/workflows/prepare-stream/prepare-tools-step.d.ts.map +1 -1
- package/dist/agent/workflows/prepare-stream/schema.d.ts +10 -10
- package/dist/agent/workflows/prepare-stream/stream-step.d.ts +2 -8
- package/dist/agent/workflows/prepare-stream/stream-step.d.ts.map +1 -1
- package/dist/{chunk-HJXEZSNI.js → chunk-3XY64RAM.js} +5 -5
- package/dist/{chunk-HJXEZSNI.js.map → chunk-3XY64RAM.js.map} +1 -1
- package/dist/{chunk-XSJNTLM7.js → chunk-453NPBJ7.js} +479 -47
- package/dist/chunk-453NPBJ7.js.map +1 -0
- package/dist/{chunk-3CZ42NBZ.js → chunk-5UVSKF5L.js} +17 -14
- package/dist/chunk-5UVSKF5L.js.map +1 -0
- package/dist/{chunk-XKDVT3ZH.cjs → chunk-67ZKOPA4.cjs} +480 -48
- package/dist/chunk-67ZKOPA4.cjs.map +1 -0
- package/dist/{chunk-YLP5IWH2.js → chunk-7IYWOBLG.js} +4 -4
- package/dist/{chunk-YLP5IWH2.js.map → chunk-7IYWOBLG.js.map} +1 -1
- package/dist/{chunk-3RCMDLCG.cjs → chunk-ALQFYWAR.cjs} +12 -12
- package/dist/{chunk-3RCMDLCG.cjs.map → chunk-ALQFYWAR.cjs.map} +1 -1
- package/dist/{chunk-PC3FBUWH.js → chunk-C4CIC3LZ.js} +2 -2
- package/dist/chunk-C4CIC3LZ.js.map +1 -0
- package/dist/{chunk-7JGQWNV5.js → chunk-CPLRD2VP.js} +3 -3
- package/dist/{chunk-7JGQWNV5.js.map → chunk-CPLRD2VP.js.map} +1 -1
- package/dist/{chunk-AHN7K3VE.js → chunk-CQ2E577C.js} +5 -5
- package/dist/chunk-CQ2E577C.js.map +1 -0
- package/dist/{chunk-A4MCHA5L.cjs → chunk-CVLIEFWM.cjs} +100 -819
- package/dist/chunk-CVLIEFWM.cjs.map +1 -0
- package/dist/{chunk-XBZWAUZ3.js → chunk-IFPQ2MLB.js} +25 -12
- package/dist/chunk-IFPQ2MLB.js.map +1 -0
- package/dist/{chunk-DVJZZAZA.cjs → chunk-IHD36QFA.cjs} +7 -7
- package/dist/{chunk-DVJZZAZA.cjs.map → chunk-IHD36QFA.cjs.map} +1 -1
- package/dist/{chunk-WMJEP45F.cjs → chunk-J4KVR4DZ.cjs} +25 -18
- package/dist/chunk-J4KVR4DZ.cjs.map +1 -0
- package/dist/{chunk-3RFSIHFR.js → chunk-K2LPTKSY.js} +4 -720
- package/dist/chunk-K2LPTKSY.js.map +1 -0
- package/dist/{chunk-FY3PYSMK.cjs → chunk-KHO4KFXW.cjs} +5 -5
- package/dist/{chunk-FY3PYSMK.cjs.map → chunk-KHO4KFXW.cjs.map} +1 -1
- package/dist/{chunk-W7R7GPNN.cjs → chunk-MGPIVG2O.cjs} +9 -9
- package/dist/chunk-MGPIVG2O.cjs.map +1 -0
- package/dist/{chunk-KGE3KAM7.js → chunk-N3PAHTKU.js} +23 -3
- package/dist/chunk-N3PAHTKU.js.map +1 -0
- package/dist/{chunk-O4H44CMA.js → chunk-N7TDP7ZE.js} +586 -117
- package/dist/chunk-N7TDP7ZE.js.map +1 -0
- package/dist/{chunk-I5GMA5UM.cjs → chunk-NPIYNC5A.cjs} +9 -9
- package/dist/{chunk-I5GMA5UM.cjs.map → chunk-NPIYNC5A.cjs.map} +1 -1
- package/dist/{chunk-AW7FISLD.cjs → chunk-OZ75PBBK.cjs} +27 -7
- package/dist/chunk-OZ75PBBK.cjs.map +1 -0
- package/dist/{chunk-JMAPJWVG.cjs → chunk-OZCUIZRA.cjs} +2021 -1426
- package/dist/chunk-OZCUIZRA.cjs.map +1 -0
- package/dist/{chunk-6OPEMI2Q.cjs → chunk-PM3UIIBK.cjs} +2 -3
- package/dist/{chunk-6OPEMI2Q.cjs.map → chunk-PM3UIIBK.cjs.map} +1 -1
- package/dist/{chunk-CISH55FP.js → chunk-PSIJ6OSV.js} +16 -9
- package/dist/chunk-PSIJ6OSV.js.map +1 -0
- package/dist/{chunk-UOZ3GJY2.cjs → chunk-PTK74KG4.cjs} +2 -2
- package/dist/chunk-PTK74KG4.cjs.map +1 -0
- package/dist/{chunk-O5IPTMEH.cjs → chunk-Q5QQDMSD.cjs} +32 -29
- package/dist/chunk-Q5QQDMSD.cjs.map +1 -0
- package/dist/{chunk-UVHSM2GU.cjs → chunk-SMM2C4KH.cjs} +6 -4
- package/dist/chunk-SMM2C4KH.cjs.map +1 -0
- package/dist/{chunk-UXLQEGIN.cjs → chunk-SVPXZEU7.cjs} +35 -22
- package/dist/chunk-SVPXZEU7.cjs.map +1 -0
- package/dist/{chunk-SOSXN7X4.cjs → chunk-TU6MNGBB.cjs} +619 -151
- package/dist/chunk-TU6MNGBB.cjs.map +1 -0
- package/dist/{chunk-EK7E4ETB.js → chunk-TX5GUG5Q.js} +3 -3
- package/dist/{chunk-EK7E4ETB.js.map → chunk-TX5GUG5Q.js.map} +1 -1
- package/dist/{chunk-SQ7T6FWC.cjs → chunk-UAH236P2.cjs} +13 -13
- package/dist/{chunk-SQ7T6FWC.cjs.map → chunk-UAH236P2.cjs.map} +1 -1
- package/dist/{chunk-AIJ6HPJG.js → chunk-UL7TJCKA.js} +4 -4
- package/dist/{chunk-AIJ6HPJG.js.map → chunk-UL7TJCKA.js.map} +1 -1
- package/dist/{chunk-IC2MIQBW.js → chunk-UVOQLIWL.js} +1922 -1326
- package/dist/chunk-UVOQLIWL.js.map +1 -0
- package/dist/{chunk-IMLORTHO.js → chunk-WANKWENG.js} +5 -5
- package/dist/{chunk-IMLORTHO.js.map → chunk-WANKWENG.js.map} +1 -1
- package/dist/{chunk-ICU4Z5MO.cjs → chunk-X7DR353F.cjs} +8 -8
- package/dist/{chunk-ICU4Z5MO.cjs.map → chunk-X7DR353F.cjs.map} +1 -1
- package/dist/{chunk-6TBWJV35.js → chunk-Y22QMA7S.js} +6 -4
- package/dist/chunk-Y22QMA7S.js.map +1 -0
- package/dist/{chunk-FT7DFPAL.js → chunk-YYNZEEOO.js} +5 -5
- package/dist/{chunk-FT7DFPAL.js.map → chunk-YYNZEEOO.js.map} +1 -1
- package/dist/di/index.cjs +4 -4
- package/dist/di/index.js +1 -1
- package/dist/docs/README.md +6 -5
- package/dist/docs/SKILL.md +6 -5
- package/dist/docs/SOURCE_MAP.json +288 -293
- package/dist/docs/agents/01-overview.md +2 -2
- package/dist/docs/agents/02-using-tools.md +5 -0
- package/dist/docs/agents/04-structured-output.md +24 -4
- package/dist/docs/agents/06-processors.md +65 -1
- package/dist/docs/agents/08-agent-approval.md +5 -6
- package/dist/docs/agents/09-network-approval.md +274 -0
- package/dist/docs/agents/{10-reference.md → 11-reference.md} +1 -1
- package/dist/docs/ai-sdk/01-reference.md +1 -1
- package/dist/docs/cli/01-reference.md +1 -1
- package/dist/docs/client-js/01-reference.md +10 -5
- package/dist/docs/configuration.mdx/01-reference.md +750 -0
- package/dist/docs/core/01-reference.md +9 -35
- package/dist/docs/deployer/01-reference.md +19 -6
- package/dist/docs/evals/01-overview.md +5 -5
- package/dist/docs/evals/02-custom-scorers.md +49 -6
- package/dist/docs/evals/04-reference.md +10 -4
- package/dist/docs/mcp/01-overview.md +26 -16
- package/dist/docs/mcp/02-publishing-mcp-server.md +2 -2
- package/dist/docs/memory/01-overview.md +2 -2
- package/dist/docs/memory/02-storage.md +59 -25
- package/dist/docs/memory/03-working-memory.md +10 -6
- package/dist/docs/memory/04-semantic-recall.md +2 -4
- package/dist/docs/memory/05-memory-processors.md +2 -3
- package/dist/docs/memory/06-reference.md +2 -4
- package/dist/docs/observability/01-overview.md +1 -1
- package/dist/docs/observability/02-logging.md +4 -5
- package/dist/docs/observability/03-overview.md +69 -13
- package/dist/docs/observability/09-datadog.md +169 -0
- package/dist/docs/observability/10-laminar.md +95 -0
- package/dist/docs/observability/{11-otel.md → 13-otel.md} +12 -7
- package/dist/docs/observability/{13-reference.md → 15-reference.md} +125 -1
- package/dist/docs/processors/01-reference.md +23 -0
- package/dist/docs/rag/01-overview.md +1 -1
- package/dist/docs/rag/02-chunking-and-embedding.md +0 -1
- package/dist/docs/rag/03-vector-databases.md +10 -5
- package/dist/docs/rag/04-retrieval.md +5 -6
- package/dist/docs/rag/06-reference.md +4 -5
- package/dist/docs/server/01-mastra-server.md +32 -49
- package/dist/docs/server/02-custom-adapters.md +5 -2
- package/dist/docs/server/04-request-context.md +50 -11
- package/dist/docs/server/05-custom-api-routes.md +1 -1
- package/dist/docs/server/06-mastra-client.md +2 -2
- package/dist/docs/storage/01-reference.md +99 -23
- package/dist/docs/streaming/04-reference.md +6 -1
- package/dist/docs/tools/01-reference.md +380 -25
- package/dist/docs/tools-mcp/01-mcp-overview.md +10 -2
- package/dist/docs/tools-mcp/02-overview.md +4 -4
- package/dist/docs/vectors/01-reference.md +24 -11
- package/dist/docs/voice/01-overview.md +2 -2
- package/dist/docs/voice/05-reference.md +2 -2
- package/dist/docs/workflows/01-overview.md +5 -5
- package/dist/docs/workflows/04-agents-and-tools.md +4 -6
- package/dist/docs/workflows/06-suspend-and-resume.md +5 -7
- package/dist/docs/workflows/11-reference.md +1 -91
- package/dist/evals/base.d.ts.map +1 -1
- package/dist/evals/index.cjs +20 -20
- package/dist/evals/index.js +3 -3
- package/dist/evals/scoreTraces/index.cjs +5 -5
- package/dist/evals/scoreTraces/index.js +2 -2
- package/dist/evals/scoreTraces/scoreTracesWorkflow.d.ts +4 -67
- package/dist/evals/scoreTraces/scoreTracesWorkflow.d.ts.map +1 -1
- package/dist/index.cjs +2 -2
- package/dist/index.js +1 -1
- package/dist/integration/index.cjs +2 -2
- package/dist/integration/index.js +1 -1
- package/dist/llm/index.cjs +9 -9
- package/dist/llm/index.js +2 -2
- package/dist/llm/model/model.loop.d.ts +1 -2
- package/dist/llm/model/model.loop.d.ts.map +1 -1
- package/dist/llm/model/model.loop.types.d.ts +1 -2
- package/dist/llm/model/model.loop.types.d.ts.map +1 -1
- package/dist/llm/model/provider-types.generated.d.ts +224 -18
- package/dist/loop/index.cjs +12 -12
- package/dist/loop/index.js +1 -1
- package/dist/loop/loop.d.ts +1 -2
- package/dist/loop/loop.d.ts.map +1 -1
- package/dist/loop/network/index.d.ts +21 -80
- package/dist/loop/network/index.d.ts.map +1 -1
- package/dist/loop/network/run-command-tool.d.ts +14 -11
- package/dist/loop/network/run-command-tool.d.ts.map +1 -1
- package/dist/loop/network/validation.d.ts +3 -4
- package/dist/loop/network/validation.d.ts.map +1 -1
- package/dist/loop/test-utils/options.d.ts.map +1 -1
- package/dist/loop/types.d.ts +4 -5
- package/dist/loop/types.d.ts.map +1 -1
- package/dist/loop/workflows/agentic-execution/index.d.ts +31 -804
- package/dist/loop/workflows/agentic-execution/index.d.ts.map +1 -1
- package/dist/loop/workflows/agentic-execution/llm-execution-step.d.ts +22 -539
- package/dist/loop/workflows/agentic-execution/llm-execution-step.d.ts.map +1 -1
- package/dist/loop/workflows/agentic-execution/llm-mapping-step.d.ts +13 -294
- package/dist/loop/workflows/agentic-execution/llm-mapping-step.d.ts.map +1 -1
- package/dist/loop/workflows/agentic-execution/tool-call-step.d.ts +2 -41
- package/dist/loop/workflows/agentic-execution/tool-call-step.d.ts.map +1 -1
- package/dist/loop/workflows/agentic-loop/index.d.ts +32 -805
- package/dist/loop/workflows/agentic-loop/index.d.ts.map +1 -1
- package/dist/loop/workflows/schema.d.ts +90 -91
- package/dist/loop/workflows/schema.d.ts.map +1 -1
- package/dist/loop/workflows/stream.d.ts +1 -2
- package/dist/loop/workflows/stream.d.ts.map +1 -1
- package/dist/mastra/index.cjs +2 -2
- package/dist/mastra/index.d.ts +28 -9
- package/dist/mastra/index.d.ts.map +1 -1
- package/dist/mastra/index.js +1 -1
- package/dist/memory/index.cjs +11 -11
- package/dist/memory/index.js +1 -1
- package/dist/memory/memory.d.ts +4 -2
- package/dist/memory/memory.d.ts.map +1 -1
- package/dist/observability/index.cjs +11 -11
- package/dist/observability/index.js +1 -1
- package/dist/observability/types/tracing.d.ts +45 -7
- package/dist/observability/types/tracing.d.ts.map +1 -1
- package/dist/processors/index.cjs +38 -38
- package/dist/processors/index.d.ts +3 -3
- package/dist/processors/index.d.ts.map +1 -1
- package/dist/processors/index.js +1 -1
- package/dist/processors/memory/semantic-recall.d.ts +2 -0
- package/dist/processors/memory/semantic-recall.d.ts.map +1 -1
- package/dist/processors/processors/structured-output.d.ts +2 -2
- package/dist/processors/processors/structured-output.d.ts.map +1 -1
- package/dist/processors/processors/token-limiter.d.ts +16 -10
- package/dist/processors/processors/token-limiter.d.ts.map +1 -1
- package/dist/processors/runner.d.ts +4 -4
- package/dist/processors/runner.d.ts.map +1 -1
- package/dist/processors/step-schema.d.ts +66 -67
- package/dist/processors/step-schema.d.ts.map +1 -1
- package/dist/provider-registry-C3IAGLLU.js +3 -0
- package/dist/{provider-registry-6DWM3X3I.js.map → provider-registry-C3IAGLLU.js.map} +1 -1
- package/dist/provider-registry-YH4FCTT2.cjs +40 -0
- package/dist/{provider-registry-DCECMUCQ.cjs.map → provider-registry-YH4FCTT2.cjs.map} +1 -1
- package/dist/provider-registry.json +477 -45
- package/dist/relevance/index.cjs +3 -3
- package/dist/relevance/index.js +1 -1
- package/dist/request-context/index.cjs +4 -4
- package/dist/request-context/index.d.ts +10 -9
- package/dist/request-context/index.d.ts.map +1 -1
- package/dist/request-context/index.js +1 -1
- package/dist/server/types.d.ts +1 -1
- package/dist/storage/constants.cjs +14 -14
- package/dist/storage/constants.d.ts +1 -1
- package/dist/storage/constants.js +1 -1
- package/dist/storage/domains/observability/types.d.ts +90 -90
- package/dist/storage/domains/workflows/inmemory.d.ts.map +1 -1
- package/dist/storage/index.cjs +93 -93
- package/dist/storage/index.js +2 -2
- package/dist/stream/MastraAgentNetworkStream.d.ts +8 -12
- package/dist/stream/MastraAgentNetworkStream.d.ts.map +1 -1
- package/dist/stream/aisdk/v5/compat/prepare-tools.d.ts.map +1 -1
- package/dist/stream/aisdk/v5/execute.d.ts +2 -3
- package/dist/stream/aisdk/v5/execute.d.ts.map +1 -1
- package/dist/stream/aisdk/v5/transform.d.ts +2 -3
- package/dist/stream/aisdk/v5/transform.d.ts.map +1 -1
- package/dist/stream/base/output-format-handlers.d.ts +2 -2
- package/dist/stream/base/output-format-handlers.d.ts.map +1 -1
- package/dist/stream/base/output.d.ts +76 -50
- package/dist/stream/base/output.d.ts.map +1 -1
- package/dist/stream/base/schema.d.ts +7 -2
- package/dist/stream/base/schema.d.ts.map +1 -1
- package/dist/stream/index.cjs +11 -15
- package/dist/stream/index.d.ts +2 -2
- package/dist/stream/index.d.ts.map +1 -1
- package/dist/stream/index.js +2 -2
- package/dist/stream/types.d.ts +72 -26
- package/dist/stream/types.d.ts.map +1 -1
- package/dist/test-utils/llm-mock.cjs +4 -4
- package/dist/test-utils/llm-mock.js +1 -1
- package/dist/tool-loop-agent/index.cjs +4 -4
- package/dist/tool-loop-agent/index.d.ts +1 -1
- package/dist/tool-loop-agent/index.d.ts.map +1 -1
- package/dist/tool-loop-agent/index.js +1 -1
- package/dist/tool-loop-agent/tool-loop-processor.d.ts +1 -2
- package/dist/tool-loop-agent/tool-loop-processor.d.ts.map +1 -1
- package/dist/tools/index.cjs +4 -4
- package/dist/tools/index.js +1 -1
- package/dist/tools/is-vercel-tool.cjs +2 -2
- package/dist/tools/is-vercel-tool.js +1 -1
- package/dist/tools/tool-builder/builder.d.ts.map +1 -1
- package/dist/tools/tool.d.ts +27 -14
- package/dist/tools/tool.d.ts.map +1 -1
- package/dist/tools/types.d.ts +76 -20
- package/dist/tools/types.d.ts.map +1 -1
- package/dist/tools/ui-types.d.ts +3 -4
- package/dist/tools/ui-types.d.ts.map +1 -1
- package/dist/tools/validation.d.ts +4 -4
- package/dist/tools/validation.d.ts.map +1 -1
- package/dist/types/dynamic-argument.d.ts +61 -1
- package/dist/types/dynamic-argument.d.ts.map +1 -1
- package/dist/types/zod-compat.d.ts +3 -11
- package/dist/types/zod-compat.d.ts.map +1 -1
- package/dist/utils.cjs +22 -22
- package/dist/utils.d.ts +1 -1
- package/dist/utils.d.ts.map +1 -1
- package/dist/utils.js +1 -1
- package/dist/vector/index.cjs +2 -2
- package/dist/vector/index.js +1 -1
- package/dist/voice/index.cjs +6 -6
- package/dist/voice/index.js +1 -1
- package/dist/workflows/default.d.ts +114 -2
- package/dist/workflows/default.d.ts.map +1 -1
- package/dist/workflows/evented/index.cjs +10 -10
- package/dist/workflows/evented/index.js +1 -1
- package/dist/workflows/evented/step-executor.d.ts +1 -1
- package/dist/workflows/evented/step-executor.d.ts.map +1 -1
- package/dist/workflows/evented/workflow-event-processor/index.d.ts.map +1 -1
- package/dist/workflows/evented/workflow-event-processor/utils.d.ts +1 -1
- package/dist/workflows/evented/workflow.d.ts +74 -21
- package/dist/workflows/evented/workflow.d.ts.map +1 -1
- package/dist/workflows/handlers/control-flow.d.ts +2 -2
- package/dist/workflows/handlers/control-flow.d.ts.map +1 -1
- package/dist/workflows/handlers/sleep.d.ts.map +1 -1
- package/dist/workflows/handlers/step.d.ts +1 -1
- package/dist/workflows/handlers/step.d.ts.map +1 -1
- package/dist/workflows/index.cjs +23 -23
- package/dist/workflows/index.js +1 -1
- package/dist/workflows/step.d.ts +28 -24
- package/dist/workflows/step.d.ts.map +1 -1
- package/dist/workflows/types.d.ts +91 -54
- package/dist/workflows/types.d.ts.map +1 -1
- package/dist/workflows/workflow.d.ts +165 -118
- package/dist/workflows/workflow.d.ts.map +1 -1
- package/package.json +4 -4
- package/src/llm/model/provider-types.generated.d.ts +224 -18
- package/dist/chunk-3CZ42NBZ.js.map +0 -1
- package/dist/chunk-3RFSIHFR.js.map +0 -1
- package/dist/chunk-6TBWJV35.js.map +0 -1
- package/dist/chunk-A4MCHA5L.cjs.map +0 -1
- package/dist/chunk-AHN7K3VE.js.map +0 -1
- package/dist/chunk-AW7FISLD.cjs.map +0 -1
- package/dist/chunk-CISH55FP.js.map +0 -1
- package/dist/chunk-IC2MIQBW.js.map +0 -1
- package/dist/chunk-JMAPJWVG.cjs.map +0 -1
- package/dist/chunk-KGE3KAM7.js.map +0 -1
- package/dist/chunk-O4H44CMA.js.map +0 -1
- package/dist/chunk-O5IPTMEH.cjs.map +0 -1
- package/dist/chunk-PC3FBUWH.js.map +0 -1
- package/dist/chunk-SOSXN7X4.cjs.map +0 -1
- package/dist/chunk-UOZ3GJY2.cjs.map +0 -1
- package/dist/chunk-UVHSM2GU.cjs.map +0 -1
- package/dist/chunk-UXLQEGIN.cjs.map +0 -1
- package/dist/chunk-W7R7GPNN.cjs.map +0 -1
- package/dist/chunk-WMJEP45F.cjs.map +0 -1
- package/dist/chunk-XBZWAUZ3.js.map +0 -1
- package/dist/chunk-XKDVT3ZH.cjs.map +0 -1
- package/dist/chunk-XSJNTLM7.js.map +0 -1
- package/dist/provider-registry-6DWM3X3I.js +0 -3
- package/dist/provider-registry-DCECMUCQ.cjs +0 -40
- package/dist/stream/aisdk/v5/output.d.ts +0 -121
- package/dist/stream/aisdk/v5/output.d.ts.map +0 -1
- /package/dist/docs/agents/{09-adding-voice.md → 10-adding-voice.md} +0 -0
- /package/dist/docs/observability/{09-langfuse.md → 11-langfuse.md} +0 -0
- /package/dist/docs/observability/{10-langsmith.md → 12-langsmith.md} +0 -0
- /package/dist/docs/observability/{12-posthog.md → 14-posthog.md} +0 -0
|
@@ -80,13 +80,15 @@ const memory = new Memory({
|
|
|
80
80
|
|
|
81
81
|
### Usage with Agents
|
|
82
82
|
|
|
83
|
-
When using resource-scoped memory, make sure to pass the `
|
|
83
|
+
When using resource-scoped memory, make sure to pass the `resource` parameter in the memory options:
|
|
84
84
|
|
|
85
85
|
```typescript
|
|
86
|
-
// Resource-scoped memory requires
|
|
86
|
+
// Resource-scoped memory requires resource
|
|
87
87
|
const response = await agent.generate("Hello!", {
|
|
88
|
-
|
|
89
|
-
|
|
88
|
+
memory: {
|
|
89
|
+
thread: "conversation-123",
|
|
90
|
+
resource: "user-alice-456", // Same user across different threads
|
|
91
|
+
},
|
|
90
92
|
});
|
|
91
93
|
```
|
|
92
94
|
|
|
@@ -339,8 +341,10 @@ const thread = await memory.createThread({
|
|
|
339
341
|
|
|
340
342
|
// The agent will now have access to this information in all messages
|
|
341
343
|
await agent.generate("What's my blood type?", {
|
|
342
|
-
|
|
343
|
-
|
|
344
|
+
memory: {
|
|
345
|
+
thread: thread.id,
|
|
346
|
+
resource: "user-456",
|
|
347
|
+
},
|
|
344
348
|
});
|
|
345
349
|
// Response: "Your blood type is O+."
|
|
346
350
|
```
|
|
@@ -56,7 +56,7 @@ const agent = new Agent({
|
|
|
56
56
|
// this is the default vector db if omitted
|
|
57
57
|
vector: new LibSQLVector({
|
|
58
58
|
id: 'agent-vector',
|
|
59
|
-
|
|
59
|
+
url: "file:./local.db",
|
|
60
60
|
}),
|
|
61
61
|
}),
|
|
62
62
|
});
|
|
@@ -230,6 +230,4 @@ You might want to disable semantic recall in scenarios like:
|
|
|
230
230
|
|
|
231
231
|
## Viewing Recalled Messages
|
|
232
232
|
|
|
233
|
-
When tracing is enabled, any messages retrieved via semantic recall will appear in the agent's trace output, alongside recent message history (if configured).
|
|
234
|
-
|
|
235
|
-
For more info on viewing message traces, see [Viewing Retrieved Messages](./overview#viewing-retrieved-messages).
|
|
233
|
+
When tracing is enabled, any messages retrieved via semantic recall will appear in the agent's trace output, alongside recent message history (if configured).
|
|
@@ -106,7 +106,6 @@ const agent = new Agent({
|
|
|
106
106
|
vector: new PineconeVector({
|
|
107
107
|
id: "memory-vector",
|
|
108
108
|
apiKey: process.env.PINECONE_API_KEY!,
|
|
109
|
-
environment: "us-east-1",
|
|
110
109
|
}),
|
|
111
110
|
embedder: new OpenAIEmbedder({
|
|
112
111
|
model: "text-embedding-3-small",
|
|
@@ -169,7 +168,7 @@ If you manually add a memory processor to `inputProcessors` or `outputProcessors
|
|
|
169
168
|
```typescript
|
|
170
169
|
import { Agent } from "@mastra/core/agent";
|
|
171
170
|
import { Memory } from "@mastra/memory";
|
|
172
|
-
import { MessageHistory } from "@mastra/
|
|
171
|
+
import { MessageHistory } from "@mastra/core/processors";
|
|
173
172
|
import { TokenLimiter } from "@mastra/core/processors";
|
|
174
173
|
import { LibSQLStore } from "@mastra/libsql";
|
|
175
174
|
import { openai } from "@ai-sdk/openai";
|
|
@@ -264,7 +263,7 @@ const agent = new Agent({
|
|
|
264
263
|
// If the guardrail aborts, nothing is saved to memory
|
|
265
264
|
const result = await agent.generate("Hello");
|
|
266
265
|
if (result.tripwire) {
|
|
267
|
-
console.log("Blocked:", result.
|
|
266
|
+
console.log("Blocked:", result.tripwire.reason);
|
|
268
267
|
// Memory is empty - no messages were persisted
|
|
269
268
|
}
|
|
270
269
|
```
|
|
@@ -98,7 +98,7 @@ export const agent = new Agent({
|
|
|
98
98
|
}),
|
|
99
99
|
vector: new LibSQLVector({
|
|
100
100
|
id: 'test-agent-vector',
|
|
101
|
-
|
|
101
|
+
url: "file:./vector-memory.db",
|
|
102
102
|
}),
|
|
103
103
|
options: {
|
|
104
104
|
lastMessages: 10,
|
|
@@ -110,9 +110,7 @@ export const agent = new Agent({
|
|
|
110
110
|
workingMemory: {
|
|
111
111
|
enabled: true,
|
|
112
112
|
},
|
|
113
|
-
|
|
114
|
-
generateTitle: true,
|
|
115
|
-
},
|
|
113
|
+
generateTitle: true,
|
|
116
114
|
},
|
|
117
115
|
}),
|
|
118
116
|
});
|
|
@@ -63,8 +63,8 @@ import { createTool } from "@mastra/core/tools";
|
|
|
63
63
|
import { z } from "zod";
|
|
64
64
|
|
|
65
65
|
export const testTool = createTool({
|
|
66
|
-
execute: async (
|
|
67
|
-
const logger = mastra
|
|
66
|
+
execute: async (inputData, context) => {
|
|
67
|
+
const logger = context?.mastra.getLogger();
|
|
68
68
|
logger?.info("tool info log");
|
|
69
69
|
|
|
70
70
|
return {
|
|
@@ -80,16 +80,15 @@ Logger methods accept an optional second argument for additional data. This can
|
|
|
80
80
|
|
|
81
81
|
In this example, the log message includes an object with a key of `agent` and a value of the `testAgent` instance.
|
|
82
82
|
|
|
83
|
-
```typescript {
|
|
83
|
+
```typescript {9} title="src/mastra/workflows/test-workflow.ts"
|
|
84
84
|
import { createWorkflow, createStep } from "@mastra/core/workflows";
|
|
85
85
|
import { z } from "zod";
|
|
86
86
|
|
|
87
87
|
const step1 = createStep({
|
|
88
88
|
execute: async ({ mastra }) => {
|
|
89
|
-
|
|
90
89
|
const testAgent = mastra.getAgent("testAgent");
|
|
91
|
-
|
|
92
90
|
const logger = mastra.getLogger();
|
|
91
|
+
|
|
93
92
|
logger.info("workflow info log", { agent: testAgent });
|
|
94
93
|
|
|
95
94
|
return {
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
> Set up Tracing for Mastra applications
|
|
2
2
|
|
|
3
3
|
> **Code References:**
|
|
4
|
-
- `Mastra`: dist/mastra/index.d.ts → dist/chunk-
|
|
5
|
-
- `Workflow`: dist/workflows/workflow.d.ts → dist/chunk-
|
|
6
|
-
- `Run`: dist/workflows/index.d.ts → dist/chunk-
|
|
4
|
+
- `Mastra`: dist/mastra/index.d.ts → dist/chunk-IFPQ2MLB.js:24
|
|
5
|
+
- `Workflow`: dist/workflows/workflow.d.ts → dist/chunk-UVOQLIWL.js:8246
|
|
6
|
+
- `Run`: dist/workflows/index.d.ts → dist/chunk-UVOQLIWL.js:9076
|
|
7
7
|
|
|
8
8
|
# Tracing
|
|
9
9
|
|
|
@@ -80,10 +80,13 @@ In addition to the internal exporters, Mastra supports integration with popular
|
|
|
80
80
|
|
|
81
81
|
- **[Arize](https://mastra.ai/docs/v1/observability/tracing/exporters/arize)** - Exports traces to Arize Phoenix or Arize AX using OpenInference semantic conventions
|
|
82
82
|
- **[Braintrust](https://mastra.ai/docs/v1/observability/tracing/exporters/braintrust)** - Exports traces to Braintrust's eval and observability platform
|
|
83
|
+
- **[Datadog](https://mastra.ai/docs/v1/observability/tracing/exporters/datadog)** - Sends traces to Datadog APM via OTLP for full-stack observability with AI tracing
|
|
84
|
+
- **[Laminar](https://mastra.ai/docs/v1/observability/tracing/exporters/laminar)** - Sends traces to Laminar via OTLP/HTTP (protobuf) with Laminar-native span attributes + scorer support
|
|
83
85
|
- **[Langfuse](https://mastra.ai/docs/v1/observability/tracing/exporters/langfuse)** - Sends traces to the Langfuse open-source LLM engineering platform
|
|
84
86
|
- **[LangSmith](https://mastra.ai/docs/v1/observability/tracing/exporters/langsmith)** - Pushes traces into LangSmith's observability and evaluation toolkit
|
|
85
87
|
- **[OpenTelemetry](https://mastra.ai/docs/v1/observability/tracing/exporters/otel)** - Deliver traces to any OpenTelemetry-compatible observability system
|
|
86
|
-
- Supports: Dash0, Datadog, MLflow,
|
|
88
|
+
- Supports: Dash0, Datadog, MLflow, New Relic, SigNoz, Traceloop, Zipkin, and others!
|
|
89
|
+
- **[Sentry](https://mastra.ai/docs/v1/observability/tracing/exporters/sentry)** - Sends traces to Sentry for AI tracing and monitoring using OpenTelemetry semantic conventions
|
|
87
90
|
|
|
88
91
|
## Bridges
|
|
89
92
|
|
|
@@ -325,12 +328,12 @@ Custom metadata allows you to attach additional context to your traces, making i
|
|
|
325
328
|
You can add metadata to any span using the tracing context:
|
|
326
329
|
|
|
327
330
|
```ts
|
|
328
|
-
execute: async (
|
|
331
|
+
execute: async (inputData, context) => {
|
|
329
332
|
const startTime = Date.now();
|
|
330
333
|
const response = await fetch(inputData.endpoint);
|
|
331
334
|
|
|
332
335
|
// Add custom metadata to the current span
|
|
333
|
-
tracingContext.currentSpan?.update({
|
|
336
|
+
context?.tracingContext.currentSpan?.update({
|
|
334
337
|
metadata: {
|
|
335
338
|
apiStatusCode: response.status,
|
|
336
339
|
endpoint: inputData.endpoint,
|
|
@@ -488,24 +491,77 @@ const result = await agent.generate({
|
|
|
488
491
|
- **Priority levels**: `"priority-high"`, `"priority-low"`
|
|
489
492
|
- **Experiments**: `"experiment-v1"`, `"control-group"`, `"treatment-a"`
|
|
490
493
|
|
|
494
|
+
### Hiding Sensitive Input/Output
|
|
495
|
+
|
|
496
|
+
When processing sensitive data, you may want to prevent input and output values from being logged to your observability platforms. Use `hideInput` and `hideOutput` in `tracingOptions` to exclude this data from all spans in a trace:
|
|
497
|
+
|
|
498
|
+
```ts
|
|
499
|
+
// Hide input data (e.g., user credentials, PII)
|
|
500
|
+
const result = await agent.generate({
|
|
501
|
+
messages: [{ role: "user", content: "Process this sensitive data" }],
|
|
502
|
+
tracingOptions: {
|
|
503
|
+
hideInput: true, // Input will be hidden from all spans
|
|
504
|
+
},
|
|
505
|
+
});
|
|
506
|
+
|
|
507
|
+
// Hide output data (e.g., generated secrets, confidential results)
|
|
508
|
+
const result = await agent.generate({
|
|
509
|
+
messages: [{ role: "user", content: "Generate API keys" }],
|
|
510
|
+
tracingOptions: {
|
|
511
|
+
hideOutput: true, // Output will be hidden from all spans
|
|
512
|
+
},
|
|
513
|
+
});
|
|
514
|
+
|
|
515
|
+
// Hide both input and output
|
|
516
|
+
const result = await agent.generate({
|
|
517
|
+
messages: [{ role: "user", content: "Handle confidential request" }],
|
|
518
|
+
tracingOptions: {
|
|
519
|
+
hideInput: true,
|
|
520
|
+
hideOutput: true,
|
|
521
|
+
},
|
|
522
|
+
});
|
|
523
|
+
```
|
|
524
|
+
|
|
525
|
+
#### How It Works
|
|
526
|
+
|
|
527
|
+
- **Trace-wide effect**: When set on the root span, these options apply to all child spans in the trace (tool calls, model generations, etc.)
|
|
528
|
+
- **Export-time filtering**: The data is still available internally during execution but is excluded when spans are exported to observability platforms
|
|
529
|
+
- **Combinable with other options**: You can use `hideInput`/`hideOutput` alongside `tags`, `metadata`, and other `tracingOptions`
|
|
530
|
+
|
|
531
|
+
```ts
|
|
532
|
+
const result = await agent.generate({
|
|
533
|
+
messages: [{ role: "user", content: "Sensitive operation" }],
|
|
534
|
+
tracingOptions: {
|
|
535
|
+
hideInput: true,
|
|
536
|
+
hideOutput: true,
|
|
537
|
+
tags: ["sensitive-operation", "pii-handling"],
|
|
538
|
+
metadata: { operationType: "credential-processing" },
|
|
539
|
+
},
|
|
540
|
+
});
|
|
541
|
+
```
|
|
542
|
+
|
|
543
|
+
> **Note:**
|
|
544
|
+
|
|
545
|
+
For more granular control over sensitive data, consider using the [Sensitive Data Filter](https://mastra.ai/docs/v1/observability/tracing/processors/sensitive-data-filter) processor, which can redact specific fields (like passwords, tokens, and keys) while preserving the rest of the input/output.
|
|
546
|
+
|
|
491
547
|
#### Child Spans and Metadata Extraction
|
|
492
548
|
|
|
493
549
|
When creating child spans within tools or workflow steps, you can pass the `requestContext` parameter to enable metadata extraction:
|
|
494
550
|
|
|
495
551
|
```ts
|
|
496
|
-
execute: async (
|
|
552
|
+
execute: async (inputData, context) => {
|
|
497
553
|
// Create child span WITH requestContext - gets metadata extraction
|
|
498
|
-
const dbSpan = tracingContext.currentSpan?.createChildSpan({
|
|
554
|
+
const dbSpan = context?.tracingContext.currentSpan?.createChildSpan({
|
|
499
555
|
type: "generic",
|
|
500
556
|
name: "database-query",
|
|
501
|
-
requestContext, // Pass to enable metadata extraction
|
|
557
|
+
requestContext: context?.requestContext, // Pass to enable metadata extraction
|
|
502
558
|
});
|
|
503
559
|
|
|
504
560
|
const results = await db.query("SELECT * FROM users");
|
|
505
561
|
dbSpan?.end({ output: results });
|
|
506
562
|
|
|
507
563
|
// Or create child span WITHOUT requestContext - no metadata extraction
|
|
508
|
-
const cacheSpan = tracingContext.currentSpan?.createChildSpan({
|
|
564
|
+
const cacheSpan = context?.tracingContext.currentSpan?.createChildSpan({
|
|
509
565
|
type: "generic",
|
|
510
566
|
name: "cache-check",
|
|
511
567
|
// No requestContext - won't extract metadata
|
|
@@ -524,9 +580,9 @@ Child spans allow you to track fine-grained operations within your workflow step
|
|
|
524
580
|
Create child spans inside a tool call or workflow step to track specific operations:
|
|
525
581
|
|
|
526
582
|
```ts
|
|
527
|
-
execute: async (
|
|
583
|
+
execute: async (inputData, context) => {
|
|
528
584
|
// Create another child span for the main database operation
|
|
529
|
-
const querySpan = tracingContext.currentSpan?.createChildSpan({
|
|
585
|
+
const querySpan = context?.tracingContext.currentSpan?.createChildSpan({
|
|
530
586
|
type: "generic",
|
|
531
587
|
name: "database-query",
|
|
532
588
|
input: { query: inputData.query },
|
|
@@ -867,7 +923,7 @@ Mastra automatically creates spans for:
|
|
|
867
923
|
- [Arize](https://mastra.ai/reference/v1/observability/tracing/exporters/arize) - Arize Phoenix and Arize AX integration
|
|
868
924
|
- [Braintrust](https://mastra.ai/reference/v1/observability/tracing/exporters/braintrust) - Braintrust integration
|
|
869
925
|
- [Langfuse](https://mastra.ai/reference/v1/observability/tracing/exporters/langfuse) - Langfuse integration
|
|
870
|
-
- [MLflow](https://mastra.ai/
|
|
926
|
+
- [MLflow](https://mastra.ai/docs/v1/observability/tracing/exporters/otel#mlflow) - MLflow OTLP endpoint setup
|
|
871
927
|
- [OpenTelemetry](https://mastra.ai/reference/v1/observability/tracing/exporters/otel) - OTEL-compatible platforms
|
|
872
928
|
|
|
873
929
|
### Bridges
|
|
@@ -0,0 +1,169 @@
|
|
|
1
|
+
> Send traces to Datadog for LLM observability and analytics
|
|
2
|
+
|
|
3
|
+
# Datadog Exporter
|
|
4
|
+
|
|
5
|
+
[Datadog](https://datadoghq.com/) is a comprehensive monitoring platform with dedicated LLM Observability features. The Datadog exporter sends your traces to Datadog's LLM Observability product, providing insights into model performance, token usage, and conversation flows.
|
|
6
|
+
|
|
7
|
+
## Installation
|
|
8
|
+
|
|
9
|
+
```bash npm2yarn
|
|
10
|
+
npm install @mastra/datadog@beta
|
|
11
|
+
```
|
|
12
|
+
|
|
13
|
+
## Configuration
|
|
14
|
+
|
|
15
|
+
### Prerequisites
|
|
16
|
+
|
|
17
|
+
1. **Datadog Account**: Sign up at [datadoghq.com](https://datadoghq.com/) with LLM Observability enabled
|
|
18
|
+
2. **API Key**: Get your API key from Datadog Organization Settings → API Keys
|
|
19
|
+
3. **Environment Variables**: Set your credentials
|
|
20
|
+
|
|
21
|
+
```bash title=".env"
|
|
22
|
+
DD_API_KEY=your-datadog-api-key
|
|
23
|
+
DD_LLMOBS_ML_APP=my-llm-app
|
|
24
|
+
DD_SITE=datadoghq.com # Optional: defaults to datadoghq.com
|
|
25
|
+
DD_ENV=production # Optional: environment name
|
|
26
|
+
```
|
|
27
|
+
|
|
28
|
+
### Zero-Config Setup
|
|
29
|
+
|
|
30
|
+
With environment variables set, use the exporter with no configuration:
|
|
31
|
+
|
|
32
|
+
```typescript title="src/mastra/index.ts"
|
|
33
|
+
import { Mastra } from "@mastra/core";
|
|
34
|
+
import { Observability } from "@mastra/observability";
|
|
35
|
+
import { DatadogExporter } from "@mastra/datadog";
|
|
36
|
+
|
|
37
|
+
export const mastra = new Mastra({
|
|
38
|
+
observability: new Observability({
|
|
39
|
+
configs: {
|
|
40
|
+
datadog: {
|
|
41
|
+
serviceName: "my-service",
|
|
42
|
+
exporters: [new DatadogExporter()],
|
|
43
|
+
},
|
|
44
|
+
},
|
|
45
|
+
}),
|
|
46
|
+
});
|
|
47
|
+
```
|
|
48
|
+
|
|
49
|
+
### Explicit Configuration
|
|
50
|
+
|
|
51
|
+
You can also pass credentials directly (takes precedence over environment variables):
|
|
52
|
+
|
|
53
|
+
```typescript title="src/mastra/index.ts"
|
|
54
|
+
import { Mastra } from "@mastra/core";
|
|
55
|
+
import { Observability } from "@mastra/observability";
|
|
56
|
+
import { DatadogExporter } from "@mastra/datadog";
|
|
57
|
+
|
|
58
|
+
export const mastra = new Mastra({
|
|
59
|
+
observability: new Observability({
|
|
60
|
+
configs: {
|
|
61
|
+
datadog: {
|
|
62
|
+
serviceName: "my-service",
|
|
63
|
+
exporters: [
|
|
64
|
+
new DatadogExporter({
|
|
65
|
+
mlApp: process.env.DD_LLMOBS_ML_APP!,
|
|
66
|
+
apiKey: process.env.DD_API_KEY!,
|
|
67
|
+
}),
|
|
68
|
+
],
|
|
69
|
+
},
|
|
70
|
+
},
|
|
71
|
+
}),
|
|
72
|
+
});
|
|
73
|
+
```
|
|
74
|
+
|
|
75
|
+
## Configuration Options
|
|
76
|
+
|
|
77
|
+
### Complete Configuration
|
|
78
|
+
|
|
79
|
+
```typescript
|
|
80
|
+
new DatadogExporter({
|
|
81
|
+
// Required settings
|
|
82
|
+
mlApp: process.env.DD_LLMOBS_ML_APP!, // Groups traces under this ML app name
|
|
83
|
+
apiKey: process.env.DD_API_KEY!, // Required for agentless mode (default)
|
|
84
|
+
|
|
85
|
+
// Optional settings
|
|
86
|
+
site: "datadoghq.com", // Datadog site (datadoghq.eu, us3.datadoghq.com, etc.)
|
|
87
|
+
service: "my-service", // Service name (defaults to mlApp)
|
|
88
|
+
env: "production", // Environment name
|
|
89
|
+
agentless: true, // true = direct HTTPS, false = local Datadog Agent
|
|
90
|
+
|
|
91
|
+
// Advanced settings
|
|
92
|
+
integrationsEnabled: false, // Enable dd-trace auto-instrumentation
|
|
93
|
+
|
|
94
|
+
// Diagnostic logging
|
|
95
|
+
logLevel: "info", // debug | info | warn | error
|
|
96
|
+
});
|
|
97
|
+
```
|
|
98
|
+
|
|
99
|
+
### With Local Datadog Agent
|
|
100
|
+
|
|
101
|
+
If you have a Datadog Agent running locally, you can route traces through it instead of direct HTTPS:
|
|
102
|
+
|
|
103
|
+
```typescript
|
|
104
|
+
new DatadogExporter({
|
|
105
|
+
mlApp: process.env.DD_LLMOBS_ML_APP!,
|
|
106
|
+
agentless: false, // Use local Datadog Agent
|
|
107
|
+
env: "production",
|
|
108
|
+
});
|
|
109
|
+
```
|
|
110
|
+
|
|
111
|
+
Note: When using agent mode, the API key is read from the local agent's configuration.
|
|
112
|
+
|
|
113
|
+
## Span Type Mapping
|
|
114
|
+
|
|
115
|
+
Mastra span types are automatically mapped to Datadog LLMObs span kinds:
|
|
116
|
+
|
|
117
|
+
| Mastra SpanType | Datadog Kind |
|
|
118
|
+
| -------------------- | ------------ |
|
|
119
|
+
| `AGENT_RUN` | `agent` |
|
|
120
|
+
| `MODEL_GENERATION` | `workflow` |
|
|
121
|
+
| `MODEL_STEP` | `llm` |
|
|
122
|
+
| `TOOL_CALL` | `tool` |
|
|
123
|
+
| `MCP_TOOL_CALL` | `tool` |
|
|
124
|
+
| `WORKFLOW_RUN` | `workflow` |
|
|
125
|
+
| Other workflow types | `task` |
|
|
126
|
+
| `GENERIC` | `task` |
|
|
127
|
+
|
|
128
|
+
Other/future Mastra span types will default to 'task' when mapped unless specified.
|
|
129
|
+
|
|
130
|
+
## Troubleshooting
|
|
131
|
+
|
|
132
|
+
### Native module ABI mismatch
|
|
133
|
+
|
|
134
|
+
If you see errors like:
|
|
135
|
+
|
|
136
|
+
```
|
|
137
|
+
Error: No native build was found for runtime=node abi=137 platform=linuxglibc arch=x64
|
|
138
|
+
```
|
|
139
|
+
|
|
140
|
+
This indicates a Node.js version compatibility issue with `dd-trace`'s native modules. These native modules are **optional** and provide performance monitoring features.
|
|
141
|
+
|
|
142
|
+
**Solutions:**
|
|
143
|
+
|
|
144
|
+
1. **Use Node.js 22.x**: Native modules have the best compatibility with Node.js 22.x.
|
|
145
|
+
|
|
146
|
+
2. **Ignore native module warnings**: The native modules (`@datadog/native-metrics`, `@datadog/native-appsec`, etc.) are optional. If they fail to load, core tracing functionality still works.
|
|
147
|
+
|
|
148
|
+
### Bundler externals configuration
|
|
149
|
+
|
|
150
|
+
When using bundlers like esbuild, webpack, or the Mastra CLI bundler, you may need to mark `dd-trace` and its dependencies as external:
|
|
151
|
+
|
|
152
|
+
```typescript title="src/mastra/index.ts"
|
|
153
|
+
export const mastra = new Mastra({
|
|
154
|
+
bundler: {
|
|
155
|
+
externals: [
|
|
156
|
+
"dd-trace",
|
|
157
|
+
"@datadog/native-metrics",
|
|
158
|
+
"@datadog/native-appsec",
|
|
159
|
+
"@datadog/native-iast-taint-tracking",
|
|
160
|
+
"@datadog/pprof",
|
|
161
|
+
],
|
|
162
|
+
},
|
|
163
|
+
});
|
|
164
|
+
```
|
|
165
|
+
|
|
166
|
+
## Related
|
|
167
|
+
|
|
168
|
+
- [Tracing Overview](https://mastra.ai/docs/v1/observability/tracing/overview)
|
|
169
|
+
- [Datadog LLM Observability Documentation](https://docs.datadoghq.com/llm_observability/)
|
|
@@ -0,0 +1,95 @@
|
|
|
1
|
+
> Send traces to Laminar for LLM observability, evaluation, and analysis
|
|
2
|
+
|
|
3
|
+
# Laminar Exporter
|
|
4
|
+
|
|
5
|
+
[Laminar](https://laminar.sh/) is an open-source platform for engineering LLM products. The Laminar exporter sends your Mastra traces to Laminar via OTLP/HTTP (protobuf), with Laminar-native span attributes for correct rendering (paths, inputs/outputs, tags, metadata).
|
|
6
|
+
|
|
7
|
+
## Installation
|
|
8
|
+
|
|
9
|
+
```bash npm2yarn
|
|
10
|
+
npm install @mastra/laminar@beta
|
|
11
|
+
```
|
|
12
|
+
|
|
13
|
+
## Configuration
|
|
14
|
+
|
|
15
|
+
### Prerequisites
|
|
16
|
+
|
|
17
|
+
1. **Laminar Project**: Create/select a project in Laminar
|
|
18
|
+
2. **Project API Key**: Copy from Laminar Project Settings
|
|
19
|
+
3. **Environment Variables**: Set your credentials
|
|
20
|
+
|
|
21
|
+
```bash title=".env"
|
|
22
|
+
# Required
|
|
23
|
+
LMNR_PROJECT_API_KEY=lmnr_...
|
|
24
|
+
|
|
25
|
+
# Optional
|
|
26
|
+
LMNR_BASE_URL=https://api.lmnr.ai
|
|
27
|
+
LAMINAR_ENDPOINT=https://api.lmnr.ai/v1/traces
|
|
28
|
+
```
|
|
29
|
+
|
|
30
|
+
### Zero-Config Setup
|
|
31
|
+
|
|
32
|
+
With environment variables set, use the exporter with no configuration:
|
|
33
|
+
|
|
34
|
+
```typescript title="src/mastra/index.ts"
|
|
35
|
+
import { Mastra } from "@mastra/core";
|
|
36
|
+
import { Observability } from "@mastra/observability";
|
|
37
|
+
import { LaminarExporter } from "@mastra/laminar";
|
|
38
|
+
|
|
39
|
+
export const mastra = new Mastra({
|
|
40
|
+
observability: new Observability({
|
|
41
|
+
configs: {
|
|
42
|
+
laminar: {
|
|
43
|
+
serviceName: "my-service",
|
|
44
|
+
exporters: [new LaminarExporter()],
|
|
45
|
+
},
|
|
46
|
+
},
|
|
47
|
+
}),
|
|
48
|
+
});
|
|
49
|
+
```
|
|
50
|
+
|
|
51
|
+
### Explicit Configuration
|
|
52
|
+
|
|
53
|
+
You can also pass credentials directly (takes precedence over environment variables):
|
|
54
|
+
|
|
55
|
+
```typescript title="src/mastra/index.ts"
|
|
56
|
+
import { Mastra } from "@mastra/core";
|
|
57
|
+
import { Observability } from "@mastra/observability";
|
|
58
|
+
import { LaminarExporter } from "@mastra/laminar";
|
|
59
|
+
|
|
60
|
+
export const mastra = new Mastra({
|
|
61
|
+
observability: new Observability({
|
|
62
|
+
configs: {
|
|
63
|
+
laminar: {
|
|
64
|
+
serviceName: "my-service",
|
|
65
|
+
exporters: [
|
|
66
|
+
new LaminarExporter({
|
|
67
|
+
apiKey: process.env.LMNR_PROJECT_API_KEY!,
|
|
68
|
+
baseUrl: process.env.LMNR_BASE_URL, // Optional
|
|
69
|
+
endpoint: process.env.LAMINAR_ENDPOINT, // Optional
|
|
70
|
+
realtime: process.env.NODE_ENV === "development", // Optional
|
|
71
|
+
}),
|
|
72
|
+
],
|
|
73
|
+
},
|
|
74
|
+
},
|
|
75
|
+
}),
|
|
76
|
+
});
|
|
77
|
+
```
|
|
78
|
+
|
|
79
|
+
## Using Tags
|
|
80
|
+
|
|
81
|
+
Tags help you categorize and filter traces in the Laminar dashboard. Add tags when executing agents or workflows:
|
|
82
|
+
|
|
83
|
+
```typescript
|
|
84
|
+
const result = await agent.generate({
|
|
85
|
+
messages: [{ role: "user", content: "Hello" }],
|
|
86
|
+
tracingOptions: {
|
|
87
|
+
tags: ["production", "experiment-v2", "user-request"],
|
|
88
|
+
},
|
|
89
|
+
});
|
|
90
|
+
```
|
|
91
|
+
|
|
92
|
+
## Related
|
|
93
|
+
|
|
94
|
+
- [Tracing Overview](https://mastra.ai/docs/v1/observability/tracing/overview)
|
|
95
|
+
- [Laminar Documentation](https://docs.laminar.sh)
|
|
@@ -40,7 +40,7 @@ All providers support zero-config setup via environment variables. Set the appro
|
|
|
40
40
|
| SigNoz | `SIGNOZ_API_KEY` (required), `SIGNOZ_REGION` (optional), `SIGNOZ_ENDPOINT` (optional) |
|
|
41
41
|
| New Relic | `NEW_RELIC_LICENSE_KEY` (required), `NEW_RELIC_ENDPOINT` (optional) |
|
|
42
42
|
| Traceloop | `TRACELOOP_API_KEY` (required), `TRACELOOP_DESTINATION_ID`, `TRACELOOP_ENDPOINT` (optional)|
|
|
43
|
-
| Laminar | `LMNR_PROJECT_API_KEY` (required), `LAMINAR_ENDPOINT
|
|
43
|
+
| Laminar | `LMNR_PROJECT_API_KEY` (required), `LAMINAR_ENDPOINT` (optional) |
|
|
44
44
|
|
|
45
45
|
## Provider Configurations
|
|
46
46
|
|
|
@@ -231,7 +231,7 @@ new OtelExporter({
|
|
|
231
231
|
|
|
232
232
|
### Laminar
|
|
233
233
|
|
|
234
|
-
[Laminar](https://
|
|
234
|
+
[Laminar](https://laminar.sh/) provides specialized LLM observability and analytics.
|
|
235
235
|
|
|
236
236
|
#### Zero-Config Setup
|
|
237
237
|
|
|
@@ -241,7 +241,6 @@ LMNR_PROJECT_API_KEY=your-api-key
|
|
|
241
241
|
|
|
242
242
|
# Optional
|
|
243
243
|
LAMINAR_ENDPOINT=https://api.lmnr.ai/v1/traces
|
|
244
|
-
LAMINAR_TEAM_ID=your-team-id # For backwards compatibility
|
|
245
244
|
```
|
|
246
245
|
|
|
247
246
|
```typescript title="src/mastra/index.ts"
|
|
@@ -255,17 +254,20 @@ new OtelExporter({
|
|
|
255
254
|
provider: {
|
|
256
255
|
laminar: {
|
|
257
256
|
apiKey: process.env.LMNR_PROJECT_API_KEY,
|
|
258
|
-
// teamId: process.env.LAMINAR_TEAM_ID, // Optional, for backwards compatibility
|
|
259
257
|
},
|
|
260
258
|
},
|
|
261
259
|
});
|
|
262
260
|
```
|
|
263
261
|
|
|
262
|
+
> **Note:** Laminar-Native Exporter
|
|
263
|
+
|
|
264
|
+
For Laminar-specific features like native span paths, metadata, and tags rendering in the Laminar dashboard, consider using the dedicated [`@mastra/laminar`](https://mastra.ai/docs/v1/observability/tracing/exporters/laminar) exporter instead. It provides optimized integration with Laminar's platform.
|
|
265
|
+
|
|
264
266
|
### Datadog
|
|
265
267
|
|
|
266
268
|
[Datadog](https://www.datadoghq.com/) APM provides application performance monitoring with distributed tracing. To send traces to Datadog via OTLP, you need the Datadog Agent running with OTLP ingestion enabled.
|
|
267
269
|
|
|
268
|
-
Datadog uses gRPC for OTLP ingestion, which requires explicit imports and bundler configuration to work correctly:
|
|
270
|
+
Datadog uses gRPC for OTLP ingestion, which requires explicit imports and [bundler configuration](https://mastra.ai/reference/v1/configuration#bundlerexternals) to work correctly:
|
|
269
271
|
|
|
270
272
|
```typescript title="src/mastra/index.ts"
|
|
271
273
|
// Explicitly import gRPC dependencies for the bundler
|
|
@@ -280,7 +282,6 @@ export const mastra = new Mastra({
|
|
|
280
282
|
bundler: {
|
|
281
283
|
externals: ["@grpc/grpc-js"],
|
|
282
284
|
},
|
|
283
|
-
|
|
284
285
|
observability: new Observability({
|
|
285
286
|
configs: {
|
|
286
287
|
default: {
|
|
@@ -321,7 +322,11 @@ The default OTLP endpoint is `http://localhost:4317` when running the Datadog Ag
|
|
|
321
322
|
|
|
322
323
|
> **Note:**
|
|
323
324
|
|
|
324
|
-
The explicit imports of `@grpc/grpc-js` and `@opentelemetry/exporter-trace-otlp-grpc` at the top of the file, along with the `bundler.externals` configuration, are required for the gRPC transport to work correctly. Without these, you may encounter connection issues.
|
|
325
|
+
The explicit imports of `@grpc/grpc-js` and `@opentelemetry/exporter-trace-otlp-grpc` at the top of the file, along with the [`bundler.externals`](https://mastra.ai/reference/v1/configuration#bundlerexternals) configuration, are required for the gRPC transport to work correctly. Without these, you may encounter connection issues.
|
|
326
|
+
|
|
327
|
+
> **Note:** Datadog-Native Exporter
|
|
328
|
+
|
|
329
|
+
For Datadog-specific features like automatic span type mapping, LLM span categorization, and simplified setup without gRPC configuration, consider using the dedicated [`@mastra/datadog`](https://mastra.ai/docs/v1/observability/tracing/exporters/datadog) exporter instead. It provides optimized integration with Datadog's APM platform.
|
|
325
330
|
|
|
326
331
|
### Custom/Generic OTEL Endpoints
|
|
327
332
|
|