TemplatesReal-world Examples

AI Wizard Brand Strategy

Loading pattern preview

Problems solved

Technical challenges this implementation handles out of the box.
  • Guide brand strategy through lock-based multi-stage interviews
  • Combine form seed inputs with conversational follow-ups
  • Progress only when dynamic checklist lock items complete
  • Synthesize earlier stages into a final strategy output

Use cases

Products and workflows this pattern is designed to support.
  • Brand strategy discovery workshops
  • Interactive marketing onboarding flows
  • Adaptive AI interview products
  • Full-screen levee-style strategy builders

Setup

Requirements, wiring steps, and what this pattern adds to your project.

Getting started

Pick how you want to pull this pattern in. Then wire env vars and routes the same way.

  1. 1

    Download → Next.js app

    Use Download → Next.js app in the preview toolbar. You get a zip scaffold (Pro downloads rewrite preview `/view/.../api/*` paths to `/api/*` automatically).

  2. 2

    Extract the zip and install dependencies

    Unzip the archive, then run `pnpm install` (or npm / yarn) in the project folder.

  3. 3

    Fill .env.local

    The download includes .env.local placeholders when needed. Add real values for: OPENAI_API_KEY.

  4. 4

    Customize the agent and tool files

    Adapt prompts, tools, and stop conditions in the generated project for your product.

  5. 5

    Run the app and open the pattern route

    Run `pnpm dev`, open the setup/checklist page if present, then navigate to the generated pattern route and verify responses.

Environment variables

Capabilities

AI SDK APIs

useChatDefaultChatTransporttoolToolLoopAgenthasToolCallstepCountIscreateUIMessageStream

Providers

OpenAI

External services

Upstash

Files added

21 files
  • app/page.tsx
  • app/layout.tsx
  • app/api/levee/route.ts
  • components/levee-brand-strategy.tsx
  • components/stage-chat.tsx
  • components/empty-state.tsx
  • components/tool-views/multiple-choice-view.tsx
  • components/tool-views/rating-view.tsx
  • components/tool-views/text-input-view.tsx
  • components/tool-views/lock-update-view.tsx
  • lib/types.ts
  • lib/stages.ts
  • lib/rate-limit.ts
  • lib/ai/levee-stream-config.ts
  • lib/ai/tools/ask-multiple-choice-tool.ts
  • lib/ai/tools/ask-rating-tool.ts
  • lib/ai/tools/ask-text-input-tool.ts
  • lib/ai/tools/complete-stage-tool.ts
  • lib/ai/tools/evaluate-lock-tool.ts
  • lib/ai/tools/index.ts
  • README.md

Dependencies

17 total

npm packages

7
AISDKUpstashlucide-reactNext.jsReactsonnerZod

Shadcn IconRegistry components

10
badgebuttoncheckboxemptyinputresizablescroll-areaselectseparatortextarea

Critical files

  • lib/stages.ts

    Stage configuration array defining 4 stages (Brand Identity form, Target Audience form, Competitive Landscape chat, Strategy Synthesis). Each stage has lock items, initial inputs, agent instructions, and tool sets.

  • ai/levee-stream-config.ts

    Builds streamText config per stage mode. Contains system prompt construction with mode-specific rules (form, chat, synthesis), tool set selection, and stop conditions. Central orchestration logic.

  • levee/route.ts

    Streaming API endpoint. Validates with Zod, calls buildStreamConfig, uses prepareStep to force evaluateLock after tool calls, streams lock updates via onStepFinish, and generates synthesis document on completeStage.

Requirements

Complexity
Advanced
Setup time
~10 minutes
Node
24+
Memory
256MB
Upstash Redis