AI Traces missing, only appear if I run through the playground
I'm trying to get AI tracing to appear in my local playground when running through code but I'm hitting a wall. I've set the storage to LibSql. If I run the workflow/agent directly in the mastra playground locally the trace shows up in the observability tab. Shouldn't the traces show up when I run it through code?
You can reacreate this issue in the latest version of
mastra: 0.17.5 with mastra/core:0.23.1 with the base "weather agent" template. Except the changes below no changes have been made to the base template. Have been looking through the documentation and questions here but haven't found anything.
```ts
// index.ts
export const mastra = new Mastra({
... same as template
storage: new LibSQLStore({
url: "file:../../mastra.db",
}),
});
// agents/weather-agent.ts
export const weatherAgent = new Agent({
... same as template
memory: new Memory(), // Removed the libsql specific storage here. However have also tried with it to no avail
});
// app.ts
import { mastra } from "./mastra";
async function callMastra(input: string): Promise<string> {
const weatherAgent = mastra.getAgent("weatherAgent");
const response = await weatherAgent.generate(input, {
memory: {
resource: "test_user",
thread: "test-thread",
},
});
console.log("TRACE ID", response.traceId);
return response.text;
}
callMastra("What's the weather like in Stockholm today?");3 Replies
📝 Created GitHub issue: https://github.com/mastra-ai/mastra/issues/9438
GitHub
[DISCORD:1432792288702103592] AI Traces missing, only appear if I r...
This issue was created from Discord post: https://discord.com/channels/1309558646228779139/1432792288702103592 I'm trying to get AI tracing to appear in my local playground when running through...
Hey @Syrish ! That's because of the path of your sqlite database, you need to make sure they point to the exact same folder, and depending on how you run your script vs the mastra dev, the relative path is different. I'd advise using an absolute path in your case 😉 (this is the issue here:
file:../../mastra.db)Thanks Romain! That fixed it 😄