Ask a Salesforce assistant, “What’s the status of my case?” If you haven’t given it a case number, its next move might be a question. If you have, it can look up the record. Loop engineering is the work of deciding how an application handles those turns, carries information forward, and knows when the task is complete.

Follow one case through the loop
1. Ask for what’s missing. The application adds the user’s question to the conversation history and passes that context to the model. The model can reply, “What’s your case number?” No tool call is needed. The application keeps the exchange in history and waits for the user’s reply.
2. Act on the next prompt. The user replies, “00012345.” On its own, that number says little. With the earlier question in context, the model can request a case lookup. The application validates the request and runs the tool with the user’s Salesforce permissions.
3. Bring the result back. Suppose the tool returns a status of Working. The application adds the tool call and its result to the conversation history, then gives the updated context to the model. The model now has the information it needs to answer, “Case 00012345 is marked Working.”
4. End the turn. The application delivers the answer and reaches Done. If the user asks a follow-up, a new turn can use the existing history. If the lookup fails, the assistant should explain what it could verify and avoid guessing the status.
What to check when the loop repeats
If an agent keeps requesting the same lookup, check what the model receives on the next turn. Did the application include the tool result and match it to the original call? A missing result can make a completed lookup look unfinished. Set a maximum number of tool rounds so a repeated call eventually stops with a useful response.
Find more Salesforce developer walkthroughs on Salesforce Hunt on YouTube.
0 Comments