用 Codex 或 Claude 帮你安装 复制这段 Prompt,粘贴到 Codex、Claude 或其他助手里,让它检查 Skill 页面并帮你完成安装。
直接命令不会经过审查 Prompt;运行前请先检查来源。
npx skills add https://github.com/Jwuthri/Tracely-ai --skill ai-observability-langchain-python命令会保持在同一行。复制前请横向滚动并检查完整内容。
想先保存到本地?可下载 SkillsMP 当前能够提供的文件。
Instrument AI agents with Tracely and turn their production traces into CI gates. Use when the user mentions Tracely, tracely-ai, tracely_sdk, the `tracely` CLI, or asks to trace/observe an AI agent, add LLM evaluators or LLM-as-a-judge columns, debug why a trace or conversation isn't showing up, wire agent regression tests into a PR check, run scenario or red-team suites against an agent endpoint, or replay recorded agent failures in CI. Covers both zero-span-code automatic instrumentation and the manual span API.
Map SEO market leaders, winning content themes, keyword coverage, backlinks, and strategic gaps.
Analyze one competitor's organic footprint, ranking keywords, content themes, backlinks, and gaps.
正在显示 SKILL.md
| name | ai-observability-langchain-python |
| description | PostHog AI Observability integration for LangChain (Python) |
| metadata | {"author":"PostHog","version":"1.48.0"} |
Wire up PostHog's AI Observability so calls made through LangChain (Python) land in LLM Analytics as a full session → trace → span → generation tree — not just isolated $ai_generation events.
This skill instruments the LLM calls the project already makes. It does not install the vendor SDK for you.
Check the project's manifest for an LLM package. The catalog is far wider than the obvious providers — 68 variants covering agent frameworks (openai-agents, claude-agent-sdk, LangGraph, CrewAI, Mastra, …) and OpenAI-compatible gateways (Groq, OpenRouter, Together, Ollama, …), which an app reaches through the openai package plus a baseURL override. 1-begin.md carries the ordered decision rules; follow them rather than matching on the first familiar package name. If no LLM SDK is present, switch to the manual-capture variant — it posts $ai_generation events directly and works standalone.
Everything else this skill needs — PostHog credentials, instrumentation packages, env vars — the skill installs and configures itself. It does not require a pre-existing posthog.init(...). If one is already there, reuse its env-var names in 3-instrument.md; if not, that step sets fresh values via set_env_values.
Read every referenced file before editing. Then work through them in order:
references/1-begin.md. Pick the variant with the ordered rules (framework before provider, gateway base URL before the SDK it borrows), then read four facts from the code: the conversation, the user, the turn, and whether the app registers tools.references/2-install.md. Declare the variant's packages in the manifest — and only those. For providers and gateways that's the PostHog SDK alongside the vendor SDK, with no OpenTelemetry packages.references/3-instrument.md. Swap the vendor client for PostHog's wrapper, attach $ai_session_id, a per-turn posthog_trace_id, and the distinct id to every call, and capture tool runs as $ai_span events. This step is what turns isolated generations into a session tree.references/4-verify.md. Describe a request the user can trigger, and grade what lands in PostHog — one session, grouped traces, right attribution — rather than what the diff contains.references/1-begin.md - Pick the variant that matches this project, then read the four facts the instrumentation needsreferences/2-install.md - Declare the packages the variant needs, and no othersreferences/3-instrument.md - Swap in the wrapper client, then attach identity and tool spans so the calls form a session treereferences/4-verify.md - Give the user a way to trigger one turn, and grade the tree that reaches PostHogreferences/langchain.md - Langchain ai observability installation - docsreferences/python.md - Python - docsreferences/basics.md - Ai observability basics - docsreferences/generations.md - Generations - docsreferences/traces.md - Traces - docsreferences/sessions.md - Sessions - docsreferences/spans.md - SPAns - docsreferences/COMMANDMENTS.md - Framework-specific rules the integration must followThe linked install page carries the exact code blocks for this variant's language. Prefer copying from there over reconstructing from memory — package names and initialization shapes change between AIO releases.
<ph_project_token> and <ph_client_api_host> from env, using the framework's env-var convention. Never hardcode either value.opentelemetry-* variants and LlamaIndex, and never swap a framework's own tracing hook for an instrumentor.$ai_session_id per conversation, one posthog_trace_id per turn, shared by every call in it. An id minted per call is worse than none — it looks instrumented and groups nothing.$ai_span event sharing the turn's trace id — the wrapper never sees your dispatch loop. Framework variants emit these themselves; an app with no tools correctly has none.integration skill — do not add or edit them here.When you finish, write .posthog-wizard-cache/.posthog-ai.json at the project root:
{ "provider": "openai", "package": "@posthog/ai", "otel_init_file": "src/instrumentation.ts" }
otel_init_file keeps its name for the report's sake, but on the wrapper path there is no OTel init — set it to the file where the wrapper client was constructed (or, on the manual path, where the capture helper lives).
The report/ step reads this file to render an AI Observability section in the setup report. If the cache directory does not exist, create it.
pip install posthog or pip install -r requirements.txt and do NOT use unquoted version specifiers like >= directly in shell commands