agent run from workflow should automatically pick up tracing context

Issue: When creating a workflow step from an agent using createStep(myAgent), the tracing context is not automatically passed down through the workflow chain. Expected: Tracing context should automatically propagate without manual wiring. Given snippet should just work without need manually wire up tracing context:
export const testWorkflow = createWorkflow({
id: 'testWorkflow',
inputSchema: z.object({ query: z.string() }),
outputSchema: z.string(),
});

testWorkflow
.then(createStep(myTool))
.map(async ({ inputData }) => ({
prompt: `Tool result: ${JSON.stringify(inputData)}`
}))
.then(createStep(myAgent)) // ❌ Tracing context should auto-propagate here
.map(async ({ inputData }) => inputData.text)
.commit();
export const testWorkflow = createWorkflow({
id: 'testWorkflow',
inputSchema: z.object({ query: z.string() }),
outputSchema: z.string(),
});

testWorkflow
.then(createStep(myTool))
.map(async ({ inputData }) => ({
prompt: `Tool result: ${JSON.stringify(inputData)}`
}))
.then(createStep(myAgent)) // ❌ Tracing context should auto-propagate here
.map(async ({ inputData }) => inputData.text)
.commit();
Not sure if there is same issue for step created from tool. Worth to check that too.
1 Reply
Mastra Triager
GitHub
[DISCORD:1428665862532894732] agent run from workflow should automa...
This issue was created from Discord post: https://discord.com/channels/1309558646228779139/1428665862532894732 Issue: When creating a workflow step from an agent using createStep(myAgent), the trac...

Did you find this page helpful?