Skip to content
Telemetry
Event tracking template

AI agent observability template

Track agent runs, tool calls, retries, latency, errors, and accepted outputs in event tables you can query with SQL.

Reviewed by the Telemetry product team on . We checked the event names, suggested fields, questions to query, and data to exclude. Who reviews this page

Use this template with the reusable agent telemetry skill.md guide.

Questions you can answer
  • Which tools fail most often?
  • Which agent workflows are slow or expensive?
  • Which outputs are accepted, retried, copied, or discarded?
How to test this template

Set up AI agent observability template and check the results

Use the prompt to add events, then check the stored fields and query results. Review the event definitions before relying on the numbers.

  1. 1

    Choose when to log

    Instrument the point where agent_run_started becomes final.

  2. 2

    Create the contract

    Start with agent_run_started, agent_tool_called, agent_run_completed and keep every field typed, bounded, and privacy-reviewed.

  3. 3

    Run a fixture

    Exercise known success, failure, retry, and empty-result cases before relying on aggregate results.

  4. 4

    Answer the question

    Which tools fail most often?

Template versus use case

Use this template to add events

Copy this template when the measurement goal is already clear. Use the matching use-case guide to review event boundaries, success definitions, and the decisions the resulting SQL should support.

Read AI agent quality and evaluation

Template

Paste this into your coding agent

Replace YOUR_API_KEY, run the flow locally, then verify the generated events and dashboards.

ai-agent-observability

AI agent observability template

text
Add Telemetry to this AI agent workflow.

Use /skill.md and this Telemetry API key: YOUR_API_KEY

Log:
1. agent_run_started with agent_name, route, user_id, team_id, model, provider, and input_category.
2. agent_tool_called with tool_name, status, latency_ms, retry_count, and error_type.
3. agent_run_completed with status, duration_ms, total_tokens, estimated_cost_usd, output_category, and accepted when available.
4. agent_run_failed with error_type, failed_step, retry_count, and duration_ms.

Create SQL queries for run volume, failure rate by tool, p95 duration, model cost by feature, and accepted-output rate.

Do not log raw prompts, completions, secrets, auth headers, or personal data unless explicitly approved.

Events to capture

agent_run_startedagent_tool_calledagent_run_completedagent_run_failedai_output_accepted

Verification checklist

Check the events, queries, and dashboard

Events

Synthetic events reach the intended table with stable names and field types.

Queries

The first SQL queries return plausible rows with an explicit time window.

Views

A dashboard uses the real fields and includes enough context to explain a change.

Safety

You checked that events exclude prompts, bodies, credentials, signatures, and private content.

Example event schemas

Check what each event records, when to send it, and which field types it needs. Review the example payload and privacy checklist before using it in production.

Use these queries in Telemetry

Learn about AI agent monitoring

Query agent events to compare tool use, model costs, and outcomes for each run.

Related SQL recipes

More SQL recipes

Run the query using this workflow's event fields and check the example result. Save the result to a dashboard or set up an alert.

Browse all recipes

More templates