Skip to main content

Overview

The CLI provides a lightweight interface for analyzing business URLs and adding qualified leads to your CRM. It’s ideal for batch processing, automation scripts, and quick one-off analyses.

Running the CLI

Basic Syntax

Analyze a single business URL:
python main.py `<url>`

Example Usage

python main.py https://example.com

Understanding Output

The CLI provides structured output with three possible outcomes:

Success (Lead Added to CRM)

--- Evaluation Result ---
{
  "business_name": "Austin Plumbing Solutions",
  "business_type": "Plumbing Service",
  "primary_service": "Foundation Package",
  "secondary_service": null,
  "fit_score": 85,
  "reasoning": "Local service business with weak online presence. Foundation Package would establish professional web identity.",
  "outreach_angle": "Help local customers find you online with a mobile-responsive website that showcases your services and builds trust."
}
------------------------

SUCCESS: ADDED TO CRM: 'Austin Plumbing Solutions' (https://austinplumbing.com)
Latency: 12.34s
Usage: 2,847 tokens (P: 2,103, C: 744)
The _usage field tracks your AI token consumption. Monitor this to manage API costs effectively.

Skipped (Duplicate Found)

--- Evaluation Result ---
{
  "business_name": "Austin Plumbing Solutions",
  "business_type": "Plumbing Service",
  "primary_service": "Foundation Package",
  "secondary_service": null,
  "fit_score": 85,
  "reasoning": "Local service business with weak online presence.",
  "outreach_angle": "Help local customers find you online..."
}
------------------------

SKIPPED CRM INSERTION: https://austinplumbing.com
Reason: Duplicate found in CRM
Duplicate detection is based strictly on the Business URL. The same business at different URLs will create multiple entries.

Error (Processing Failed)

Analyzing https://invalid-site.com...

ERROR: No content could be extracted from the URL.
Common error scenarios:
  • Network timeout: Site didn’t respond within timeout limit
  • No content extracted: Page blocked scraping or contained no text
  • AI Evaluation failed: LLM returned invalid response or hit rate limits
  • Coda sync failed: API token invalid or table structure mismatch

Token Usage Display

Every successful analysis displays token consumption:
Usage: 2,847 tokens (P: 2,103, C: 744)
  • Total tokens: Combined prompt + completion tokens
  • P (Prompt tokens): Tokens sent to the LLM (website content + context)
  • C (Completion tokens): Tokens generated by the LLM (analysis result)
Longer website content = higher prompt tokens. Average analysis uses 2,000-4,000 tokens.

Batch Processing Tips

Processing Multiple URLs

Create a shell script for batch processing:
batch_analyze.sh
#!/bin/bash

# Read URLs from file
while IFS= read -r url; do
  echo "Processing: $url"
  python main.py "$url"
  echo "---"
  sleep 2  # Rate limiting pause
done < urls.txt
Usage:
chmod +x batch_analyze.sh
./batch_analyze.sh

Best Practices

Add Delays

Insert 2-3 second delays between requests to avoid hitting API rate limits

Log Results

Redirect output to a log file: python main.py URL >> results.log 2>&1

Handle Errors

Wrap calls in try-catch blocks and continue processing on individual failures

Monitor Tokens

Track cumulative token usage across batch runs to manage costs

Performance Optimization

# Parallel processing (use with caution)
cat urls.txt | xargs -P 3 -I {} python main.py {}
Parallel processing can quickly exhaust API rate limits. Start with -P 2 (2 parallel processes) and monitor for errors.

Exit Codes

The CLI uses standard exit codes:
  • 0: Success (lead added or skipped)
  • 1: Error occurred (check output for details)
Use in automation:
python main.py https://example.com
if [ $? -eq 0 ]; then
  echo "Analysis completed"
else
  echo "Analysis failed"
fi

Troubleshooting

”Usage: python main.py <url>

You forgot to provide a URL argument:
# Wrong
python main.py

# Correct
python main.py https://example.com

“GROQ_API_KEY not found in environment variables”

Your .env file is missing or incorrectly configured. See Configuration.

Slow Performance (>20s)

The engine targets <20s latency. If consistently slower:
  1. Check your network connection
  2. Verify the target site loads quickly in a browser
  3. Monitor Groq API status
  4. Reduce website content size (the engine extracts full page text)

Next Steps

Telegram Bot

Use the interactive bot interface for easier lead analysis

Configuration

Customize behavior with environment variables and service definitions

Build docs developers (and LLMs) love