AI refinement loop inside a durable workflow: generate → evaluate score → if low, refine and loop (max 3 times). Uses 'use step' for each phase.
Loading interactive preview...
Automatically installs the pattern and its dependencies in your project.
Download the complete pattern as a standalone Next.js project.
Add your AI provider API key to enable real functionality.
Open http://localhost:3000 to see the pattern in action.
The pattern is ready to use. Modify the components, API routes, and styling to fit your application.
app/page.tsxapp/api/Adapt this pattern for your specific use case and requirements.
Use this pattern to learn AI SDK concepts and prototype new ideas.
Integrate AI capabilities into existing applications and workflows.
Quickly build minimum viable products with AI-powered features.
Generate-evaluate-iterate loop that self-improves output quality. Generates a draft, evaluates it against criteria, and regenerates until the quality threshold is met.
Durable workflow that sleeps for 7 days, then runs AI summarization/RAG on new data and generates a report. Uses 'use workflow' and sleep().
The refinement-loop pattern demo is being prepared.
Download the pattern to try it with your API key