Lesson 2 of 14 · 4 min
Why this is hard
Pure-prompt agents stall. Pure-deterministic agents are brittle. Guided determinism is the middle path.
The previous lesson laid out what the refund agent does. Before we look at how it's built, it helps to see why the obvious approaches don't work. A naive agent tends toward one of two extremes. Both fail.
Failure mode A: pure prompt, no structure
The model is told "verify the customer, then refund their order, then send a reply." No actions are gated, no variables are tracked. What happens:
- The model narrates instead of acting ("I'm verifying you now" but no Apex was called).
- The model forgets what state it is in across turns.
- The model hallucinates outputs ("Your customer ID is 12345" with no source).
- You cannot reliably enforce "must verify before refund."
Failure mode B: pure deterministic, every turn scripted
Every transition is a hard if. What happens:
- The agent feels robotic.
- It cannot handle compound user input ("refund INV-1007, my email is alice@salesforce.com" with both pieces in one message).
- Adding a new edge case means adding another
ifbranch. - It cannot recover gracefully from off-script user phrasing.
The pattern: the LLM picks what to do next. Deterministic gates decide what is allowed. Backing actions decide what is true. Each of those three sentences corresponds to a different control surface. The next lesson unpacks them.