Inferensys

Prompt

Human-in-the-Loop Triage Prompt Template

A practical prompt playbook for using the Human-in-the-Loop Triage Prompt Template in production AI workflows to route agent-handled tasks to human reviewers with structured context.
Wide-angle shot of a modern WeWork open floor plan with creative walls covered in AI system architecture diagrams, product team collaborating in standing desk area with industrial lighting.
PROMPT PLAYBOOK

When to Use This Prompt

Define the job, reader, and constraints for routing agent-handled tasks to human reviewers.

This prompt template is designed for support and operations teams that need a reliable, structured way to route tasks from an AI agent to a human reviewer. The core job is triage: transforming the raw, often verbose log of an agent's actions into a concise, prioritized summary that a human can act on immediately. The ideal user is an engineering lead or product manager building a human-in-the-loop system where the cost of a wrong autonomous action is high, such as processing a refund, approving a sensitive account change, or resolving a complex technical support ticket. It is not a general-purpose summarization tool or a replacement for a full case management system.

Use this prompt when an agent has completed its analysis or hit a defined boundary and must hand off a task. The prompt requires several concrete inputs to be effective: a structured [AGENT_ACTION_LOG] detailing what the agent did, the [ORIGINAL_USER_REQUEST] for context, and a set of [TRIAGE_CATEGORIES] and [PRIORITY_LEVELS] that match your operational taxonomy. The output is a strict JSON package containing a priority classification, category tags, a human-readable summary, and a list of pending decisions. This structure is critical because it allows the downstream application to parse the triage result and automatically route the task to the correct queue, assign it to an on-call specialist, or populate a review dashboard without a human manually reading a wall of text.

Do not use this prompt for tasks where the agent's reasoning is the primary artifact for review, such as debugging an agent's faulty logic. For that, use a dedicated 'Handoff Prompt with Reasoning Trace.' Avoid this template when the task is trivial and the cost of human review outweighs the risk of an error; a simple confidence-based escalation prompt is a better fit. Before implementing, define clear evaluation criteria: the priority and category must match a human expert's judgment in a blind test, and the summary must contain every piece of information a human needs to act without consulting the raw agent log. A common failure mode is the model hallucinating a resolution status or injecting a recommendation that the agent never made, so your harness must validate that the output strictly derives from the provided [AGENT_ACTION_LOG].

PRACTICAL GUARDRAILS

Use Case Fit

Where the Human-in-the-Loop Triage Prompt Template delivers value and where it introduces risk. Use these cards to decide if this prompt fits your operational workflow before wiring it into a production harness.

01

Good Fit: High-Volume Agent Queues

Use when: An autonomous agent processes a high volume of support tickets, alerts, or review tasks and a human team needs to pick up the ones the agent cannot resolve. Why: The triage summary replaces raw agent logs with a structured, scannable handoff, reducing context-switching time for human reviewers.

02

Bad Fit: Real-Time Emergency Dispatch

Avoid when: The workflow requires sub-second human intervention for safety-critical systems (e.g., medical alerts, physical security). Why: The prompt adds a summarization step before human review, introducing latency. In these scenarios, a direct alarm with raw telemetry is more appropriate than a prose summary.

03

Required Inputs

What you must provide: The original user request, the agent's action log or reasoning trace, the final state or outcome, and any error messages or confidence scores. Guardrail: If any of these inputs are missing, the prompt should be configured to output a structured missing_context flag rather than hallucinating a summary.

04

Operational Risk: Summary Bias

What to watch: The model may overemphasize the agent's final conclusion and omit critical contradictory evidence from the reasoning trace. Guardrail: Implement an eval that checks for the presence of key disputed facts in the triage summary. If the agent's trace contains conflicting signals, the summary must surface them explicitly.

05

Operational Risk: Priority Inflation

What to watch: The model may classify every unresolved task as high or critical priority to err on the side of caution, overwhelming human reviewers. Guardrail: Calibrate the priority definitions with concrete examples (e.g., 'Critical: customer-facing outage, >10 affected') and run a regression test suite to measure priority distribution drift over time.

06

Not a Replacement for Audit Logs

What to watch: Teams may treat the triage summary as the official record of agent activity. Guardrail: The summary is a handoff artifact, not an audit trail. Always preserve the raw agent trace and link it from the summary. The prompt should include a disclaimer that the summary is a compressed view for human convenience.

PROMPT PLAYBOOK

Copy-Ready Prompt Template

A reusable prompt template with square-bracket placeholders for triaging agent tasks to human reviewers.

The following prompt template is designed to be copied directly into your application or orchestration layer. It instructs a model to act as a triage agent, transforming raw agent logs, task context, and outputs into a structured summary suitable for a human reviewer. The goal is to eliminate the need for a human to read through verbose agent traces by providing a classified, prioritized, and context-rich handoff package. All dynamic inputs are represented as square-bracket placeholders, which your application must populate before sending the request to the model.

text
You are a Triage Agent responsible for preparing a task for human review. Your output will be read by a human operator who has no prior context on this task. You must be concise, accurate, and structured.

Analyze the provided agent task context, actions taken, and final output. Classify the task and produce a structured triage summary.

## INPUTS
- **Task Context:** [TASK_CONTEXT]
- **Agent Actions Log:** [AGENT_ACTIONS_LOG]
- **Agent Final Output:** [AGENT_FINAL_OUTPUT]
- **Escalation Reason:** [ESCALATION_REASON]

## CONSTRAINTS
- Do not invent information not present in the inputs.
- If the agent's output contains a confidence score, include it. Otherwise, do not guess.
- Flag any missing critical information as "Unknown".
- The priority must be derived from the escalation reason and task context, not assumed.

## OUTPUT_SCHEMA
Respond with a single JSON object conforming to this structure:
{
  "triage_summary": {
    "task_id": "string (from context)",
    "priority": "CRITICAL | HIGH | MEDIUM | LOW",
    "category_tags": ["string", "..."],
    "one_line_summary": "string (max 150 chars)",
    "escalation_trigger": "string (the specific event or condition that caused the handoff)",
    "agent_actions_summary": ["string (concise action description)", "..."],
    "pending_decisions": ["string (explicit question or decision needed from human)", "..."],
    "key_evidence": [
      {
        "claim": "string",
        "source": "string (reference to agent log or context)"
      }
    ],
    "risk_assessment": "string (brief assessment of risk if not handled promptly)",
    "recommended_next_step": "string (actionable suggestion for the human reviewer)"
  }
}

## EXAMPLES
- If the agent failed due to a tool timeout, the escalation_trigger is "Tool timeout after 3 retries" and priority might be HIGH.
- If the agent completed but has low confidence, the escalation_trigger is "Low confidence score (0.45) on final output" and pending_decisions should ask the human to verify the output.

To adapt this template for your specific workflow, replace the placeholders in the INPUTS section with data from your agent execution environment. [TASK_CONTEXT] should contain the original user request and any relevant session state. [AGENT_ACTIONS_LOG] should be a structured summary of tool calls, reasoning steps, and errors, not a raw, unformatted dump. The [OUTPUT_SCHEMA] can be extended with domain-specific fields, but avoid removing the core triage fields like priority, pending_decisions, and key_evidence, as these are essential for a human to pick up the task efficiently. Always validate the model's JSON output against this schema before presenting it to a human reviewer; a malformed triage object is as useless as no triage at all.

IMPLEMENTATION TABLE

Prompt Variables

Required and optional inputs for the Human-in-the-Loop Triage Prompt Template. Each placeholder must be populated before the prompt is assembled and sent to the model. Validation notes describe how to programmatically verify the input before execution.

PlaceholderPurposeExampleValidation Notes

[AGENT_LOG]

Raw agent execution trace, tool calls, and intermediate outputs that the triage prompt must summarize for the human reviewer.

{"agent_id": "support-bot-7", "steps": [{"tool": "kb_search", "query": "refund policy", "result": "..."}, {"tool": "ticket_lookup", "ticket_id": "T-4512", "result": "..."}], "final_output": "I found the refund policy but cannot determine eligibility without order date."}

Must be valid JSON or structured text. Reject if empty or under 50 characters. Check for required fields: agent_id, steps array, final_output.

[USER_QUERY]

The original user request or message that triggered the agent workflow. Provides context for why the agent took specific actions.

"I need a refund for my order from last week. The website keeps giving me an error."

Must be a non-empty string. Truncate to 2000 characters if longer. Strip PII if present before passing to model.

[PRIORITY_CLASSES]

Defined list of valid priority levels the model must choose from. Prevents the model from inventing non-standard urgency labels.

["P1-Critical", "P2-High", "P3-Medium", "P4-Low"]

Must be a non-empty array of strings. Validate that model output priority matches one of these exact values. Reject and retry if mismatch.

[CATEGORY_TAGS]

Allowed classification tags for routing the task to the correct human queue or team.

["billing", "account-access", "technical-bug", "policy-question", "escalation"]

Must be a non-empty array of strings. Validate that model output tags are a subset of this list. Flag unknown tags for human review.

[OUTPUT_SCHEMA]

Strict JSON schema the model must follow for the triage summary. Defines required fields, types, and constraints.

{"type": "object", "required": ["priority", "category", "summary", "pending_decisions", "context_brief"], "properties": {"priority": {"type": "string", "enum": ["P1-Critical", "P2-High", "P3-Medium", "P4-Low"]}, "category": {"type": "array", "items": {"type": "string"}}, "summary": {"type": "string", "maxLength": 500}, "pending_decisions": {"type": "array", "items": {"type": "string"}}, "context_brief": {"type": "string", "maxLength": 300}}}

Validate model output against this schema before presenting to human. On parse failure, retry with schema error message injected into retry prompt. Max 2 retries before escalation.

[MAX_SUMMARY_LENGTH]

Character limit for the triage summary field. Prevents overly verbose summaries that slow human review.

500

Must be a positive integer. Enforce in post-processing by truncating model output if exceeded. Log truncation events for prompt refinement.

[REQUIRED_EVIDENCE_FIELDS]

Fields from the agent log that must be cited or referenced in the triage output to ensure traceability.

["agent_id", "steps_executed", "tools_used", "final_state"]

Must be an array of strings. After model output, check that each required field is referenced in the context_brief or summary. Flag missing references for human reviewer.

[ESCALATION_TRIGGERS]

Conditions that automatically escalate the task to a human regardless of agent confidence. Used to pre-filter before triage prompt runs.

["user_requests_human", "policy_violation_detected", "confidence_below_0.7", "regulated_action"]

Must be an array of strings. Check agent log for these triggers before calling triage prompt. If triggered, bypass triage and route directly to human queue with trigger reason attached.

PROMPT PLAYBOOK

Implementation Harness Notes

How to wire the triage prompt into a production application with validation, retries, and human review gates.

The Human-in-the-Loop Triage Prompt Template is designed to sit at the boundary between an autonomous agent system and a human review queue. In a typical implementation, an agent completes its work, reaches a decision point or confidence threshold, and calls this prompt to produce a structured triage summary. The application layer then ingests the structured output, enriches it with metadata (agent ID, session ID, timestamp), and pushes it to a review queue—such as a ticketing system, a Slack channel, or a custom review dashboard. The prompt is not the handoff; it is the formatter that makes the handoff legible and actionable for a human who was not watching the agent work.

The harness must validate the output against a strict schema before routing to a human. At minimum, confirm that priority is one of the allowed enum values (e.g., low, medium, high, critical), that category_tags is a non-empty array of strings, and that the summary field contains enough substance to be useful (a length floor of 50 characters is a reasonable starting point). If the output fails validation, retry once with a repair prompt that includes the schema violations. If the retry also fails, escalate the raw agent context to a human with a flag indicating the triage prompt failed—never silently drop a handoff. For high-risk domains, add a mandatory human approval step before the triage summary is considered final; the reviewer should be able to correct the priority or category before the task is assigned.

Model choice matters here. The triage prompt requires reliable structured output and consistent classification, so prefer models with strong instruction-following and JSON mode support (e.g., GPT-4o, Claude 3.5 Sonnet). Avoid models that frequently drop fields or hallucinate enum values. If you are using a model that does not support strict JSON mode, wrap the output in a repair step that extracts and normalizes the JSON from the raw response. Log every triage output—both successful and failed—along with the agent context that produced it. These logs become your evaluation dataset for measuring classification accuracy, priority drift, and whether the triage summaries actually help human reviewers make faster, better decisions. The next step after implementing the harness is to run a calibration exercise: have two human reviewers independently triage the same set of agent outputs, compare their classifications to the prompt's output, and tune the prompt's few-shot examples and priority definitions until agreement is high enough for your operational risk tolerance.

IMPLEMENTATION TABLE

Expected Output Contract

Fields, format, and validation rules for the triage summary payload. Use this contract to build a parser, validator, or retry harness before routing the output to a human reviewer.

Field or ElementType or FormatRequiredValidation Rule

triage_id

string (UUID v4)

Must match UUID v4 regex. Generate if missing.

priority

enum: critical | high | medium | low

Must be one of the four allowed values. Reject or retry on unknown values.

category_tags

array of strings

Must contain at least one tag. Each tag must match [a-z0-9_-]+. Strip whitespace.

summary

string (plain text, max 500 chars)

Must be non-empty. Truncate to 500 chars. No markdown or HTML allowed.

agent_actions_taken

array of objects with action, timestamp, result

Each object must have action (string), timestamp (ISO 8601), result (string). Empty array allowed if no actions taken.

pending_decisions

array of strings

Each string must be a clear question or decision statement. Empty array allowed if no decisions pending.

context_snippet

string (plain text, max 1000 chars)

Must be non-empty. Must contain the most relevant excerpt from the original task. Truncate to 1000 chars.

confidence_score

number (0.0 to 1.0)

If present, must be a float between 0.0 and 1.0 inclusive. Null allowed. Round to 2 decimal places.

PRACTICAL GUARDRAILS

Common Failure Modes

Human-in-the-loop triage prompts fail in predictable ways. These cards identify the most common failure modes and provide concrete guardrails to prevent them before they reach a human reviewer.

01

Missing Critical Context

What to watch: The triage summary omits key facts, prior decisions, or agent reasoning that a human needs to make an informed decision. The human must then read raw logs, defeating the purpose of the prompt. Guardrail: Define a mandatory context schema in the prompt with required fields (e.g., original request, actions taken, evidence reviewed, pending decisions). Validate completeness before routing to a human.

02

Incorrect Priority Classification

What to watch: The model misclassifies urgency, routing a critical incident as low priority or flooding the review queue with false high-priority escalations. This erodes trust in the triage system. Guardrail: Use a structured priority rubric with explicit criteria for each level. Implement a confidence threshold—if the model is uncertain about priority, default to the higher tier and flag for human override.

03

Hallucinated Agent Actions

What to watch: The triage prompt fabricates actions the agent never took or misrepresents the outcome of tool calls. A human reviewer acts on false information, leading to incorrect decisions. Guardrail: Require the prompt to cite specific agent log entries or tool-call IDs for every claimed action. Post-process the output to verify that all cited actions exist in the agent trace before presenting to a human.

04

Ambiguous Decision Point

What to watch: The handoff describes a problem but fails to articulate exactly what the human needs to decide. The reviewer wastes time interpreting the request instead of acting on it. Guardrail: Include an explicit decision_required field in the output schema with a binary or multiple-choice question. Reject any triage output that does not contain a clear, actionable decision prompt.

05

Over-Confident Recommendations

What to watch: The model presents a single recommendation with high certainty, even when evidence is thin or contradictory. This biases the human reviewer and suppresses critical thinking. Guardrail: Require the prompt to present alternatives with pros and cons, not just a single recommendation. Include a confidence_score and a key_uncertainties field to surface what the model doesn't know.

06

Category Tag Drift

What to watch: The model invents new category tags or misapplies existing ones, breaking downstream routing rules and reporting. Tickets end up in the wrong queues. Guardrail: Provide a closed enum of allowed category tags in the prompt. Validate the output against the enum programmatically. Route any output with an unrecognized tag to a fallback queue and log the anomaly for prompt refinement.

IMPLEMENTATION TABLE

Evaluation Rubric

Use this rubric to test the quality of triage summaries before routing them to human reviewers. Each criterion targets a specific failure mode that degrades reviewer efficiency or decision accuracy.

CriterionPass StandardFailure SignalTest Method

Priority Classification Accuracy

Assigned priority matches ground-truth urgency based on [SEVERITY_DEFINITIONS] and [IMPACT_CONTEXT]

Priority is overridden by sentiment or verbosity rather than business impact; critical issues marked as low

Run against a golden set of 20 labeled tickets with known priorities; require >=90% exact match

Category Tag Precision

All assigned category tags exist in [ALLOWED_CATEGORIES] and are the most specific applicable tag

Vague or parent-category tags used when a specific child tag exists; invented tags not in schema

Validate output tags against allowed enum; flag any tag not in list; spot-check 10 samples for specificity

Required Context Completeness

All fields in [REQUIRED_CONTEXT_FIELDS] are populated with non-null, non-placeholder values

Missing customer ID, account tier, or prior escalation history when available in source logs

Schema validation pass on output JSON; null check on required fields; compare against source log availability

Summary Conciseness

Summary is under [MAX_SUMMARY_LENGTH] tokens and contains no raw log dumps or irrelevant agent chatter

Summary exceeds length limit; includes debugging output, retry traces, or tool-call payloads

Token count check; keyword scan for debug strings (trace_id, exception, retry_count); human review of 5 samples

Actionability of Next Step

The [HUMAN_ACTION_REQUIRED] field states exactly one concrete action the reviewer must take, not a vague request

Action field says 'review this' or 'please help' without specifying what decision or action is needed

LLM-as-judge eval with rubric: action must contain a verb, an object, and a decision type; spot-check 10 samples

Evidence Grounding

Every claim in the summary is traceable to a specific source span, log line, or agent output referenced in [EVIDENCE_SOURCES]

Summary includes inferred user intent or agent speculation presented as fact without source attribution

Citation extraction: parse all claims, verify each has a source pointer; flag unattributed claims; test on 10 samples

Escalation Justification

When escalation is triggered, the [ESCALATION_REASON] field cites the specific threshold or policy clause that was breached

Escalation reason is generic ('low confidence') without stating the confidence score, threshold, or policy rule

Pattern match for threshold values and policy references; fail if reason contains only sentiment without numeric or rule citation

ADAPTATION OPTIONS

Adapt This Prompt

How to adapt

Start with the base triage prompt and a simple JSON schema for priority, category, and summary. Use a single model call without retries. Accept raw text input and focus on getting the triage structure right before adding validation.

Prompt snippet

code
You are a triage assistant. Given the agent transcript below, produce a JSON object with:
- priority: one of ["critical", "high", "medium", "low"]
- category: a short label from [SUPPORT_CATEGORIES]
- summary: a 2-3 sentence summary of the situation
- context_for_human: what the human needs to know to pick this up

Agent transcript:
[AGENT_TRANSCRIPT]

Watch for

  • Priority inflation when the model defaults to "high" for everything
  • Category labels that don't match your actual routing taxonomy
  • Summaries that omit the blocker or decision point the human actually needs
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.