Documentation IndexFetch the complete documentation index at: /llms.txtUse this file to discover all available pages before exploring further.
Fetch the complete documentation index at: /llms.txt
Use this file to discover all available pages before exploring further.
Audit and trace Mastra agents from the TypeScript SDK.
@fact0/sdk
npm install @fact0/sdk @mastra/core
import { Fact0Client } from "@fact0/sdk"; import { Agent } from "@mastra/core/agent"; import { openai } from "@ai-sdk/openai"; const lf = new Fact0Client({ apiKey: process.env.FACT0_API_KEY! }); const agent = new Agent({ name: "support", instructions: "Resolve customer tickets.", model: openai("gpt-4o"), tools: { lookupOrder, issueRefund }, }); const execution = await lf.telemetry.startExecution({ agentId: "mastra.support" }); const span = execution.startSpan("agent.generate", "MODEL_INVOCATION"); const response = await agent.generate("Refund order #1024"); span.complete({ text: response.text }); await execution.end();
async function issueRefund({ orderId }: { orderId: string }) { await lf.audit.log({ actor: { id: "agent.support", type: "agent" }, action: "order.refund", resource: { id: orderId, type: "order" }, outcome: "success", }); ... }
f0_live_*