Skip to content

Demo App

The CRP demo app is a fully interactive showcase of all 9 dispatch strategies, with metrics comparison, provider auto-detection, and live benchmarking.

Quick Start

# Run with auto-detected provider
python examples/demo_app/demo.py

# Or specify a provider
python examples/demo_app/demo.py --provider ollama --model qwen3-4b

What It Does

The demo app provides four modes:

Mode 1: Quick Demo

Runs a single dispatch with your chosen provider and displays the result with quality metrics (tier, facts extracted, envelope saturation, windows used).

Mode 2: Strategy Comparison

Runs ALL 9 dispatch strategies side-by-side on the same task and produces a comparison table:

Strategy Time Words Quality Facts Windows
dispatch 2.1s 592 B 12 1
dispatch_with_continuation 18.4s 6,993 A 89 9
dispatch_reflexive 3.2s 645 A 15 2
dispatch_progressive 5.1s 1,203 A 28 3
... ... ... ... ... ...

This is the clearest way to see what CRP's continuation engine does — same model, same task, 12x more output with continuation.

Mode 3: Interactive

Opens a prompt where you type your own tasks and see results. Good for exploring how different prompts produce different quality tiers.

Mode 4: Full Benchmark

Runs a comprehensive benchmark across multiple tasks and produces detailed statistics.

The 9 Dispatch Strategies

The demo exercises every strategy CRP offers:

# Strategy What It Tests
1 dispatch() Basic single-window generation
2 dispatch_with_tools() Tool-augmented generation
3 dispatch_reflexive() Self-critique → re-generation
4 dispatch_progressive() Multi-pass progressive deepening
5 dispatch_stream() Streaming token-by-token output
6 dispatch_agentic() Multi-step agent with tool use
7 dispatch_stream_augmented() Streaming with real-time extraction
8 dispatch() with continuation Full continuation engine (multiple windows)
9 dispatch_with_continuation() Explicit continuation dispatch

Provider Auto-Detection

The demo automatically detects available providers:

  1. Ollama — checks http://localhost:11434
  2. LM Studio — checks http://localhost:1234
  3. OpenAI — checks OPENAI_API_KEY env var
  4. Anthropic — checks ANTHROPIC_API_KEY env var
  5. Mock — always available as fallback

If multiple providers are available, you choose from a menu.

Reading the Output

Quality Tiers

Tier Meaning
S Exceptional — all facts grounded, no hallucinations
A Strong — minor gaps only
B Acceptable — some parametric claims
C Marginal — significant gaps
D Poor — mostly ungrounded

Key Metrics

  • Facts extracted: Number of facts pulled from the output by the extraction pipeline
  • Envelope saturation: How full the context envelope is (0.0–1.0)
  • Windows used: How many continuation windows were needed
  • Overhead ratio: CRP protocol overhead vs. useful output

Command-Line Options

python examples/demo_app/demo.py [OPTIONS]

Options:
  --provider TEXT    Provider name (ollama, openai, anthropic, lm-studio)
  --model TEXT       Model name/path
  --base-url TEXT    Custom API base URL
  --api-key TEXT     API key for cloud providers
  --mode TEXT        Demo mode (quick, compare, interactive, benchmark)
  --task TEXT        Custom task description

Example: Comparing With LM Studio

# Start LM Studio with qwen3-4b loaded
# Then run strategy comparison:
python examples/demo_app/demo.py \
  --provider lm-studio \
  --model qwen3-4b \
  --mode compare \
  --task "Write a comprehensive guide to Python async programming"

This shows the dramatic difference between a single dispatch() call (truncated at ~600 words) and dispatch_with_continuation() (complete guide at ~7,000 words across 9 windows).