By clicking "Accept all cookies", you agree to the storing of cookies on your device to enhance site navigation, analyse site usage, and assist in our marketing efforts. Privacy Policy

    Firstshift company logo
    Back to Whitepapers
    TechnicalOctober 9, 202621 pages

    Context Management for AI Planning Queries

    Context Management for LLM Text-to-SQL in Demand and Supply Planning: Retrieval Granularity, Prompt-Cache Economics, and Measurement Under Multi-Call Agentic Loops

    Shyam Sayana, Dharma Palepu, Saroj Farhana, CP Agrawal and Anshuk Pal Chaudhuri

    How the engineering team behind Supply Chain Canvas makes AI answers to planning questions trustworthy: retrieval granularity, prompt-cache economics, and auditable grounding.

    Supply Chain Canvas lets planners ask questions about their supply chain in plain language and get answers from their own planning data. This paper describes the context-management design behind those answers, written by the engineering team that built it.

    Key takeaways

    • The dangerous error is a plausible wrong number, not a failed query. In planning data, a missing filter or a measure summed the wrong way still returns results that look right, so correctness depends on business rules the database schema does not contain.

    • Giving the model the right rules matters more than giving it more text. Splitting the knowledge base into 330 small, self-contained topic pages lets the model choose complete rules instead of keyword fragments, and correct its choice before it answers.

    • Grounding is enforced, not requested. The system cannot generate an answer until it has read real documentation, and every read is logged so each answer can be audited afterward.

    • Prompt caching makes the design affordable. The large, static index is paid for once per cache window rather than on every step, making it roughly 2.6× to 10× cheaper than naive accounting suggests.

    • The hardest failures look correct. Because inspection cannot tell a right answer from a wrong one, the system is built for structural enforcement and after-the-fact auditability.

    Inside the paper

    • Why planning-domain text-to-SQL is a "silent wrongness" problem rather than a syntax problem

    • Monolithic knowledge base vs. a 330-page split corpus read by an agentic loop, compared on identical content

    • A per-call cost model for multi-call agentic retrieval under prompt caching

    • A failure-mode taxonomy drawn from observed failures, and a retry-aware provenance record for auditing answers

    Who it's for: data, IT and engineering leaders evaluating how AI planning tools produce trustworthy answers.

    Download this whitepaper

    Fill out the form below to receive your free copy of Context Management for AI Planning Queries.