Stepkit makes it easy to build AI workflows with parallel execution, conditional steps, and composable pipelines. This guide shows practical patterns for integrating AI SDK and building intelligent systems.
This example shows how to build an AI-powered idea evaluator that runs market research in parallel, then conditionally executes forecasting based on market size.
import { openai } from '@ai-sdk/openai'import { generateText } from 'ai'const evaluator = stepkit<{ idea: string }>() // Run market signals in parallel .step( 'gather-market-signals', async ({ idea }) => ({ marketSize: await fetchMarketSize(idea) }), async ({ idea }) => ({ competitors: await fetchCompetitors(idea) }), ) // Conditional: only run forecasting when the market is large .step( { name: 'run-forecast', condition: ({ marketSize }) => marketSize === 'large' }, async ({ idea }) => ({ forecast: await forecastROI(idea) }), ) .step('evaluate', async ({ idea, marketSize, competitors, forecast }) => { const { text } = await generateText({ model: openai('gpt-4.1'), prompt: `Rate this idea (1-10): "${idea}"\nMarket: ${marketSize}\nCompetitors: ${competitors.length}\nForecast: ${forecast ?? 'n/a'}`, }) return { evaluation: text } })await evaluator.run({ idea: 'AI-powered plant waterer' })