Recognizing Intent and Asking for Clarification
This lesson covers intent recognition with Amazon Comprehend, Amazon Lex and FMs, and clarification workflows with Step Functions that ask for missing details instead of guessing.
Learning outcomes
After completing this lesson, you will be able to:
- Choose a service for intent recognition.
- Build clarification workflows with Step Functions.
Recognizing intent
Intent recognition classifies a message into the action the user wants, such as track order, change address or ask a policy question, so the application can route it to the right workflow, prompt or agent. Amazon Comprehend custom classification trains a classifier on labelled examples and serves it from a real-time endpoint, giving fast, consistent and inexpensive classification for a fixed set of intents. A small FM classifier with a prompt listing the intents needs no training and adapts to new intents quickly, at a higher per-request cost.
Amazon Lex builds conversational interfaces with intents, slots (the parameters an intent needs, such as date or order number) and prompts that elicit missing slots, for voice and text channels including Amazon Connect contact centres. Lex can call a Lambda function for fulfilment and can hand off to an FM for open-ended questions.
Recognising intent
Clarification workflows with Step Functions
A clarification workflow checks whether a request has everything needed to act. In Step Functions, a task extracts parameters with an FM or Comprehend, a Choice state checks for missing or ambiguous values, and if something is missing a task sends a clarifying question to the user and waits. The wait uses the .waitForTaskToken integration: the token is stored with the session, and when the user replies, the application calls SendTaskSuccess with the answer, and the workflow continues to validation and fulfilment.
Clarification should be targeted: ask one specific question ("Which of your two orders, #1182 or #1190?") rather than a generic "please provide more details", and limit the number of rounds before handing off to a human. The following table compares intent recognition options.
| Option | Strengths | Considerations |
|---|---|---|
| Comprehend custom classification | Fast, cheap, consistent for fixed intents | Needs labelled training data and an endpoint |
| FM classifier prompt | No training; easy to add intents | Higher cost per request; needs validation |
| Amazon Lex | Intents, slots, elicitation, voice and contact centre | Structured dialogs rather than open-ended chat |
The following diagram shows the clarification step in the workflow.

A clarification workflow
Ambiguous refund requests
A retail assistant issues refunds through an agent. When customers say "refund my order" and have several recent orders, the agent sometimes picks the wrong one.
The fix is a clarification step: a Step Functions workflow extracts the order reference; if it is missing or matches more than one order, it sends a question listing the candidate orders and waits with a task token; the refund runs only after the customer confirms a specific order.
Which service handles slot filling for structured dialogs, including voice?
Show answer
Amazon Lex.
Exam Tips
Remember for the exam
- Fixed intents at low cost: Comprehend custom classification.
- Slot filling for structured dialogs and voice: Amazon Lex.
- Wait for the user's answer in a workflow: Step Functions waitForTaskToken.
- Ask specific clarifying questions rather than guessing.