Skip to content

LLM Strategy

Hybrid Approach

  • Simple tasks: Regex classification → deterministic handler (0ms, zero cost)
  • Complex tasks: LLM agent with function-calling (2-3s per turn, ~$0.01/task)

Primary: Gemini 2.5 Flash (Vertex AI)

  • Fast (~2s/turn), native function-calling
  • Available via existing GCP account

Fallback: Claude Sonnet 4.6

  • Better reasoning for complex tasks
  • PDF understanding for invoice OCR

Agent Loop

  • Max 15 turns per task
  • Auto-fix 422 errors between turns
  • Pre-fetch company context during first LLM call
  • 280s timeout