Triage issues with structured output and label application
An AI agent analyzes an issue, generates a structured summary with labels, and automatically applies those labels to the issue via a durable workflow.
How it works
The agent initiates a durable workflow using ThinkWorkflow. It calls step.prompt() with a specific prompt and a Zod schema to enforce structured output (title, summary, labels). The agent's tools are used during this agentic turn to gather context. Once the structured data is returned and validated, the workflow executes a subsequent step to apply the generated labels to the issue, ensuring the process is durable and idempotent.
Prompt
Paste this into an agent that has the servers below connected. Adjust the names and dates to your own.
Create a TriageWorkflow that extends ThinkWorkflow. In the run method, use step.prompt() with a Zod schema defining title, summary, and labels. Pass a prompt like 'Triage issue #${event.payload.issueNumber}'. After receiving the structured draft, call step.do() to execute a function that applies the draft.labels to the issue using this.agent.applyLabels(). Start this workflow from your agent using runWorkflow().MCP servers it needs
Source
The vendor page this playbook is drawn from, and the passage that supports it.
ThinkWorkflow connects Think to Cloudflare Workflows when a durable job needs one model-driven reasoning step.Workflows · Cloudflare Agents docs