This playbook is for agent-system builders implementing tool-using RAG workflows where the number of retrieval steps cannot be fixed in advance. The prompt defines an agent that iteratively assesses whether retrieved evidence is sufficient to answer a user query, requests additional retrieval or clarification when gaps exist, and only proceeds to answer generation when sufficiency thresholds are met. The core job-to-be-done is replacing a brittle, fixed-step retrieval loop with an agent that can decide for itself when to stop searching and start answering. The ideal user is an engineering lead or senior developer who already has a working RAG pipeline and is hitting quality ceilings because a static top-k retrieval approach either retrieves too little context for complex queries or wastes latency budget on unnecessary searches for simple ones.
Prompt
Evidence Sufficiency Agent Prompt

When to Use This Prompt
Determine if an iterative evidence-sufficiency agent is the right architecture for your RAG workflow, and understand when simpler patterns are a better fit.
Use this prompt when your application handles queries with highly variable evidence requirements—for example, a legal research assistant where some questions need one clause and others need cross-jurisdictional analysis spanning dozens of documents. It is also appropriate when the cost of a confident wrong answer is high and you need the system to explicitly refuse or request clarification rather than guess. The agent pattern shines when you can expose retrieval tools (vector search, keyword search, structured database queries, or clarification requests to the user) as callable functions that the model can invoke across multiple turns. You must be prepared to implement the tool-execution loop, enforce a maximum step budget as a safety rail, and log each sufficiency assessment for evaluation and debugging.
Do not use this prompt for single-shot RAG pipelines where one retrieval call is sufficient by design, latency-critical applications where multi-step reasoning adds unacceptable delay, or workflows where the retrieval budget is strictly capped and cannot be agent-controlled. If your queries are homogeneous in complexity, a fixed retrieval-and-answer pipeline with a simpler sufficiency gate prompt will be faster, cheaper, and easier to evaluate. This agent prompt is also a poor fit if you cannot instrument the agent's intermediate decisions—without logging each sufficiency assessment, gap identification, and tool call, you will struggle to debug why the agent over-searched, under-searched, or made incorrect sufficiency calls in production.
Use Case Fit
Where the Evidence Sufficiency Agent Prompt delivers value and where it introduces risk. Use these cards to decide if this agent pattern fits your workflow before you integrate it.
Good Fit: Multi-Turn RAG with Tool Access
Use when: Your system can call a search tool, re-rank results, and iterate before answering. The agent prompt excels when it can request additional retrieval passes or ask clarifying questions. Guardrail: Define a maximum iteration budget (e.g., 3 retrieval rounds) to prevent infinite loops.
Good Fit: High-Stakes Answer Generation
Use when: A confident wrong answer is worse than a refusal. The agent's sufficiency gate prevents hallucination in clinical, legal, or financial contexts. Guardrail: Always pair with a human review step for answers flagged as 'partial' or 'low confidence' by the agent.
Bad Fit: Latency-Sensitive Chat
Avoid when: Users expect sub-second responses. The iterative assess-retrieve-assess loop adds significant latency. Guardrail: For real-time chat, use a lightweight binary classifier prompt instead of a full agent loop. Reserve the agent for async or background verification tasks.
Bad Fit: Narrow, Factoid Lookups
Avoid when: The knowledge base is static and queries are simple fact retrieval (e.g., 'What is the return policy?'). The sufficiency agent adds overhead without benefit. Guardrail: Route simple queries to a standard RAG prompt and trigger the agent only when initial retrieval confidence scores fall below a threshold.
Required Inputs: Tool Contracts & Stop Conditions
Risk: The agent will hallucinate tool calls or run indefinitely without strict contracts. Guardrail: Provide the agent with a strict JSON schema for tool calls, a maximum step count, and explicit stop conditions (e.g., 'sufficiency_score > 0.9' or 'iterations >= 3').
Operational Risk: Source Bias Amplification
Risk: The agent may iteratively search until it finds confirming evidence, reinforcing retrieval bias rather than identifying genuine gaps. Guardrail: Instruct the agent to explicitly search for disconfirming evidence in its second retrieval pass and report contradictions in its sufficiency assessment.
Copy-Ready Prompt Template
A reusable agent system prompt that iteratively assesses evidence sufficiency, requests additional retrieval or clarification, and only proceeds to answer generation when sufficiency thresholds are met.
This prompt template is designed to be the system message for an agent loop that continues until evidence sufficiency is reached or the iteration limit is hit. The agent is given tools for retrieval and clarification, a structured sufficiency rubric, and explicit stopping criteria. Replace all square-bracket placeholders with your specific domain context, tool definitions, and risk tolerances before use. The prompt enforces a strict sequence: assess, decide, act, and only synthesize when the gate is passed.
textYou are an Evidence Sufficiency Agent. Your sole responsibility is to determine whether the available evidence is sufficient to answer a user query accurately and completely, and to take action until sufficiency is reached or you must stop. ## CORE RULES 1. Never generate a final answer until you have explicitly passed the sufficiency gate. 2. If evidence is insufficient, you must either request additional retrieval or ask the user for clarification. Do not guess. 3. Every sufficiency assessment must reference specific gaps, not vague impressions. 4. When you do answer, every claim must be grounded in a cited source passage. ## INPUT - User Query: [USER_QUERY] - Initial Retrieved Context: [RETRIEVED_CONTEXT] - Domain: [DOMAIN] - Risk Level: [RISK_LEVEL] ## TOOLS AVAILABLE [TOOL_DEFINITIONS] ## SUFFICIENCY RUBRIC Assess evidence across these dimensions. All must meet the threshold for the gate to pass: - **Factual Coverage**: Does the evidence address every factual sub-question in the query? [COVERAGE_THRESHOLD] - **Temporal Relevance**: Is the evidence current enough for the query's time sensitivity? [TEMPORAL_THRESHOLD] - **Source Authority**: Do the sources meet the authority requirements for this domain? [AUTHORITY_THRESHOLD] - **Specificity**: Is the evidence specific enough to answer at the required level of detail? [SPECIFICITY_THRESHOLD] - **Consistency**: Do sources agree on key points, or are contradictions acknowledged and resolved? [CONSISTENCY_THRESHOLD] ## WORKFLOW 1. **Assess**: Evaluate the current evidence against every rubric dimension. Produce a structured assessment. 2. **Decide**: If all dimensions pass, proceed to Step 4. If any dimension fails, go to Step 3. 3. **Act**: Identify the specific missing information. Choose one action: - Call a retrieval tool with a targeted query for the missing evidence. - Ask the user a specific clarification question if the gap cannot be resolved by retrieval. Return to Step 1 with new evidence. 4. **Synthesize**: Generate the final answer. Every factual claim must include a citation to a specific source passage. Mark any remaining uncertainty explicitly. ## STOPPING CRITERIA Stop and refuse to answer if: - You have taken [MAX_ITERATIONS] actions without reaching sufficiency. - The user declines to provide requested clarification. - Retrieved sources are fundamentally contradictory and cannot be resolved. - The query requires information you are prohibited from providing per [POLICY_CONSTRAINTS]. ## OUTPUT FORMAT When assessing sufficiency, output: ```json { "assessment": { "factual_coverage": { "pass": true/false, "gaps": ["..."] }, "temporal_relevance": { "pass": true/false, "gaps": ["..."] }, "source_authority": { "pass": true/false, "gaps": ["..."] }, "specificity": { "pass": true/false, "gaps": ["..."] }, "consistency": { "pass": true/false, "gaps": ["..."] } }, "overall_sufficient": true/false, "next_action": "synthesize" | "retrieve" | "clarify" | "refuse", "action_detail": "..." }
When synthesizing the final answer, output:
json{ "answer": "...", "citations": [{"claim": "...", "source_id": "...", "quote": "..."}], "remaining_uncertainty": "...", "sufficiency_summary": "..." }
CONSTRAINTS
[CONSTRAINTS]
EXAMPLES
[EXAMPLES]
To adapt this template, start by defining your domain-specific thresholds for each rubric dimension. A medical application will have stricter authority and temporal requirements than a general knowledge assistant. Wire the tool definitions to your actual retrieval APIs, database queries, or clarification interfaces. Set MAX_ITERATIONS based on your latency budget—three to five iterations is typical for production RAG systems. The structured JSON output format is critical for programmatic control of the agent loop; your harness should parse the next_action field to route to the correct handler. For high-risk domains, add a human review step before the final synthesis is surfaced to users.
Prompt Variables
Inputs the Evidence Sufficiency Agent prompt needs to work reliably. Validate each before injecting into the system message.
| Placeholder | Purpose | Example | Validation Notes |
|---|---|---|---|
[USER_QUERY] | The original question or task to assess for evidence sufficiency | What were the Q3 revenue drivers for the enterprise segment? | Required. Non-empty string. Check for minimum length > 3 characters. Reject empty or whitespace-only inputs. |
[RETRIEVED_PASSAGES] | The set of evidence passages returned by the retrieval system | [{"id": "doc_1", "text": "Enterprise revenue grew 12%...", "source": "earnings_report.pdf", "date": "2024-10-15"}] | Required. Must be a valid JSON array. Each object requires id, text, and source fields. Reject if array is empty or contains malformed objects. |
[SUFFICIENCY_THRESHOLD] | The minimum confidence score required to proceed to answer generation | 0.85 | Required. Float between 0.0 and 1.0. Default 0.80 if not specified. Reject values outside range. Log threshold changes for audit. |
[MAX_RETRIEVAL_ROUNDS] | Maximum number of additional retrieval attempts before forcing a refusal | 3 | Required. Integer >= 0. Set to 0 to disable re-retrieval. Reject negative values. Cap at 10 to prevent infinite loops. |
[TOOL_SCHEMA] | The function definition for the re-retrieval tool the agent can call | {"name": "search_kb", "parameters": {"query": "string", "filters": {"date_range": "string"}}} | Required. Valid JSON Schema object. Must include name and parameters. Validate against JSON Schema spec. Reject schemas with no parameters defined. |
[OUTPUT_SCHEMA] | The expected JSON structure for the agent's sufficiency assessment | {"answerable": "boolean", "confidence": "float", "missing_information": ["string"], "grounded_answer": "string|null"} | Required. Valid JSON Schema. Must include answerable, confidence, and missing_information fields. Reject schemas missing required decision fields. |
[STOPPING_CRITERIA] | Conditions that force the agent to stop and refuse rather than continue retrieving | ["confidence_below_0.5_after_2_rounds", "contradictory_sources_detected", "query_requires_subjective_judgment"] | Optional. Array of strings from allowed enum. Validate against known criteria list. Reject unknown criteria. Default to confidence-only stopping if not provided. |
[GROUNDING_POLICY] | Rules for what constitutes acceptable evidence support for claims | Require at least 2 independent sources for quantitative claims. Direct quotes required for factual assertions. | Required. Non-empty string. Must specify minimum source count or citation rules. Reject policies that allow unsupported claims. Log policy version for audit trail. |
Implementation Harness Notes
How to wire the Evidence Sufficiency Agent Prompt into a production agent loop with tool contracts, validation, and stopping criteria.
The Evidence Sufficiency Agent Prompt is designed to operate inside a tool-using agent loop, not as a single-turn classifier. The agent receives a user query and a set of retrieved passages, then iterates through a decision cycle: assess sufficiency, request additional retrieval or clarification if needed, and only proceed to answer generation when a defined threshold is met. The implementation harness must enforce this cycle, manage tool calls, validate the agent's structured output at each step, and prevent infinite loops or premature answers.
Wire the prompt as the system instruction for an agent that has access to a search_knowledge_base tool and a request_user_clarification tool. The agent's output at each turn must conform to a strict JSON schema with a decision field (ANSWER, RETRIEVE, CLARIFY, REFUSE) and a rationale field. The harness should parse this output and route accordingly: if RETRIEVE, execute the search tool with the agent's generated query, append results to the evidence set, and re-invoke the agent; if CLARIFY, surface the clarification question to the user and pause; if ANSWER, pass the accumulated evidence to a separate answer-generation prompt; if REFUSE, return the agent's refusal message. Implement a hard stop after a configurable maximum number of retrieval iterations (start with 3) to prevent runaway loops. Log every decision, the evidence set size, and the rationale for audit and debugging.
Validation is critical at each turn. Before routing on the decision field, confirm the JSON parses correctly and that the decision value is one of the allowed enum members. If the agent outputs ANSWER but the evidence set is empty or the sufficiency score in its own rationale is below a configured threshold, override with a REFUSE fallback and log the inconsistency. For high-stakes domains, insert a human-review step when the agent's confidence score falls in a middle band—auto-answer only above 0.9, refuse below 0.5, and queue for review between 0.5 and 0.9. Model choice matters: use a model with strong instruction-following and tool-use capabilities (GPT-4o, Claude 3.5 Sonnet, or equivalent). Avoid smaller models that may ignore the stopping criteria or hallucinate tool calls. Pair this agent prompt with an eval harness that measures end-to-end answer accuracy, refusal appropriateness, and retrieval iteration count against a golden dataset of queries with known sufficient and insufficient evidence states.
Expected Output Contract
Fields, types, and validation rules for the Evidence Sufficiency Agent's structured output at each decision step. Use this contract to parse, validate, and route agent responses before proceeding to answer generation or tool calls.
| Field or Element | Type or Format | Required | Validation Rule |
|---|---|---|---|
sufficiency_decision | enum: sufficient | insufficient | partial | Must match one of three allowed values. Reject any other string. | |
confidence_score | float between 0.0 and 1.0 | Parse as float. Reject if < 0.0 or > 1.0. If confidence < [MIN_CONFIDENCE_THRESHOLD], route to human review. | |
missing_information | array of strings | Required when sufficiency_decision is insufficient or partial. Each element must be a non-empty string describing a specific gap. Null allowed only when sufficiency_decision is sufficient. | |
retrieval_queries | array of objects with query and rationale fields | Required when sufficiency_decision is insufficient. Each object must have non-empty query (string) and rationale (string). Validate array length <= [MAX_RETRIEVAL_QUERIES]. | |
clarification_questions | array of strings | Required when missing_information includes user_intent_ambiguity. Each string must be a well-formed question. Null allowed otherwise. | |
answerable_sub_queries | array of strings | Required when sufficiency_decision is partial. Each string must reference a sub-query from the decomposition. Validate that all entries exist in the original query decomposition. | |
grounding_citations | array of objects with source_id and evidence_span fields | Required when sufficiency_decision is sufficient or partial. Each object must have a non-empty source_id (string) and evidence_span (string). Validate source_id exists in the provided retrieval set. | |
stop_reason | enum: evidence_sufficient | max_retries_exceeded | user_clarification_needed | irretrievable_gap | Must match one of four allowed values. Used to determine agent loop termination. Reject unknown values. |
Common Failure Modes
Evidence sufficiency agents fail in predictable ways. These are the most common failure modes and the specific guardrails to prevent them.
False-Positive Sufficiency
What to watch: The agent declares evidence sufficient when critical facts, entities, or temporal context are missing. This produces confident wrong answers. Guardrail: Require the agent to enumerate specific evidence-to-claim mappings before declaring sufficiency. Add a secondary verification step that checks each claim against source spans.
Infinite Retrieval Loops
What to watch: The agent repeatedly requests additional retrieval without converging, burning tokens and latency on diminishing returns. Guardrail: Set a hard maximum on retrieval rounds (typically 3-5). After the limit, force a decision: answer with caveats, refuse, or escalate to human review.
Gap Description Without Action
What to watch: The agent correctly identifies missing information but fails to translate gaps into concrete retrieval queries or clarification requests. Guardrail: Require every identified gap to produce a specific, executable next action—a reformulated query, a clarification question, or a refusal with rationale. Validate that gap outputs are actionable.
Authority Blindness
What to watch: The agent treats all retrieved passages as equally trustworthy, ignoring source credibility signals. Low-authority sources can satisfy sufficiency checks while producing unreliable answers. Guardrail: Include source authority metadata in the evidence payload. Require the agent to weight sufficiency assessments by source trustworthiness scores.
Premature Answer Generation
What to watch: The agent skips the sufficiency gate and proceeds directly to answer generation when evidence appears superficially relevant. Guardrail: Enforce a strict tool-call sequence where answer generation is only available after an explicit sufficiency check returns a pass. Block the answer tool until the gate is cleared.
Over-Refusal on Minor Gaps
What to watch: The agent refuses to answer when evidence covers 90% of the query, treating minor gaps as complete blockers. This degrades user experience unnecessarily. Guardrail: Implement a partial-answer pathway with explicit boundary markers. Define a minimum coverage threshold below which refusal is required, and above which partial answers with caveats are permitted.
Evaluation Rubric
Run these checks against a golden dataset of queries with known answerability and ground-truth evidence requirements. Each row validates a specific failure mode of the Evidence Sufficiency Agent.
| Criterion | Pass Standard | Failure Signal | Test Method |
|---|---|---|---|
Sufficiency Decision Accuracy | Agent correctly classifies evidence as sufficient/insufficient for ≥90% of golden queries | Agent marks insufficient evidence as sufficient (false positive) or sufficient evidence as insufficient (false negative) | Compare agent decision against golden dataset labels; compute precision, recall, F1 |
Gap Identification Completeness | Agent identifies all pre-annotated missing information categories for insufficient-evidence queries | Agent misses a known gap type (e.g., temporal context, entity, authority) present in the golden annotation | Check agent gap list against human-annotated gap categories; measure recall per gap type |
Tool Call Appropriateness | Agent requests additional retrieval or clarification only when evidence is genuinely insufficient | Agent loops on tool calls when evidence is already sufficient, or fails to call tools when gaps exist | Trace tool-call sequences against golden sufficiency labels; count unnecessary calls and missed calls |
Stopping Criterion Adherence | Agent stops iterating and proceeds to answer or refuse within [MAX_ITERATIONS] cycles | Agent exceeds iteration limit without reaching a terminal state, or terminates prematurely with unresolved gaps | Run agent with iteration counter; assert terminal state reached before limit; log early exits |
Refusal Quality When Evidence Insufficient | Refusal message clearly states what is missing and avoids speculative content | Refusal is vague, misleading, or contains unsupported claims despite declared insufficiency | LLM-as-judge evaluation against refusal quality rubric; check for hallucinated statements in refusal text |
Confidence Calibration | Agent confidence score correlates with actual answer correctness (Spearman ρ ≥ 0.7) | High confidence assigned to incorrect answers, or low confidence assigned to correct answers | Compute rank correlation between agent confidence scores and binary correctness labels across golden dataset |
Source Grounding in Final Answer | Every claim in the final answer is traceable to a specific retrieved passage | Answer contains claims not present in any retrieved passage, or citations point to irrelevant sources | Run faithfulness verification prompt on agent output; flag unsupported claims; compute grounding precision |
Latency Budget Compliance | Agent completes sufficiency assessment and answer generation within [LATENCY_BUDGET_MS] | Agent exceeds latency budget due to excessive tool calls or slow iteration | Measure end-to-end wall-clock time per query; assert p95 latency within budget; log outliers |
Enabling Efficiency, Speed & Accuracy
Intelligent Analysis, Decision & Execution
We build AI systems for teams that need search across company data, workflow automation across tools, or AI features inside products and internal software.
Talk to Us
Search across company data
Give teams answers from docs, tickets, runbooks, and product data with sources and permissions.
Useful when people spend too long searching or get different answers from different systems.

Automate internal workflows
Use AI to route work, draft outputs, trigger actions, and keep approvals and logs in place.
Useful when repetitive work moves across multiple tools and teams.

Add AI to products and internal tools
Build assistants, guided actions, or decision support into the software your team or customers already use.
Useful when AI needs to be part of the product, not a separate tool.
Adapt This Prompt
How to adapt
Add a strict JSON tool contract for each retrieval action, a maximum iteration limit (e.g., 3 rounds), and a final gate that requires all sufficiency dimensions to pass before proceeding to answer generation. Wire in structured logging for every sufficiency decision.
json{ "tool": "assess_sufficiency", "parameters": { "query": "[USER_QUERY]", "retrieved_passages": ["[PASSAGE_1]", "[PASSAGE_2]"], "required_dimensions": ["factual_coverage", "temporal_relevance", "source_authority"] }, "output_schema": { "sufficient": "boolean", "missing_information": ["string"], "confidence": "float 0-1", "next_action": "ANSWER | RETRIEVE | CLARIFY | REFUSE" } }
Watch for
- Silent format drift in the
next_actionfield breaks routing logic - Missing human review for high-confidence but wrong sufficiency calls
- Iteration limit can mask persistent retrieval gaps if not monitored

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.
Partnered with leading AI, data, and software stack.
How We Work
Custom AI workflows for your Business
One-fit-all AI don't work for modern businesses. At Inferensys, we aim to understand your business & custom requirements; which we use to define most efficient agentic workflows, the data, and the tools for your business.
01
Review the use case
We understand the task, the users, and where AI can actually help.
Read more02
Pick the right approach
We define what needs search, automation, or product integration.
Read more03
Build the first useful version
We implement the part that proves the value first.
Read more04
Improve from there
We add the checks and visibility needed to keep it useful.
Read moreThe first call is a practical review of your use case and the right next step.
Talk to Us