Inferensys

Prompt

Slot-Filling Clarification Prompt for Task Agents

A practical prompt playbook for using Slot-Filling Clarification Prompt for Task Agents in production AI workflows.
Engineer reviewing agent handoff workflow on laptop, task routing diagrams visible, technical office setup.
PROMPT PLAYBOOK

When to Use This Prompt

Defines the ideal job-to-be-done, user, and context for the slot-filling prompt, and explicitly states when simpler or alternative approaches are better.

This playbook is for developers building task-oriented assistants that must collect a specific set of structured parameters from a user across multiple conversation turns. The ideal job-to-be-done is a deterministic, state-aware dialogue where the assistant acts as a form-filling engine, not an open-ended chatbot. Use this when your assistant needs to gather 3 to 15 required slots—such as meeting details, ticket fields, or device configuration parameters—and you need the system to reliably track which slots are filled, which are missing, and which one to ask for next, without re-prompting for information the user has already provided.

The prompt is designed for a specific architectural pattern: a state machine managed in the application layer that feeds a structured state object into the prompt on every turn. The model's only job is to reason about that state and produce a deterministic JSON output containing the next action. This is not a prompt for handling casual chit-chat, answering general knowledge questions, or managing a conversation with an unbounded set of intents. It is a poor fit for workflows where the required parameters are unknown at the start of the session or where the user's goal shifts fluidly. In those cases, a more flexible intent-routing architecture with dynamic tool selection is a better choice.

Before implementing this, ensure you have a defined schema for your task's required slots, including their types, priorities, and validation rules. The prompt's value is in its strict adherence to a state machine; it will not invent slots or infer user intent beyond the provided schema. If your use case involves high-risk actions like financial transactions or medical scheduling, you must add a human review step before executing the final task. The prompt itself will not make safety judgments. Proceed to the next section to copy the prompt template and wire it into your state management logic.

PRACTICAL GUARDRAILS

Use Case Fit

Where this slot-filling prompt works, where it breaks, and the operational conditions required for reliable use.

01

Good Fit: Structured Task Agents

Use when: The agent has a known, finite set of required parameters (slots) to collect before executing a task. Why it works: The prompt can systematically check a state object, identify the highest-priority missing field, and ask a targeted question without losing conversational flow.

02

Bad Fit: Open-Ended Exploration

Avoid when: The user's goal is browsing, discovery, or an ill-defined task with no clear parameter list. Risk: The prompt will force unnecessary clarification questions, creating a frustrating, rigid interrogation that wastes the context budget on low-signal turns.

03

Required Input: A Strict State Schema

Dependency: The prompt requires a pre-defined, machine-readable state object (e.g., JSON) with fields for required_slots, optional_slots, filled_slots, and missing_slots. Guardrail: Without this structured input, the prompt cannot reliably track progress and will either re-ask for known values or skip critical parameters.

04

Operational Risk: Redundant Re-Asking

What to watch: The model asks for a slot value the user already provided in a previous turn, often because the value was normalized or stored in a way the prompt's validation logic didn't recognize. Guardrail: Implement a state diff check before generating the prompt. If no new slots were filled after the last user turn, trigger a repair path instead of the standard slot-filling prompt.

05

Operational Risk: Slot Conflict Resolution

What to watch: A new user input provides a value that logically conflicts with a previously collected slot (e.g., a departure date after the return date). The prompt ignores the conflict and continues filling other slots. Guardrail: Add a conflict detection step before the missing-slot check. If a conflict is found, the prompt must surface the contradiction and ask for a correction, not just the next missing value.

06

Operational Risk: Context Window Starvation

What to watch: Long slot-filling sequences with verbose validation errors and full state dumps consume the context window, leading to mid-procedure amnesia. Guardrail: Pass a compressed state summary (only slot names and filled values) instead of the full dialogue history. Implement a hard limit on the number of clarification turns before escalating to a human or a summary-based handoff.

PROMPT PLAYBOOK

Copy-Ready Prompt Template

A reusable system instruction for task agents to identify missing slots, ask for the highest-priority value, and validate partial fills without re-asking for known information.

This prompt template is designed to be inserted into your system message for a task-oriented agent. It assumes your application harness maintains a structured state object of [CURRENT_SLOTS] and a [REQUIRED_SLOTS] schema. The prompt instructs the model to act as a state machine: it must check which required slots are still missing, select the single highest-priority missing slot, and generate one targeted clarification question. It must not re-ask for slots that are already filled and must validate any new information the user provides against the expected type and constraints for that slot.

text
You are a task agent responsible for collecting required information from the user to complete a task. You operate on a strict slot-filling protocol. Do not proceed to task execution until all required slots are filled and validated.

CURRENT KNOWN SLOTS:
[CURRENT_SLOTS]

REQUIRED SLOT SCHEMA:
[REQUIRED_SLOTS]

SLOT-FILLING PROTOCOL:
1. **Check for completeness:** Compare `[CURRENT_SLOTS]` against `[REQUIRED_SLOTS]`. If all required slots have valid, non-null values, respond with `[COMPLETION_CONFIRMATION]` and stop the slot-filling loop.
2. **Identify missing slots:** Create a list of slots that are missing or have invalid values according to the schema.
3. **Prioritize:** Select the single highest-priority missing slot. Priority is defined by the `priority` field in `[REQUIRED_SLOTS]` (lower number = higher priority).
4. **Validate new input:** If the user's last message provides a value for a missing slot, validate it against the `type` and `constraints` in `[REQUIRED_SLOTS]`. If valid, update the slot. If invalid, do not update the slot and instead ask for the value again, explaining the constraint.
5. **Ask one question:** Generate a single, clear, and concise question asking for the value of the highest-priority missing slot. Do not ask about multiple slots at once. Do not re-ask for slots that are already filled.
6. **Handle ambiguity:** If the user's input is ambiguous for a slot, ask a targeted disambiguation question specific to that slot before moving on.

CONSTRAINTS:
[CONSTRAINTS]

EXAMPLES:
[EXAMPLES]

To adapt this template, replace the placeholders with your application's runtime state. [CURRENT_SLOTS] should be a JSON or YAML object of filled key-value pairs. [REQUIRED_SLOTS] should be a schema defining each slot's type, priority, and constraints. The [CONSTRAINTS] block is where you inject domain-specific rules, such as 'never ask for a user's password' or 'confirm the email address format.' The [EXAMPLES] block is critical for teaching the model the desired tone and format of the clarification question. Without examples, the model may default to verbose, multi-part questions that violate the single-question rule. After the agent signals completion via [COMPLETION_CONFIRMATION], your application harness should hand control to the execution phase of your workflow.

IMPLEMENTATION TABLE

Prompt Variables

Inputs the slot-filling clarification prompt needs to work reliably. All placeholders must be populated by your application harness before sending the prompt to the model.

PlaceholderPurposeExampleValidation Notes

[REQUIRED_SLOTS]

Schema defining all slots the agent must collect, including type, description, and required flag for each.

{"destination": {"type": "string", "required": true}, "departure_date": {"type": "date", "required": true}}

Must be valid JSON schema. Parse check before prompt assembly. Required fields must be explicitly marked.

[CURRENT_SLOT_STATE]

Current values for all slots, including empty, partial, and filled states from prior turns.

{"destination": "London", "departure_date": null, "passengers": 2}

Must match [REQUIRED_SLOTS] keys exactly. Null allowed for unfilled slots. Validate key set equality before sending.

[CONVERSATION_HISTORY]

Last N turns of the conversation, including user messages and assistant responses, for context on what has already been asked.

[{"role": "user", "content": "Book a flight"}, {"role": "assistant", "content": "Where would you like to go?"}]

Must be an array of message objects with role and content. Truncate to last 10 turns to manage context budget. Validate array structure.

[PRIORITY_ORDER]

Ranked list of slot names indicating the order in which missing slots should be requested.

["destination", "departure_date", "return_date", "passengers"]

Must be a subset of [REQUIRED_SLOTS] keys. No duplicates allowed. Validate ordering is complete for all required slots.

[MAX_CLARIFICATIONS_PER_TURN]

Integer limit on how many missing slots to ask about in a single response to avoid overwhelming the user.

1

Must be a positive integer. Default to 1 if not specified. Validate range 1-3 to prevent excessive back-and-forth or cognitive overload.

[CONFIDENCE_THRESHOLD]

Float between 0 and 1. If the model's confidence in a partial fill is below this threshold, treat the slot as unfilled and request clarification.

0.85

Must be a float between 0.0 and 1.0. Validate range. Higher values increase clarification frequency; lower values risk accepting incorrect fills.

[OUTPUT_FORMAT]

Expected output structure for the clarification response, including the question text and updated slot state.

{"clarification_question": "string", "target_slot": "string", "updated_state": {}}

Must be valid JSON schema. Parse check required. Output validator should confirm response matches this schema before surfacing to user.

PROMPT PLAYBOOK

Implementation Harness Notes

How to wire the slot-filling prompt into a production task agent with state management, validation, and retry logic.

The slot-filling clarification prompt is not a standalone chatbot; it is a stateful component inside a larger task agent loop. The application must maintain a structured session state object that tracks required slots, their current values, fill status, and the history of clarification questions asked. Before each call to the LLM, the harness serializes this state into the [CURRENT_STATE] placeholder, including only the slots that are still missing or have been partially filled. After the model responds, the harness parses the structured output to update the state, not to display the response directly to the user unless the model explicitly returns a clarification_question.

The core implementation loop follows a strict pattern: hydrate state → assemble prompt → call model → validate output → update state → decide next action. If the model returns a filled_slot with a value, the harness must validate that value against the slot's constraints (type, enum membership, regex pattern, or business rule) before accepting it. If validation fails, the harness should re-invoke the prompt with the validation error injected into [PREVIOUS_ERRORS] rather than silently discarding the bad fill. This prevents the model from repeating the same invalid extraction pattern. For high-stakes domains like healthcare or finance, insert a human review gate after slot validation but before the slot is committed to the downstream system of record.

Retry logic must be bounded. A common failure mode is the model returning a clarification_question for a slot it already asked about in a prior turn, creating a frustrating loop. The harness should track asked_slots in session state and, if the model proposes a clarification for a previously asked slot, either escalate to a human agent or force the model to proceed with a best-guess assumption by setting [FORCE_ASSUMPTION] to true in the next prompt call. Implement a maximum of two clarification attempts per slot before falling back to a default or escalating. Log every state transition, validation result, and retry decision to your observability platform for debugging slot-filling loops in production.

Model choice matters here. This prompt requires strong instruction-following and structured output capabilities. Prefer models with native JSON mode or function-calling support (e.g., GPT-4o, Claude 3.5 Sonnet) and use their built-in structured output features to enforce the [OUTPUT_SCHEMA] rather than relying solely on prompt instructions. For local or open-weight models, pair this prompt with a schema validation library like instructor or outlines to guarantee parseable JSON. Never pass raw model output directly to your state update logic without schema validation—malformed JSON or hallucinated slot names will corrupt session state and produce broken user experiences.

IMPLEMENTATION TABLE

Expected Output Contract

The model must return a structured JSON object identifying missing slots, the highest-priority question to ask, and a validation record of the current state. Use this contract to parse the response in your application harness before surfacing any text to the user.

Field or ElementType or FormatRequiredValidation Rule

clarification_decision

string enum: ASK_CLARIFICATION | PROCEED

Must match one of the two enum values exactly. If PROCEED, the agent should execute the task without asking the user for more information.

missing_slots

array of objects

Each object must contain slot_name (string), priority (integer), and reason (string). Array must be empty if clarification_decision is PROCEED. Priority must be a positive integer with no duplicates.

target_question

object

Must contain question_text (string) and target_slot (string). target_slot must match a slot_name in missing_slots. This field must be null if clarification_decision is PROCEED.

question_type

string enum: SINGLE_SELECT | MULTI_SELECT | FREE_TEXT | CONFIRMATION

Must be null if clarification_decision is PROCEED. If ASK_CLARIFICATION, must be one of the four enum values and must match the structure of provided_options.

provided_options

array of strings

Required if question_type is SINGLE_SELECT or MULTI_SELECT. Must contain 2-5 distinct, non-empty strings. Must be null for FREE_TEXT and CONFIRMATION types.

validated_slots

array of objects

Each object must contain slot_name (string), value (string), and confidence (float 0.0-1.0). Must include all slots that have been filled with high confidence from the current and prior turns.

conflict_flag

boolean

Set to true if the current user input contradicts a previously validated slot value. If true, the conflict_details field must be populated.

conflict_details

object

Required if conflict_flag is true. Must contain conflicting_slot (string), prior_value (string), and new_value (string). Must be null if conflict_flag is false.

PRACTICAL GUARDRAILS

Common Failure Modes

Slot-filling prompts break in predictable ways. Here are the most common failure modes and how to guard against them before they reach users.

01

Re-asking for Already-Provided Slots

What to watch: The assistant asks for a slot value the user already provided in a prior turn, creating a frustrating loop. This happens when slot extraction from conversation history is weak or the state tracker resets mid-session. Guardrail: Include explicit turn-history review instructions in the prompt. Require the model to list all currently filled slots before generating any clarification question. Validate against a structured dialogue state object, not raw text.

02

Asking for Low-Priority Slots First

What to watch: The assistant asks for an optional or low-importance slot before resolving a required field, wasting user patience and context budget on trivia. Guardrail: Define a strict slot priority order in the prompt schema. Instruct the model to always ask for the highest-priority missing required slot. Include a priority field in your slot definitions and validate that clarification questions target the lowest-numbered missing slot.

03

Slot Value Conflict with Prior Turns

What to watch: The user provides a new value that contradicts an earlier value for the same slot, and the assistant silently overwrites or ignores the conflict. Guardrail: Add a conflict detection step before slot update. Instruct the model to surface the contradiction explicitly: 'You previously said X, now you're saying Y. Which is correct?' Validate that the prompt produces a conflict report rather than a blind overwrite.

04

Over-Clarification on High-Confidence Slots

What to watch: The assistant asks for confirmation on a slot value that was extracted with high confidence, adding unnecessary friction and making the system feel pedantic. Guardrail: Set a confidence threshold in the prompt. Only trigger clarification when extraction confidence falls below the threshold. Include a confidence field in your slot state and test that high-confidence slots skip the clarification loop.

05

Multi-Slot Clarification Overwhelm

What to watch: The assistant asks for three or more missing slots in a single turn, overwhelming the user and increasing the chance of partial or incorrect responses. Guardrail: Enforce a single-question constraint in the prompt. 'Ask for exactly one missing slot value per turn.' Validate output by counting the number of distinct slot requests in each assistant message. Fail any response that requests more than one.

06

Stale Slot Values from Earlier Context

What to watch: A slot value provided many turns ago is no longer valid, but the assistant continues to use it without re-verification. Common in long-running sessions where user intent shifts. Guardrail: Add a staleness check based on turn distance or topic shift detection. Instruct the model to re-verify any slot value older than N turns or when a topic shift is detected. Include a last_verified_turn field in your slot state.

IMPLEMENTATION TABLE

Evaluation Rubric

How to test output quality before shipping. Run these checks against a golden dataset of 50+ turns covering normal fills, corrections, invalid inputs, and edge cases.

CriterionPass StandardFailure SignalTest Method

Slot Identification Accuracy

All required slots from [SLOT_SCHEMA] are correctly identified as filled or missing in every turn

Missing a required slot or marking a filled slot as missing

Schema-aware diff against expected slot state for each golden turn

Clarification Question Precision

Clarification targets exactly one highest-priority missing slot per [PRIORITY_ORDER] and asks a single constrained question

Asking about multiple slots, asking open-ended questions, or re-asking an already-filled slot

LLM-as-judge with pairwise comparison against reference clarifications

Redundant Re-asking Prevention

Zero re-asking for slots already filled in [SESSION_STATE] across 50-turn sequences

Any clarification question targeting a slot with a confirmed value in state

Stateful replay: track filled slots across turns and flag any re-ask

Partial Fill Validation

Partially filled slots are accepted if they meet [VALIDATION_RULES]; invalid partials trigger a specific correction prompt

Accepting invalid partial fills silently or rejecting valid partials

Input fuzzing: inject boundary-value partials and check acceptance/rejection decisions

Slot Conflict Resolution

When new input contradicts a prior slot value, the system surfaces the conflict and asks for resolution within 1 turn

Silently overwriting prior slot values or ignoring the contradiction

Inject conflicting turns at positions 10, 25, 40 in golden dataset and verify conflict detection

Invalid Input Handling

Nonsensical or out-of-domain input triggers a polite boundary clarification without losing prior slot state

Clearing slot state on invalid input, hallucinating slot values, or crashing the turn

Inject 15% invalid turns into golden dataset and verify state preservation and response appropriateness

Turn Efficiency

Mean turns to complete all required slots is within 1.2x of optimal path across golden dataset

Requiring more than 2x optimal turns or entering clarification loops exceeding 3 consecutive turns

Calculate optimal turn count per scenario; measure actual turns and flag sequences exceeding threshold

State Serialization Integrity

[SESSION_STATE] JSON survives serialization, deserialization, and model boundary round-trips without data loss or corruption

Missing slots, truncated values, or type coercion after state restore

Serialize state after each turn, parse back, and assert structural equality with pre-serialization state

ADAPTATION OPTIONS

Adapt This Prompt

How to adapt

Use the base prompt with a simple JSON schema for the output. Focus on getting the slot-filling logic right before adding validation layers. Replace the [SLOT_SCHEMA] placeholder with a flat list of required fields and their descriptions.

Watch for

  • The model asking for slots already provided in earlier turns
  • Over-clarification when a reasonable default exists
  • Missing slot priority ordering, causing the model to ask for low-importance fields first
Prasad Kumkar

About the author

Prasad Kumkar

CEO & MD, Inference Systems

Prasad Kumkar is the CEO & MD of Inference Systems and writes about AI systems architecture, LLM infrastructure, model serving, evaluation, and production deployment. Over 5+ years, he has worked across computer vision models, L5 autonomous vehicle systems, and LLM research, with a focus on taking complex AI ideas into real-world engineering systems.

His work and writing cover AI systems, large language models, AI agents, multimodal systems, autonomous systems, inference optimization, RAG, evaluation, and production AI engineering.