PatternsReal-world Examples

Reddit Product Validation Agent

Loading pattern preview

Problems solved

Technical challenges this implementation handles out of the box.
  • Discover relevant subreddits for a startup idea
  • Extract pain points, solutions, and willingness-to-pay signals
  • Track demand trends and early-adopter clues from Reddit
  • Produce a go/no-go validation scorecard with next steps

Use cases

Products and workflows this pattern is designed to support.
  • Startup idea validation
  • Product-market fit research
  • Pricing signal discovery
  • Early adopter outreach planning
  • Go/no-go decision scorecards

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

    Install from the preview toolbar

    Shadcn Icon

    Copy the install command above and run it in your project — Pro patterns include a short-lived token.

  2. 2

    Add environment variables to .env.local

    GOOGLE_GENERATIVE_AI_API_KEY

  3. 3

    Point client fetches at your API routes

    Replace preview `/view/.../api/...` paths with `/api/...` in the installed files.

  4. 4

    Customize the agent and tool files

    Adapt prompts, tools, and stop conditions for your product — Copy for AI in the toolbar helps seed that work.

  5. 5

    Run your dev server and open the pattern route

    Install dependencies if needed, then start the app and verify responses.

Environment variables

  • GOOGLE_GENERATIVE_AI_API_KEYGet key

Capabilities

AI SDK APIs

useChatgatewayToolLoopAgenttoolhasToolCallstepCountIscreateAgentUIStreamResponseInferAgentUIMessageDefaultChatTransportUIMessage

Providers

Gemini

External services

Upstash

Files added

14 files
  • app/page.tsx
  • app/layout.tsx
  • app/api/reddit-validation-agent/route.ts
  • lib/validation-types.ts
  • lib/rate-limit.ts
  • lib/ai/reddit-validation-agent.ts
  • lib/ai/tools/discover-subreddits.ts
  • lib/ai/tools/find-pain-points.ts
  • lib/ai/tools/analyze-existing-solutions.ts
  • lib/ai/tools/detect-willingness-to-pay.ts
  • lib/ai/tools/validate-demand.ts
  • lib/ai/tools/find-early-adopters.ts
  • lib/ai/tools/generate-validation-report.ts
  • README.md

Dependencies

11 total

npm packages

8
AISDKUpstashlucide-reactNext.jsReactrechartssonnerZod

Shadcn IconRegistry components

3
buttoninputskeleton

Critical files

  • reddit-validation-agent/route.ts

    API route passing phase-based options (ideaContext, selectedSubreddits, phase) via callOptions for the two-phase agent.

  • ai/reddit-validation-agent.ts

    Two-phase ToolLoopAgent: discovery phase (1 tool) and analysis phase (6 tools). Uses prepareCall to switch instructions based on phase.

  • tools/discover-subreddits.ts

    Subreddit discovery tool for finding relevant Reddit communities.

  • tools/find-pain-points.ts

    Pain point analysis tool searching for frustration expressions in Reddit posts.

  • tools/analyze-existing-solutions.ts

    Tool for analyzing existing solutions discussed on Reddit.

  • tools/detect-willingness-to-pay.ts

    Tool for finding pricing discussions and payment intent signals.

  • tools/validate-demand.ts

    Tool for analyzing discussion frequency and demand trends.

  • tools/find-early-adopters.ts

    Tool for identifying users actively seeking solutions.

  • tools/generate-validation-report.ts

    Final go/no-go validation report tool synthesizing all analysis into a comprehensive scorecard.

Requirements

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