Concept
A digression is a handler for an interruption. When the customer’s message matches a digression, the runtime runs the digression actions. ARESUME at the end returns to the step that was waiting, and asks its pending question again.
You can declare a digression in two places:
The runtime checks step digressions first, then global digressions.
Digressions differ from sub-intents. A digression can jump to a step, hand off, delegate, and resume. A sub-intent only runs a small handler and stays. See Use scoped sub-intents inside a flow step.
Minimal working example
A returns agent collects an order number and a category. Customers may ask about the return policy, ask where to find the order number, or ask for a person. Theget_return_policy tool is a project-local assumption. Bind it to your policy service in Project Tools.
agents/returns-assistant.agent.abl
agents/human-support.agent.abl
order_id,product_category, andreturn_reasonareGATHERfields that the customer supplies.human_requestedis set by the digression.policy_textcomes from the tool call.
How it works
Write each digression as a list item with anINTENT name, optional KEYWORDS, and a DO list of actions.
Actions allowed in DO: RESPOND, SET, CLEAR, CALL, HANDOFF, DELEGATE, GOTO, and RESUME. LOG is not allowed. Write every action line with a leading dash. Write a plain - RESUME.
Rules the compiler enforces:
A digression without a terminal action sends its reply, ends the turn, and leaves the step current. It does not repeat the question.
How a digression is detected:
- A decision-model check runs first, when your project enables it.
- The classifier runs with each digression as a candidate. Its description is the humanized
INTENTplus theKEYWORDSas examples. - The keyword fallback matches
KEYWORDS, subject toLEXICAL_FALLBACK. - A
CONDITION, if you write one, runs only after a candidate matched. A failed condition blocks the digression.
KEYWORDS and with a plain name is semantic only. It cannot match when the classifier is off.
What happens when the step is waiting for an answer:
- When the message holds both an answer and an interruption, the runtime extracts the answer first and then handles the digression.
- When the digression has a
GOTOto another step, or aHANDOFForDELEGATEthat returns, and the step still needs answers, the runtime queues it as a pending request. The step stays current and keeps collecting. The queue is traced withgather_locked_intent_queued. - A digression that only replies, sets, calls, resumes, or hands off without returning runs at once.
A digression does not run when a supervisor route owns the turn, during secure card entry, or when an intent is pinned.
What happens to a queued digression
A queued digression joins the same request queue that multi-intent handling uses. The runtime does not run it while the flow is still collecting.- The flow finishes.
- The runtime appends a notice to the final reply. The default wording is
Next: <request>. Would you like me to help with that?It opens an offer and waits for the customer’s answer. The trace showsmulti_intent_queue_surfaced. - If the customer accepts, the runtime runs the queued target. A
GOTOmoves the flow to that step. AHANDOFForDELEGATEgoes to that agent. - If the customer declines, the runtime drops the request.
- A queued request expires after
queue_max_age_msfrom theMULTI_INTENTsection. The default is 600000 milliseconds, which is 10 minutes. An expired request leaves the queue with a traced reason. - The queue holds at most
max_intentsrequests. The default is 3. - The runtime drops a request whose target is switched off.
Common variations
A step digression
DeclareDIGRESSIONS: inside the step for help that applies only there, as the order number help does.
Delegate and resume
Use aDELEGATE with RETURN: true, then RESUME, to do a lookup and come back. The delegate target must exist in the project, and the delegate needs its own INPUT mapping. See Delegate and map the result.
Legacy flat form
Older agents writeRESPOND, GOTO, CLEAR, CALL, and RESUME: true directly under the digression. This still works. You cannot mix it with DO. A legacy DELEGATE warns W261. Use DO for new agents, because only DO supports HANDOFF and ordered actions.
Verification
- Run the validator on both files. Expect no errors and no warnings.
- At the order number question, say “what is your return policy”. Expect the policy reply and then the order number question again.
- Say “where do I find my order number”. Expect the help text and the question again.
- Say “I want to talk to a human”. Expect the handoff to
Human_Support. - Say “order A100, and what is your return policy”. Expect the order number to be stored, and then the policy reply.
- Add a digression with a
GOTO. While the order step still needs answers, say a phrase that matches it. Expect the step to keep collecting and the trace to showgather_locked_intent_queued. After the flow ends, expect the “Next:” offer. - In the trace, open the
digressionevents. Checkintent,matched,detectionMode, andinputClassification. Look foranswer_with_interruptionin step 5.
Production readiness checklist
- Every digression ends with a deliberate terminal action, or with a reply only.
- Every
HANDOFFtarget is in the agentHANDOFF:section, and itsWHENvariable is declared. - Every
KEYWORDSlist is on one line. - Every
INTENTis a snake_case name with no spaces. - Every tool used in a digression has a
read_onlyeffect and parameter descriptions where it only reads. - Tests cover a side question, an answer with a side question, a request for a person, a normal answer, and a queued digression with its offer.
- Tests run with the classifier on and off.
Common mistakes
Troubleshooting
Related articles: