Prompt Kit

Agent Product Analytics Prompt Kit

Markdown

Prompt Kit: Your Product Analytics Are Blind If the User Is an Agent

Three prompts that form a single workflow for instrumenting, learning from, and reading agent product analytics. Prompt 1 generates the starter event instrumentation code for your stack. Prompt 2 turns the correction and failure events those instruments capture into eval cases. Prompt 3 reads your completion-vs-acceptance numbers through the four-quadrant framework and tells you which workflows deserve more autonomy and which need intervention.

How to use this kit

These prompts chain together on a single agent_run_id — the same identifier that ties a human session to agent execution to business outcome.

Start with Prompt 1 when you're building or retrofitting an agent product and need the three starter events wired into your stack. Run it in ChatGPT, Claude, or Gemini — any model that handles code generation well. You'll get production-ready instrumentation code for agent_run_started, task_completed, and user_correction_submitted, matched to your language, agent framework, and analytics sink.

Use Prompt 2 once corrections and failures start flowing in. Paste in one event or a batch — a denied approval, a memory miss, a user correction, a failed tool call — and get back structured eval cases you can add directly to your test suite. This closes the loop the article describes: corrections are a free label set, and this prompt turns them into tests.

Run Prompt 3 weekly once you have enough data to compute per-workflow completion and correction/acceptance rates. Feed in the numbers, get back the quadrant diagnosis for each workflow and the specific next move. This is the recurring prompt — the one that turns fresh data into roadmap decisions.


Prompt 1: Generate My Agent Instrumentation

Job: Generates production-ready code for the three starter agent analytics events, wired into your specific stack, with typed metadata and a shared agent_run_id.

When to use: You're building or have shipped an agent product and have zero or ad-hoc event instrumentation for agent runs. You want to ship the three foundational events this week.

What you'll get: Copy-paste-ready code in your language and framework that instruments agent_run_started, task_completed, and user_correction_submitted — with typed event schemas, lifecycle hook placement, the shared agent_run_id, and the call to your analytics sink. Plus guidance on where each event fires and how to expand to the full ten-event catalog later.

What the AI will ask you:

  • Your programming language and runtime
  • Your agent framework (OpenAI Agents SDK, LangGraph, custom, etc.)
  • Your analytics destination (PostHog, Segment, Amplitude, a data warehouse, stdout for now, etc.)
  • 1–3 workflows your agent handles (so metadata examples are realistic, not generic)

Prompt 2: Turn a Correction into an Eval Case

Job: Takes one or more agent failure/correction events and drafts structured eval cases that turn production signal into a growing test suite.

When to use: You've captured user_correction_submitted, approval_denied, memory_miss, or tool_call_failed events from production (or can describe incidents that happened) and want to convert them into eval cases without hand-writing tests from scratch.

What you'll get: For each event, a structured eval case containing: the input scenario, the expected behavior, the assertion to test, the eval dimension (quality, safety, retrieval, schema), and a machine-readable format you can plug into your eval framework. A fifth signal — autonomy — is read at the workflow-portfolio level in Prompt 3 rather than per-case here, since whether a workflow has earned more or less autonomy is a question about its aggregate completion-vs-acceptance numbers, not about a single correction.

What the AI will ask you:

  • The event(s) — paste raw event JSON, describe incidents in plain language, or share a batch
  • Your eval framework if you have one (Braintrust, Promptfoo, custom, or "I don't have one yet")
  • Whether any of the events involve sensitive/customer data that should be redacted in the eval

Prompt 3: Read My Completion-vs-Acceptance Numbers

Job: Takes your per-workflow completion and correction/acceptance rates and returns the four-quadrant diagnosis for each workflow with specific next moves.

When to use: You have at least a week of agent run data across your workflows and can compute completion rates and either correction rates or acceptance rates (or both). Run this weekly to turn fresh numbers into roadmap decisions.

What you'll get: A quadrant classification for each workflow (the agent is finishing trusted work / finishing untrusted work / too cautious but valuable / failing before review), the specific intervention each workflow needs, and a priority-ranked action plan.

What the AI will ask you:

  • Your workflow names and their completion rates
  • Correction rates and/or acceptance rates per workflow
  • Any additional context: volume, permission block rates, escalation rates, or notable patterns you've observed