Inferensys

Prompt

Negative Feedback Trace Deep-Dive Prompt

A practical prompt playbook for using the Negative Feedback Trace Deep-Dive Prompt in production AI observability workflows.
Elegant overhead shot of a polished wooden communal table in a sun-drenched WeWork lounge, laptops and tablets displaying AI workflow dashboards, plants and pendant lights in background.
PROMPT PLAYBOOK

When to Use This Prompt

Defines the job-to-be-done, ideal user, required context, and boundaries for the Negative Feedback Trace Deep-Dive Prompt.

This prompt is designed for quality engineers and AI SREs who need to perform a structured failure analysis on a single production trace that has been explicitly linked to negative user feedback. The core job-to-be-done is to move from a vague user complaint—such as 'the answer was wrong' or 'the assistant got stuck'—to a precise, evidence-backed root cause. The ideal user has access to a complete trace, including the system prompt, user input, retrieval steps, tool calls, and the final model output, and needs to produce a diagnostic report that can be shared with the engineering team or attached to an incident ticket.

To use this prompt effectively, you must provide the full trace data as the primary input. The trace should include all spans, not just the final generation. The prompt is built to reconstruct the event chain, identify the exact failure point, and assess contributing factors such as ambiguous instructions, missing retrieval context, or a malformed tool call. It is not designed for aggregate trend analysis across thousands of sessions, nor is it a real-time alerting mechanism. Do not use this prompt when the trace data is incomplete, when key spans are missing, or when you are trying to diagnose a systemic issue from a sample of traces—use the 'Feedback Cluster to Trace Pattern Matching' or 'Incident Trace Correlation' prompts for those scenarios.

Before executing this prompt, confirm that the user feedback is tied to a specific trace ID. If you only have a user email or a timestamp, use the 'User Feedback to Trace Mapping Prompt' first to locate the correct trace. The output of this deep-dive prompt is a detailed failure analysis, not a simple classification. It requires careful human review of the model's recommendations before any code or prompt changes are deployed. Treat the analysis as a diagnostic artifact that informs a fix, not as an automated remediation step.

PRACTICAL GUARDRAILS

Use Case Fit

Where the Negative Feedback Trace Deep-Dive Prompt works and where it does not. Use these cards to decide if this prompt fits your operational workflow before you run it.

01

Good Fit: Structured Trace Data Available

Use when: you have a complete, machine-readable trace with spans for retrieval, tool calls, and LLM responses. Guardrail: Validate that the trace contains all required event types before running the prompt. If spans are missing, flag the trace as incomplete and do not proceed with analysis.

02

Bad Fit: Anecdotal User Reports Without Traces

Avoid when: you only have a user complaint like 'the AI was wrong' with no linked trace ID. Guardrail: Require a trace ID as a mandatory input. If the support ticket lacks one, route to a trace-mapping prompt first to locate the session before deep-dive analysis.

03

Required Input: Explicit Negative Feedback Signal

Use when: the user provided a thumbs-down, correction, or abandonment event. Guardrail: Confirm the feedback signal is timestamped and linked to a specific turn. Do not run deep-dive analysis on sessions with only implicit or ambiguous dissatisfaction signals without human confirmation.

04

Operational Risk: Over-Indexing on a Single Trace

Risk: Treating one negative trace as representative of a systemic issue. Guardrail: After the deep-dive, cross-reference findings with a feedback-cluster analysis prompt. If the failure pattern appears in fewer than 3 sessions, treat it as an isolated incident and do not trigger a prompt change.

05

Operational Risk: Fix Applied Without Human Review

Risk: The prompt produces a recommended fix that an operator applies directly to production. Guardrail: Require human approval for any prompt, retrieval, or tool configuration change suggested by the analysis. The deep-dive output is a diagnostic report, not an auto-remediation script.

06

Bad Fit: Real-Time Production Guarding

Avoid when: you need to block a bad response in real time. Guardrail: This prompt is for post-hoc analysis, not online intervention. For real-time guarding, use a separate safety or refusal prompt in the request path. Deep-dive analysis runs after the session ends.

PROMPT PLAYBOOK

Copy-Ready Prompt Template

A copy-ready prompt template for performing a structured failure analysis on a production trace that received negative user feedback.

The following prompt template is designed to be copied directly into your AI harness or observability platform. It forces a structured, evidence-based diagnosis of a single production trace, moving beyond surface-level summaries to identify the precise failure point, contributing factors, and severity. Use this template when a user has explicitly reported a bad experience (thumbs-down, correction, complaint ticket) and you have the corresponding trace data available. Do not use this prompt for aggregate trend analysis or proactive anomaly scanning; it is built for deep-dive, single-trace root-cause isolation.

markdown
You are a senior AI reliability engineer performing a root-cause failure analysis on a single production trace that received negative user feedback. Your goal is to produce a detailed, evidence-backed report that isolates the failure point and explains why it occurred.

## Input Data
- **User Feedback:** [USER_FEEDBACK]
- **Full Trace Data (JSON):** [TRACE_DATA]
- **Expected Behavior (if known):** [EXPECTED_BEHAVIOR]

## Analysis Constraints
- Ground every finding in a specific trace span, event, or log line. Do not speculate without evidence.
- If the trace data is incomplete or ambiguous, state that explicitly and flag it as a limitation.
- Classify the failure into exactly one primary category: `prompt_defect`, `retrieval_gap`, `tool_failure`, `model_error`, `routing_error`, or `infrastructure_failure`.
- Do not propose a fix. Focus strictly on diagnosis and evidence.

## Required Output Schema
Return a valid JSON object with the following structure. Do not include any text outside the JSON.
{
  "trace_id": "string",
  "analysis_timestamp": "string (ISO 8601)",
  "user_feedback_summary": "string (concise restatement of the user's complaint)",
  "failure_category": "prompt_defect | retrieval_gap | tool_failure | model_error | routing_error | infrastructure_failure",
  "failure_point": {
    "span_id": "string (the specific trace span where the failure originated)",
    "event_type": "string (e.g., 'llm_call', 'tool_execution', 'retrieval_query')",
    "description": "string (what went wrong at this exact point)"
  },
  "event_chain": [
    {
      "sequence": "integer",
      "span_id": "string",
      "event_summary": "string",
      "was_successful": "boolean",
      "anomaly_flag": "boolean (true if this event deviated from expected behavior)"
    }
  ],
  "contributing_factors": [
    {
      "factor": "string (description of a condition that contributed to the failure)",
      "evidence_span_id": "string (trace span supporting this factor)",
      "impact": "high | medium | low"
    }
  ],
  "severity_assessment": {
    "user_impact": "blocking | degraded | cosmetic",
    "reproducibility_likelihood": "high | medium | low",
    "rationale": "string (justification for the severity ratings based on trace evidence)"
  },
  "limitations": ["string (list any gaps in the trace data or analysis uncertainty)"]
}

## Analysis Steps
1. Parse the user feedback to understand the reported symptom.
2. Walk the trace chronologically, building the event chain.
3. Identify the first span where behavior deviated from the expected path.
4. List all contributing factors (e.g., missing context, ambiguous instructions, tool timeout) with trace evidence.
5. Assess severity based on user impact and how likely the failure is to recur.
6. Populate the output JSON completely. Leave no array empty; use "none_identified" for fields with no applicable value.

To adapt this template, replace the placeholders with your actual data. [USER_FEEDBACK] should contain the raw text of the user's complaint, correction, or feedback signal. [TRACE_DATA] expects the full trace JSON from your observability platform (e.g., LangSmith, Arize, Weights & Biases, or a custom trace store). If you have a documented expected behavior or golden trace for comparison, provide it in [EXPECTED_BEHAVIOR]; otherwise, replace it with the string "not_provided". The output schema is strict JSON, so ensure your application layer validates the response against this schema before accepting it. If the model returns malformed JSON, use a retry recovery prompt that feeds the raw output and schema back to the model for repair.

Before deploying this prompt into an automated pipeline, run it against a labeled dataset of 10-20 traces with known failure categories. Measure whether the failure_category field matches the ground-truth label and whether the failure_point.span_id correctly identifies the originating span. A human reviewer should sign off on the first 50 analyses to calibrate severity assessments and catch hallucinated evidence citations. For high-severity incidents (user_impact: "blocking"), always require human approval before the analysis is shared with stakeholders or used to trigger an automated rollback.

IMPLEMENTATION TABLE

Prompt Variables

Required inputs for the Negative Feedback Trace Deep-Dive Prompt. Each variable must be populated from production trace data, user feedback records, or session metadata before the prompt is assembled. Missing or malformed inputs will degrade the failure analysis quality.

PlaceholderPurposeExampleValidation Notes

[TRACE_EVENT_LOG]

Full ordered list of trace spans, tool calls, model responses, and retrieval steps from the user session

span_id=abc123, type=llm_call, timestamp=2025-01-15T14:32:01Z, input=..., output=...

Must be valid JSON array with at least one span. Each span requires span_id, type, timestamp, and input/output fields. Reject if spans are out of chronological order or missing required fields.

[USER_FEEDBACK_SIGNAL]

The negative feedback event including type, timestamp, and any user-provided text

type=thumbs_down, timestamp=2025-01-15T14:33:45Z, comment='The answer cited the wrong policy section'

Must include feedback_type from allowed enum: thumbs_down, correction, abandonment, escalation, complaint. Timestamp must fall within or after the trace window. Reject if feedback_type is missing or unrecognized.

[SESSION_METADATA]

Session-level context including user ID, model version, prompt version, and feature flags active during the session

user_id=usr_789, model=gpt-4o-2024-08-06, prompt_version=v2.3.1, feature_flags=[rag_enabled, tool_use_v2]

Must include model_version and prompt_version strings. Feature flags must be a list of active flags. Reject if model_version or prompt_version is null or empty.

[RETRIEVAL_CONTEXT]

Documents, passages, or chunks retrieved and placed into the context window during the session

chunk_id=doc_45_p3, source=policy_manual_v3.pdf, content='Section 4.2 outlines...', rank=1, score=0.92

Must be valid JSON array. Each chunk requires chunk_id, source, and content fields. Reject if content is empty or truncated mid-sentence without a truncation flag. Allow null if no retrieval occurred.

[TOOL_DEFINITIONS]

Schema definitions for all tools available to the model during the session

tool_name=search_kb, parameters={query: string, max_results: integer}, description='Search the knowledge base'

Must be valid JSON array of tool schemas matching the format used in the trace. Each tool requires name, parameters, and description. Reject if tool names in trace do not match any definition.

[SYSTEM_PROMPT]

The full system prompt or instruction set active during the session

You are a support assistant. Always cite sources. Do not guess. If unsure, escalate.

Must be a non-empty string. Reject if null or whitespace-only. Compare against prompt_version in session metadata for consistency. Flag if system prompt content does not match expected version.

[EXPECTED_BEHAVIOR_POLICY]

The behavioral policy or quality rubric the model was expected to follow

policy_id=pol_2024_q4, rules=[must_cite_sources, must_not_guess, must_escalate_on_uncertainty]

Must include policy_id and a rules array with at least one rule. Reject if rules array is empty. Compare against trace events to identify policy violations. Allow null if no formal policy exists but flag in analysis output.

[PRIOR_INCIDENT_PATTERNS]

Known failure signatures or incident patterns to match against the trace

pattern_id=inc_042, signature='retrieval returned empty then model hallucinated', severity=high

Must be valid JSON array. Each pattern requires pattern_id and signature. Allow empty array if no prior patterns exist. Reject if pattern_id is duplicated. Used for correlation matching, not required for basic analysis.

PROMPT PLAYBOOK

Implementation Harness Notes

How to wire the Negative Feedback Trace Deep-Dive Prompt into an observability or support workflow.

This prompt is designed to be called programmatically as part of an automated trace analysis pipeline, not as a one-off chat interaction. The primary integration point is a webhook or queue consumer that triggers when a user submits negative feedback (e.g., a thumbs-down, a support ticket, or an escalation). The system must first retrieve the full trace payload—including all spans, tool calls, retrieved documents, and model responses—from your observability store (such as LangSmith, Arize, or a custom logging database) and inject it into the [FULL_TRACE_JSON] placeholder. Without the complete trace, the analysis will be speculative and unreliable.

Before calling the LLM, validate the input trace for structural completeness: confirm that required fields like trace_id, spans, start_time, and feedback_signal are present and non-null. If the trace is malformed or truncated, abort the deep-dive and route to a human analyst with a TRACE_INCOMPLETE error code. For the model call itself, use a low-temperature setting (0.0–0.2) to enforce deterministic, evidence-grounded analysis. Implement a retry wrapper with exponential backoff (max 3 attempts) to handle transient API failures, but do not retry on validation errors or content policy refusals—those should be logged and escalated immediately. The output must be parsed as strict JSON and validated against the expected [OUTPUT_SCHEMA] before it is stored or displayed. If the output fails schema validation, invoke a repair prompt or fall back to a structured error log that captures the raw response for manual review.

Log every invocation—including the trace ID, feedback signal, model used, latency, token counts, and the full analysis output—to an audit table. This log serves as evidence for compliance reviews and allows you to measure the accuracy of the automated analysis over time. For high-severity findings (severity critical or high), route the analysis to a human reviewer via your ticketing system before any automated fix is applied. Never allow the prompt's recommended fix to be deployed directly to production without human approval. Finally, build an eval harness that periodically tests the prompt against a golden set of annotated traces with known failure modes to detect drift in analysis quality.

IMPLEMENTATION TABLE

Expected Output Contract

Defines the structured fields, types, and validation rules for the Negative Feedback Trace Deep-Dive analysis output. Use this contract to parse, validate, and store the generated failure analysis before routing it to a human reviewer or incident tracking system.

Field or ElementType or FormatRequiredValidation Rule

failure_analysis_id

string (UUID)

Must match the trace_id of the input trace. Parse check: valid UUID v4 format.

user_feedback_signal

object

Must contain 'type' (string enum: thumbs_down, correction, abandonment, complaint) and 'timestamp' (ISO 8601). Schema check: required fields present.

event_chain

array of objects

Each object must include 'sequence_number' (int), 'span_type' (string), 'timestamp' (ISO 8601), and 'summary' (string). Parse check: array length >= 1, sequence numbers are contiguous.

primary_failure_point

object

Must include 'span_id' (string), 'failure_category' (string enum: prompt_defect, retrieval_gap, tool_failure, model_error, infrastructure_timeout), and 'evidence_excerpt' (string). Schema check: category is a valid enum value.

contributing_factors

array of strings

Each string must be a non-empty sentence describing a contributing condition. Parse check: array length >= 1, no empty strings.

severity_assessment

object

Must include 'level' (string enum: low, medium, high, critical) and 'rationale' (string). Schema check: level is a valid enum value. Approval required if level is 'critical'.

recommended_actions

array of objects

Each object must include 'action' (string), 'owner_team' (string), and 'requires_human_approval' (boolean). Parse check: array length >= 1, no null or empty action strings.

analysis_completeness_score

number (0.0-1.0)

Self-assessment of how thoroughly the trace was analyzed. Validation rule: must be a float between 0.0 and 1.0. Retry condition if score < 0.8.

PRACTICAL GUARDRAILS

Common Failure Modes

What breaks first when running a negative feedback trace deep-dive and how to guard against it.

01

Wrong Trace Attached to Feedback

What to watch: The prompt analyzes a trace that does not belong to the user session that generated the negative feedback. This produces a completely irrelevant root-cause analysis. Guardrail: Require a pre-validation step that confirms the trace ID, session ID, and user-reported timestamp match before the deep-dive begins. Flag mismatches for manual review.

02

Surface-Level Symptom Confused with Root Cause

What to watch: The analysis stops at the first visible error (e.g., a tool timeout) without tracing backward to the upstream decision that caused it (e.g., a prompt that selected the wrong tool). Guardrail: Instruct the prompt to apply the 'Five Whys' method, requiring at least three levels of causal depth before stating a root cause. Validate that each cause links to a specific trace span.

03

Hallucinated Trace Events

What to watch: The model invents tool calls, arguments, or retrieved documents that are not present in the actual trace data, leading to a fabricated failure analysis. Guardrail: Require every assertion in the output to include a direct quote or a structured reference to a specific trace span ID. Run a post-generation grounding check that verifies each cited span exists in the source trace.

04

Overlooking a Silent Retrieval Gap

What to watch: The model's final output looks plausible but is wrong because a critical document was never retrieved. The analysis focuses on generation quality and misses the retrieval failure entirely. Guardrail: Add a mandatory step to compare the model's final answer against the full list of retrieved chunks. If a key claim has no supporting chunk, classify the failure as a retrieval gap regardless of generation fluency.

05

Severity Inflation for Benign Failures

What to watch: The prompt assigns a 'critical' or 'high' severity to a minor stylistic issue or a single-turn clarification, causing alert fatigue and wasted engineering time. Guardrail: Provide a strict severity rubric with concrete examples (e.g., 'Critical: data loss or safety violation; Low: minor wording preference'). Require the analysis to justify the severity level against this rubric with trace evidence.

06

Ignoring the User Correction Signal

What to watch: The analysis treats the final model output as the primary failure point, ignoring a mid-session user correction that reveals the exact moment the model went off-track. Guardrail: Prioritize trace spans immediately preceding a user correction event. Instruct the prompt to treat the correction as the strongest signal and to anchor the failure timeline to that point.

IMPLEMENTATION TABLE

Evaluation Rubric

Use this rubric to test the quality of a negative feedback trace deep-dive analysis before shipping it to an incident responder or accepting it into an automated remediation pipeline. Each criterion targets a specific failure mode common in trace analysis.

CriterionPass StandardFailure SignalTest Method

Root Cause Attribution

A single, specific failure point is identified with a trace span ID and a fault category (prompt_defect, retrieval_gap, tool_failure, model_error, infrastructure).

Multiple unrelated causes are listed without a primary, or the cause is attributed to 'model hallucination' without trace evidence.

Parse the output for a root_cause object. Assert span_id is not null and category matches an allowed enum. Fail if confidence is below 0.7.

Full Event Chain Coverage

All trace spans from the user's session are accounted for in the analysis, with no gaps in the event timeline.

The analysis skips spans, omits tool-call arguments, or fails to mention a retrieval step that occurred in the trace.

Count the number of spans in the input trace. Assert the output's event_chain array length matches. Fail if any span ID from the input is missing.

Evidence Grounding

Every claim about model behavior, tool failure, or retrieval quality is backed by a direct quote or structured excerpt from the trace data.

The analysis states 'the model ignored the context' without citing the specific context chunk or the model's output that demonstrates the omission.

Scan the output for claims in the contributing_factors array. Assert each claim has a non-null trace_evidence field. Fail if any claim lacks a direct quote or span reference.

Severity Assessment Accuracy

The severity score (e.g., low, medium, high, critical) aligns with the user feedback signal and the operational impact described in the trace.

A 'critical' severity is assigned to a minor formatting issue, or a 'low' severity is assigned to a case where the model refused to answer a safety-critical query.

Provide a pre-labeled set of 10 traces with known severity levels. Assert the output severity matches the label. Fail if accuracy on the test set drops below 90%.

Actionable Recommendation Quality

The recommended_action field contains a concrete, specific step (e.g., 'Add a tool retry with exponential backoff for timeout errors on the search_inventory tool' or 'Rewrite system prompt line 12 to clarify priority of user corrections').

The recommendation is vague (e.g., 'improve the prompt' or 'fix the bug') or suggests an action that does not address the identified root cause.

Use an LLM-as-a-judge check. Prompt the judge: 'Is this recommendation specific and executable by an engineer without further clarification?' Fail if the judge returns false.

User Feedback Correlation

The analysis explicitly connects the user's negative feedback signal to the identified failure point in the trace.

The analysis describes a technical failure but never mentions the user's reported symptom or explains how the failure produced the negative experience.

Assert that the output's failure_point object contains a non-null user_feedback_correlation field. Fail if the field is missing or contains a generic statement like 'this caused user frustration.'

Analysis Completeness

The output includes all required sections: event_chain, failure_point, contributing_factors, severity, and recommended_action.

The output is truncated, missing a section, or contains placeholder text like 'TODO' or 'analysis pending'.

Validate the output against a strict JSON schema. Assert all required fields are present and non-null. Fail if schema validation returns errors.

Diagnostic Confidence Honesty

The analysis includes a confidence score that reflects uncertainty, especially when trace data is incomplete or the failure mode is ambiguous.

The analysis reports a 0.99 confidence score for a root cause that relies on inference from a single ambiguous log line.

Assert that the confidence score is between 0.0 and 1.0. If the failure_point evidence is a single ambiguous event, fail if confidence is above 0.8. This requires a heuristic check on evidence quantity.

ADAPTATION OPTIONS

Adapt This Prompt

How to adapt

Use the base prompt with a single trace JSON blob and lighter validation. Remove the severity scoring rubric and keep only the failure point identification and contributing factors. Accept free-text output instead of strict JSON schema.

Watch for

  • Missing schema checks can hide incomplete analysis
  • Overly broad instructions may produce vague failure points
  • No confidence scoring makes it hard to compare traces
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.