Model Strategy

4-tier model hierarchy, AWS Bedrock routing, Anthropic fallback, and circuit breaker

4-Tier Model Strategy

Krawl uses a tiered model approach — cheaper/faster models for high-volume tasks, premium models for intelligence-critical work.

TierModelTasksCall Volume
Tier 1 (budget)bedrock/us.anthropic.claude-haiku-4-5-20251001-v1:0Query generation, URL ranking, perspective discovery, memory extractionHigh (10–30+ per session)
Tier 2 (mid)bedrock/us.anthropic.claude-sonnet-4-6Learning extraction, flat agent loopModerate (5–15 per session)
Tier 3 (quality)bedrock/us.anthropic.claude-sonnet-4-6Planning, gap analysis, review passesLow (2–5 per session)
Tier 4 (apex)bedrock/us.anthropic.claude-opus-4-7Synthesis, revision passes1 call per session
xAIgrok-4.20-0309-non-reasoningX/Twitter search onlyPer X search

Why This Approach

  • Cost control — Haiku handles 60%+ of LLM calls at ~10x lower cost than Opus
  • Quality where it matters — Opus only fires once for the final synthesis, producing the best possible report
  • Speed — Haiku is fast enough for real-time query generation during recursive search

Provider Routing

Primary: AWS Bedrock

All Claude models route through AWS Bedrock via litellm. The us. prefix uses cross-region inference profiles — AWS automatically routes to the least loaded region.

bedrock/us.anthropic.claude-haiku-4-5-20251001-v1:0
bedrock/us.anthropic.claude-sonnet-4-6
bedrock/us.anthropic.claude-opus-4-7

Required env vars:

  • AWS_BEDROCK_ACCESS_KEY_ID
  • AWS_BEDROCK_SECRET_ACCESS_KEY
  • AWS_BEDROCK_REGION (default: us-east-1)

Fallback: Anthropic Direct API

If any Bedrock call fails, Krawl automatically retries with the equivalent Anthropic direct API model:

Bedrock ModelFallback Model
bedrock/us.anthropic.claude-sonnet-4-6anthropic/claude-sonnet-4-6
bedrock/us.anthropic.claude-opus-4-7anthropic/claude-opus-4-7
bedrock/us.anthropic.claude-haiku-4-5-20251001-v1:0anthropic/claude-haiku-4-5-20251001

Requires ANTHROPIC_API_KEY to be set.

X/Twitter search uses xAI's Grok model directly — not through litellm or Bedrock. The API call goes straight to https://api.x.ai/v1.

Model: grok-4.20-0309-non-reasoning

Requires XAI_API_KEY.

Circuit Breaker

Krawl implements a circuit breaker pattern for Bedrock:

  1. Each Bedrock failure increments a counter
  2. After 3 consecutive failures, the circuit opens
  3. While open (5 minutes), all calls go directly to Anthropic fallback — skipping Bedrock entirely
  4. On the next successful Bedrock call, the circuit resets
Normal: Bedrock → (success) → reset counter
         Bedrock → (fail) → counter++ → try Anthropic fallback
         Bedrock → (fail) → counter++ → try Anthropic fallback
         Bedrock → (fail) → counter=3 → CIRCUIT OPEN

Open:   Skip Bedrock → Anthropic direct (for 5 minutes)

After 5min: Try Bedrock again
         Bedrock → (success) → CIRCUIT RESET → counter=0

Constants:

  • _CIRCUIT_FAIL_THRESHOLD = 3
  • _CIRCUIT_OPEN_SECONDS = 300 (5 minutes)

Model Override

You can override any model at the request level:

{
  "query": "...",
  "model": "anthropic/claude-sonnet-4-6"
}

This overrides all phases (planning, research, synthesis). Useful for testing or when you want to force a specific provider.

You can also override via env vars:

MODEL_PLANNING=anthropic/claude-sonnet-4-6
MODEL_RESEARCH=anthropic/claude-sonnet-4-6
MODEL_SYNTHESIS=anthropic/claude-opus-4-7
MODEL_QUERY_GEN=anthropic/claude-haiku-4-5-20251001

Opus 4.7 Notes

  • Opus 4.7 does not support the temperature parameter — Krawl automatically omits it
  • Used only for synthesis (1 call per session) due to cost
  • Produces the highest quality reports with better citation handling

On this page