Salesforce Decode
Salesforcedecode
Back to questions
AgentforceIntermediateinfinite-loopreliabilityguardrailssession-management

Detect and contain agent infinite loops in multi-action conversations

Real World Scenario

Customers report agents repeatedly asking for order number after it was provided three times, burning session time and credits until timeout.

Expected Answer

• Track action and prompt repetition count per session; force escalation after N identical loops • Persist successfully captured entities in session state preventing re-collection prompts • Detect tool-call cycles where same action invoked with identical inputs without state change • Implement circuit breaker escalating to human when error rate exceeds threshold in session • Log loop signatures for taxonomy fixes—missing entity mapping vs bad action response • Customer-facing apology and exit path when loop detected—not silent retry forever • Alert ops on loop rate spikes indicating deploy regression

Follow-Up Questions & Answers

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

Direct answer: Track action and prompt repetition count per session; force escalation after N identical loops Also consider: Persist successfully captured entities in session state preventing re-collection prompts In practice: Detect tool-call cycles where same action invoked with identical inputs without state change Balance speed of delivery with maintainability.

Architect Perspective

Loops are reliability bugs visible to customers. Combine session state discipline with hard escalation caps—prompts asking the model to stop looping fail under pressure.