Mastra
Trace Mastra workflow and tool executions by calling AxonPushMastraHooks lifecycle methods from within your Mastra workflows. Captures workflow start/end, tool invocations, and errors.
Installation
Section titled “Installation”npm install @axonpush/sdk @mastra/coreimport { AxonPush } from "@axonpush/sdk";import { AxonPushMastraHooks } from "@axonpush/sdk/integrations/mastra";
const client = new AxonPush({ apiKey: process.env.AXONPUSH_API_KEY!, tenantId: process.env.AXONPUSH_TENANT_ID!,});
const hooks = new AxonPushMastraHooks({ client, channelId: 1, agentId: "my-agent",});import { Workflow } from "@mastra/core";
const workflow = new Workflow({ name: "ingestion" });
workflow.on("start", (ctx) => hooks.onWorkflowStart(ctx));workflow.on("end", (ctx) => hooks.onWorkflowEnd(ctx));workflow.on("error", (ctx) => hooks.onWorkflowError(ctx));
await workflow.run(input);Events Traced
Section titled “Events Traced”| Event | When |
|---|---|
tool.*.start | A tool invocation begins |
tool.*.end | A tool invocation completes |
workflow.start | A workflow begins execution |
workflow.end | A workflow completes successfully |
workflow.error | A workflow fails with an error |