Deal Desk - Hybrid Architecture

glean actions + deterministic calculators

LLMs handle language and intent. Calculators handle math and rules. Neither does the other's job. The Glean agent interprets deal questions in natural language, while external calculator services - ported from existing Excel spreadsheets - deliver exact, auditable, repeatable numbers every time.

Probabilistic
Glean Agent (LLM)
Understands questions, extracts parameters,
retrieves policy docs, generates explanations
neither does
the other's job
Deterministic
Calculator Service (Python)
Runs business rules, computes thresholds,
returns exact numbers, logs every calculation
End-to-End Data Flow
User
Messy Question
"We've got a 500-seat deal with Acme, they want 30% off a 3-year term"
->
LLM
Interpret + Extract
Parses natural language into structured fields: seats: 500, discount: 0.30, term: 36
->
LLM
Search Policy
Retrieves approval matrix, discount tiers, product rules from knowledge base
->
API call
Calculator
Structured JSON in, structured JSON out. Same input = same answer, always.
->
LLM
Interpret Results
Contextualizes numbers against policy, identifies approval path
->
LLM
Respond
"This discount exceeds standard threshold by 5 points - VP Sales approval required."
Architecture Layers
Probabilistic Glean Agent Workflow LLM-driven steps
Knowledge Base
  • Discount approval matrix
  • Product pricing tiers
  • Revenue recognition rules
  • Deal desk SLA docs
  • Regional compliance rules
feeds Step 1
Step 1
Search
Pull deal desk policies and approval matrices from knowledge base
->
Step 2
Branch (SELECT)
Deal structuring / Discount approval / Revenue recognition
->
Step 3
Think
Extract deal parameters from conversational input into structured fields
->
Step 4
Action
Call external calculator API with structured JSON payload
->
Step 5
Think
Interpret calculator results against policy context from Step 1
->
Step 6
Respond
Present recommendation in natural language with approval path
structured JSON request deterministic JSON response
Glean Action (HTTP POST) Glean Action response
Deterministic Calculator Service Python / FastAPI on Fly.io
POST
/calculators/deal-structure
Evaluates deal configuration options: payment schedules, term optimization, product bundling scenarios
IN: products, seats, term, region
OUT: payment_options[], optimal_term, bundle_savings
POST
/calculators/discount-approval
Computes maximum discount by tier, approval level required, and margin impact
IN: product, tier, seats, requested_discount
OUT: max_discount, approval_level, margin_impact, within_policy
POST
/calculators/revenue-recognition
Calculates rev rec schedule per ASC 606, handles multi-element arrangements
IN: deal_components[], start_date, billing_schedule
OUT: recognition_schedule[], deferred_revenue, period_allocations
[!] Ported from Excel. Same business logic as current spreadsheet calculators, unit-tested row-by-row against original outputs. Every API call is logged with inputs and outputs for auditability.
Why This Split Works
Repeatability
Same question, same numbers. Sales reps get consistent answers regardless of how they phrase the question.
Maintainability
Finance updates a threshold? Change one line in Python. The Glean agent never needs to be touched.
Auditability
API logs capture every calculation with exact inputs and outputs. Full trail for compliance and review.
Testability
Calculator endpoints are unit-tested against original Excel outputs. Row-by-row validation before deploy.
Probabilistic (LLM)
Deterministic (API)
Routing (SELECT)
Knowledge Base