본문으로 건너뛰기
Skillpedia
에이전트41k · #6833

exploring-llm-traces

하는 일

이 스킬은 AI 에이전트가 무엇을 했는지 단계별로 기록한 AI 트레이스를 읽고, 무엇이 잘못되었거나 잘되었는지 설명합니다. AI 에이전트나 챗봇을 디버깅하는 개발자와 제품 팀을 위한 것입니다.

사용하는 경우

  • ✓에이전트의 트레이스나 세션 링크를 붙여 넣고 AI가 무엇을 했는지 알고 싶을 때.
  • ✓에이전트가 도구나 컨텍스트를 올바르게 사용했는지 확인하고 싶을 때.
  • ✓에이전트 실행 한 번이 토큰과 비용을 얼마나 썼는지 보고 싶을 때.

스킬 링크

https://github.com/PostHog/posthog/blob/master/products/ai_observability/skills/exploring-llm-traces/SKILL.md

복사해서 AI(Claude, ChatGPT, Cursor)에 붙여넣고 지침을 따르도록 요청하세요.

사용 방법

가장 쉬운 방법입니다. 메시지를 복사해 AI에 붙여넣으세요. AI가 스킬을 읽고 지침을 따릅니다.

바로 붙여넣을 수 있는 메시지

Use this skill to help me: https://github.com/PostHog/posthog/blob/master/products/ai_observability/skills/exploring-llm-traces/SKILL.md Read the SKILL.md file at that link and follow its instructions for my task.
AI가 이런 스킬을 알아서 찾아 쓰길 원하시나요?무료 Skillpedia MCP를 설치하세요. 한 줄이면 작업마다 스킬 15,000+개 중에서 검색합니다.1분 만에 설치 →

AI에게 요청하는 예시

“우리 에이전트에서 가져온 트레이스 링크입니다. 무엇이 잘못되었는지, 검색 도구를 올바르게 썼는지 알려 주세요.”

매주 새 스킬 5개. 읽는 데 1분.

작동 방식

링크나 ID로 트레이스를 찾고, 모델 호출과 도구 호출 같은 단계들의 트리를 따라갑니다. 그다음 결정, 입력과 출력, 비용을 쉬운 말로 설명합니다.

기술 내용 (원본 SKILL.md)

작성자의 영어 원문을 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 with posthog:query-llm-trace.
  • /ai-observability/sessions/<session_id> or legacy /llm-analytics/sessions/<session_id> is an AI session, not a trace. Fetch traces with posthog:query-llm-traces-list filtered 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

자주 묻는 질문

트레이스란 무엇인가요?

최상위 에이전트 실행부터 그 안의 각 모델 호출까지 포함한, 하나의 AI 상호작용에 대한 전체 기록입니다.

세션 전체를 읽을 수 있나요?

네. 세션 링크를 열어 그 안에 있는 트레이스를 볼 수 있습니다.

제 앱을 바꾸나요?

아니요. PostHog가 기록한 트레이스 데이터만 읽습니다.

상세 정보

작성자의 원본 설명

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

인기도

GitHub 스타
41k
순위
#6833
라이선스
—
업데이트
2026. 11. 2.

이 스킬이 유용한가요?

0

로그인 투표하려면 로그인하세요.

댓글

  • …

이 저장소의 다른 스킬

비슷한 스킬