Webclat / PostHog Practice

Using PostHog to observe an LLM product, not just a web app

An LLM feature fails differently than a web page - a bad response, a runaway token count, a tool call that silently didn't fire. PostHog's AI-observability layer traces those calls alongside regular product events, which only works if the integration and retention settings are configured for what LLM traces actually contain.

What AI observability adds on top of regular event tracking

PostHog's AI-engineering product traces LLM calls - prompts, completions, token usage, latency, and tool invocations - as structured events tied to the same person and session model as the rest of your product analytics. That means an LLM trace can sit next to the user's product usage, feature-flag exposure, and any errors from the same session, instead of living in a separate LLM-specific tool with no product context.

Where the integrations fit

IntegrationWhat it's for
Claude Agent SDKTracing agent runs built on Anthropic's Agent SDK - tool calls, multi-step reasoning traces, and outcomes captured as PostHog events instead of only living in the agent's own logs
LangFuse / Helicone / TraceloopWhere a team already instruments LLM calls through one of these observability layers, PostHog's integration ingests that trace data rather than requiring a second, parallel instrumentation pass
Perplexity (and other model/API providers)Provider-specific instrumentation for capturing calls made directly against that provider's API

Exact integration setup steps and which providers are supported change frequently in this space - verify the current integration list and install steps against PostHog's own AI-observability docs before committing an implementation plan to a specific one.

Privacy mode, retention, and custom properties - the part people skip

LLM traces often contain prompt and completion text, which is a materially different privacy surface than a pageview event. Before shipping this to production:

  • Privacy mode controls whether full prompt/completion content is captured or redacted/hashed - decide this deliberately against what your data-handling policy actually allows, not the default.
  • Data retention for AI traces may need to differ from your general event retention, especially if traces contain user-submitted content with its own retention obligations.
  • Custom properties let you attach metadata (which prompt template, which model version, which agent tool) to traces - decide on a naming convention before the first trace ships, the same discipline as any other event taxonomy.

How to verify it worked

  1. Run a real LLM call through the integration and confirm the full trace - prompt, completion, token counts, and any tool calls - appears in PostHog, not just a partial event.
  2. If privacy mode is enabled, confirm the actual captured event has redacted/hashed content as expected, not the raw text - test this explicitly rather than assuming the setting applied.
  3. Confirm a multi-step agent trace (Claude Agent SDK or similar) reconstructs as one coherent trace in PostHog's view, not as disconnected individual events with no parent-child relationship.
  4. Check that retention for these traces matches what you configured - separately from your default event retention, if you set it that way.

Frequently Asked Questions

Does this replace a dedicated LLM observability tool like LangFuse?

Not necessarily - PostHog can ingest trace data from LangFuse, Helicone, or Traceloop rather than replacing them outright. The value is joining that trace data with product analytics you already have in PostHog, not necessarily consolidating every LLM-specific feature into one tool.

Is prompt and completion content stored by default?

Capture and retention behavior for trace content is configurable, and defaults have changed as the product matures - verify current behavior against PostHog's docs before assuming any specific default, especially if prompts may contain user-submitted personal data.

Do you help scope this for an agent product specifically?

Yes - tracing an agentic system (Claude Agent SDK or a custom tool-calling loop) needs a taxonomy decision about what counts as one trace versus a family of events, which is exactly the kind of event-architecture work we do for regular product analytics too.

Get your LLM traces architected, not just switched on.

We scope privacy mode, retention, and custom-property naming for AI traces before they ship - the same discipline as any other event taxonomy, applied to prompts and completions.

Architect My AI Traces