Skip to content
UsecaseBoard
← All use cases
discordbuilder

Return schema-validated agent output from a Mastra workflow step

At a glance

A public Mastra Discord thread shares a working custom execute wrapper that calls an agent with a Zod structured-output schema and returns the validated object; agent-step visualization remains the author's open question. This workflow is listed under builder, mastra, zod, structured-output, workflow-validation.

Agents / tools
Mastra, Zod, LLM agent

Building a tool for these workflows? See weekly rates.

Save ideas in this browser. Upvotes count across the board.

Prompt excerpt

Create a Mastra workflow step with explicit input and Zod output schemas. Inside execute, call the agent with structuredOutput and return the parsed object to the next step. Test a valid product response and malformed output, and inspect validation failures. Expect the graph to show the wrapper step rather than assuming the visualization issue is solved.

Sponsored

CodeBuddy

Tencent Cloud AI coding assistant for IDE and CLI.

Try CodeBuddy ↗
Explore all →