exploring-llm-traces
Fungsinya
Skill ini membaca jejak AI, yaitu catatan langkah demi langkah tentang apa yang dilakukan agent AI, dan menjelaskan apa yang salah atau benar. Ditujukan untuk pengembang dan tim produk yang men-debug agent atau chatbot AI.
Kapan dipakai
- βSaat Anda menempelkan tautan jejak atau sesi dan ingin tahu apa yang dilakukan AI.
- βSaat Anda ingin memeriksa apakah agent menggunakan alat atau konteks dengan benar.
- βSaat Anda ingin melihat berapa token dan biaya yang digunakan dalam satu kali eksekusi agent.
Link skill
https://github.com/PostHog/posthog/blob/master/products/ai_observability/skills/exploring-llm-traces/SKILL.mdSalin lalu tempelkan ke AI Anda (Claude, ChatGPT, atau Cursor) dan minta AI mengikuti instruksinya.
Cara pakai
Cara paling mudah: salin pesan ini dan tempelkan ke AI Anda. AI akan membaca skill dan mengikuti instruksinya.
Pesan siap tempel
Untuk Claude Code, Codex, atau Cursor: jalankan di folder proyek, lalu skill langsung terpasang.
Unduh SKILL.md lalu taruh di folder skill agen Anda.
Contoh permintaan ke AI
βIni tautan jejak dari agent kami. Beri tahu saya apa yang salah dan apakah agent menggunakan alat pencarian dengan benar.β
5 skill baru setiap minggu. 1 menit baca.
Cara kerjanya
Skill menemukan jejak dari tautan atau ID, lalu menelusuri pohon langkahnya, seperti panggilan model dan panggilan alat. Setelah itu, skill menjelaskan keputusan, masukan dan keluaran, serta biayanya dengan bahasa yang sederhana.
Konten teknis (SKILL.md asli)
Teks asli dari pembuat, dalam bahasa Inggris, langsung dari GitHub.
Exploring LLM traces with MCP tools
PostHog captures LLM/AI agent activity as traces. Each trace is a tree of events representing a single AI interaction β from the top-level agent invocation down to individual LLM API calls.
Available tools
| Tool | Purpose |
|---|---|
posthog:query-llm-traces-list |
Search and list traces; can return large multi-trace payloads |
posthog:query-llm-trace |
Get a single trace by ID with full event tree |
posthog:read-data-schema |
Discover custom event/person properties before filtering |
posthog:execute-sql |
Ad-hoc SQL for complex trace analysis |
Event hierarchy
See the event reference for the full schema.
$ai_trace (top-level container)
βββ $ai_span (logical groupings, e.g. "RAG retrieval", "tool execution")
βββ $ai_generation (individual LLM API call)
βββ $ai_embedding (embedding creation)
Events are linked via $ai_parent_id β parent's $ai_span_id or $ai_trace_id.
Workflow: debug a trace or session from a URL
Step 1 β Classify the URL
First inspect the path. Do not treat every UUID-looking value as a trace ID.
/ai-observability/traces/<trace_id>or legacy/llm-analytics/traces/<trace_id>//llm-observability/traces/<trace_id>is a single trace. Fetch it withposthog:query-llm-trace./ai-observability/sessions/<session_id>or legacy/llm-analytics/sessions/<session_id>is an AI session, not a trace. Fetch traces withposthog:query-llm-traces-listfiltered by event property$ai_session_id.
Preserve date_from / date_to query parameters from the URL when present.
If none are present but the URL has a timestamp query parameter, use that timestamp as the anchor and query an absolute window around it, for example timestamp - 36h to timestamp + 36h.
This handles exact session links whose UI timestamp may be offset from the stored event timestamps while keeping the query bounded.
If the URL has neither explicit dates nor timestamp, use a safe default like {"date_from": "-7d"}.
For exact trace and session URLs, skip schema discovery for the standard $ai_* fields used below. These are AI observability built-ins, not project-specific custom properties.
Step 2 β Browse trace summaries
Explicitly set detail: "summary" when browsing traces.
This returns event metadata and leaves the conversation content out,
so browsing does not spend context on prompts and outputs.
Omitting detail still returns full detail for compatibility with existing callers.
For a trace URL, call posthog:query-llm-trace with:
{
"traceId": "<trace_id>",
"detail": "summary",
"dateRange": { "date_from": "-7d" }
}
For a session URL, call posthog:query-llm-traces-list with:
{
"detail": "summary",
"dateRange": { "date_from": "<timestamp_minus_36h>", "date_to": "<timestamp_plus_36h>" },
"filterTestAccounts": false,
"limit": 20,
"properties": [{ "type": "event", "key": "$ai_session_id", "value": ["<session_id>"], "operator": "exact" }]
}
Use the URL's date_from / date_to values in the session query if present.
If the URL only has timestamp, calculate the absolute date range from that timestamp instead of using a relative range like -1h.
Set filterTestAccounts: false for an exact URL so the requested trace is not hidden by account filters.
The result contains trace and event metadata only.
Prompts, outputs, span states, $ai_error and $ai_feedback_text are left out,
and their names are listed in _summaryOmittedKeys beside the property bag.
A trace with _detail: { "mode": "summary" } carries no conversation content at all.
Read the content with detail: "full".
From the result you get:
- Every event with its type (
$ai_span,$ai_generation, etc.) - Span names (
$ai_span_name) β these are the tool/step names - Latency, error flags, models used
- Parent-child relationships via
$ai_parent_id _posthogUrlβ always include this in your response so the user can click through to the UI
Step 3 β Read the content needed for the investigation
Once you have selected a trace, request posthog:query-llm-trace with detail: "full" before inspecting
exact tool
Pertanyaan umum
Apa itu jejak?
Jejak adalah catatan lengkap dari satu interaksi AI, dari eksekusi agent tingkat atas hingga setiap panggilan model di dalamnya.
Bisakah membaca seluruh sesi?
Bisa. Skill dapat membuka tautan sesi dan memeriksa jejak yang ada di dalamnya.
Apakah ini mengubah sesuatu di aplikasi saya?
Tidak. Skill hanya membaca data jejak yang dicatat PostHog.
Detail
Deskripsi asli dari pembuat
Debug and inspect LLM/AI agent traces using PostHog's MCP tools. Use when the user pastes a trace or session URL (e.g. /ai-observability/traces/<id> or /ai-observability/sessions/<id>), asks to debug a trace, figure out what went wrong, check if an agent used a tool correctly, verify context/files were surfaced, inspect subagent behavior, investigate LLM decisions, or analyze token usage and costs. Also use when raw SQL/HogQL against `events.properties.$ai_input` / `$ai_output_choices` returns empty β message content lives only on the dedicated `posthog.ai_events` table.
repo: PostHog/posthog
Popularitas
- Bintang GitHub
- 41k
- Peringkat
- #6833
- Lisensi
- β
- Diperbarui
- 2/11/2026
Komentar
- β¦
Skill lain dari repositori ini
depot-ci
41kMembantu agent Anda menyiapkan dan menjalankan alur kerja Depot CI, alternatif GitHub Actions, termasuk memigrasikan alur kerja yang ada dan membaca log eksekusi.
depot-container-builds
41kMembantu agent Anda membangun image Docker di builder jarak jauh Depot, termasuk image multi-platform, pengiriman ke registry, dan perbaikan kegagalan build.
depot-github-runners
41kMembantu agent Anda memindahkan job GitHub Actions ke runner yang dikelola Depot, memilih ukuran dan label runner, serta memecahkan masalah pengaturan runner.
editing-agents-md
41kMembantu agent Anda memutuskan apakah sebuah aturan layak masuk ke berkas AGENTS.md atau CLAUDE.md, dan menulisnya agar tetap dipatuhi tanpa membuat berkas membengkak.
Skill serupa
add-model-provider
394kMemungkinkan agent Anda menghubungkan penyedia model AI baru ke OpenClaw dengan perintah pengaturan yang aman, menjaga kunci API tetap di luar teks biasa, dan menjalankan uji langsung.
acp-router
394kMembantu agent Anda mengirim tugas ke asisten pemrograman seperti Claude Code atau Cursor lewat OpenClaw, sehingga pekerjaan dijalankan di alat tersebut.
browser-automation
394kMengajari agent Anda mengendalikan halaman web langkah demi langkah, termasuk login, tab, dan pemulihan saat halaman berhenti merespons.