Problems solved
- Extract competitor site data with Firecrawl map and scrape
- Analyze positioning, pricing tiers, and feature matrices
- Detect technologies used on competitor properties
- Generate sales battle cards from live competitor pages
Use cases
- Sales competitive intelligence
- Pricing strategy research
- Feature gap analysis
- Product roadmap inputs from competitor sites
- Battle cards for account executives
Setup
Requirements, wiring steps, and what this pattern adds to your project.
Requirements
- Complexity
- Advanced
- Setup time
- ~10 minutes
- Node
- 24+
- Memory
- 256MB
Getting started
Pick how you want to pull this pattern in — then wire env vars and routes the same way.
- 1
Install from the preview toolbar

Copy the install command above and run it in your project — Pro patterns include a short-lived token.
- 2
Add environment variables to .env.local
OPENAI_API_KEY, FIRECRAWL_API_KEY, UPSTASH_REDIS_REST_URL, UPSTASH_REDIS_REST_TOKEN
- 3
Point client fetches at your API routes
Replace preview `/view/.../api/...` paths with `/api/...` in the installed files.
- 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
Run your dev server and open the pattern route
Install dependencies if needed, then start the app and verify responses.
Environment variables
Capabilities
AI SDK APIs
useChatgatewayToolLoopAgenttoolhasToolCallstepCountIscreateAgentUIStreamResponseInferAgentUIMessageDefaultChatTransportUIMessageProviders
External services
Files added
16 filesapp/page.tsxapp/layout.tsxapp/api/competitor-agent/route.tslib/actions.tslib/competitor-types.tslib/rate-limit.tslib/agent-research.tslib/transform-utils.tslib/ai/competitor-agent.tslib/ai/tools/analyze-positioning.tslib/ai/tools/extract-pricing.tslib/ai/tools/identify-features.tslib/ai/tools/analyze-tech-stack.tslib/ai/tools/find-weaknesses.tslib/ai/tools/generate-battlecard.tsREADME.md
Dependencies
14 totalnpm packages
8
Registry components
Critical files
competitor-agent/route.tsAPI route using createAgentUIStreamResponse with competitorContext via callOptions.
ai/competitor-agent.tsToolLoopAgent with 6 competitor analysis tools, callOptionsSchema + prepareCall for context injection.
lib/actions.tsServer action implementing Firecrawl-based competitor scraping pipeline: map website, identify key pages, parallel scrape, LLM extraction via generateObject.
lib/agent-research.tsDeep research functions (researchPricing, researchFeatures, researchTechStack, researchReviews) with detailed Zod schemas for structured extraction.
tools/analyze-positioning.tsTool for extracting value propositions, target audience, and competitive positioning.
tools/extract-pricing.tsTool for structuring pricing tiers, models, and billing options from competitor data.
tools/identify-features.tsTool for building categorized feature matrices from competitor websites.
tools/analyze-tech-stack.tsTool for detecting frontend/backend technologies, infrastructure, and third-party services.
tools/find-weaknesses.tsTool for identifying feature gaps, UX issues, and competitive opportunities.
tools/generate-battlecard.tsTool for generating comprehensive sales battle cards with objection handling.










