Salesforce Decode
Salesforcedecode
Back to questions
AgentforceAdvancedcontext-windowtoken-budgetemailsummarization

Manage token budgets for long email and case thread agent sessions

Real World Scenario

Enterprise B2B cases with 40-email threads exceed context limits. The agent either truncates critical history or burns credits re-sending full threads each turn.

Expected Answer

• Implement rolling conversation summaries stored in session context updated after each significant turn • Retrieve only relevant case comments via semantic search rather than full thread injection • Define hard token budgets per channel with priority ranking: recent messages > case metadata > full history • Use structured case timeline objects maintained by Apex summarization jobs for agent consumption • Avoid re-grounding entire knowledge base when follow-up is clarifying a single field • Monitor average tokens per session and alert on sessions exceeding 2x median • Test summarization fidelity—critical commitments and dates must survive compression

Follow-Up Questions & Answers

Click to expand — each follow-up includes a direct, interview-ready answer

Direct answer: Implement rolling conversation summaries stored in session context updated after each significant turn Also consider: Retrieve only relevant case comments via semantic search rather than full thread injection In practice: Define hard token budgets per channel with priority ranking: recent messages > case metadata > full history Optimize for scale and operational observability.

Architect Perspective

Long-thread agents need memory architecture, not bigger windows. Summarize, index, and retrieve surgically—unbounded context is a cost and accuracy trap.