docs(ai-observability): openai-agents identity goes per run, not on instrument() - #78493
Merged
Merged
Conversation
…nstrument() instrument() registers one process-global tracing processor, so the distinct_id and per-conversation properties the example passed there stamp every run in the process — wrong for any server. Show identity and session per run via RunConfig (group_id -> $ai_session_id, trace_metadata posthog_distinct_id / posthog_properties) and scope instrument() to process-constant config. Requires PostHog/posthog-python#833. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
|
😎 Merged successfully - details. |
Contributor
🤖 CI reportℹ️ Docs preview — preview build triggeredDocs from this PR will be published at posthog.com.
The preview should be ready in about 10 minutes. Open the preview at |
Radu-Raicea
approved these changes
Aug 5, 2026
Contributor
Prompt To Fix All With AI### Issue 1
docs/onboarding/ai-observability/openai-agents.tsx:92-93
**Avoid em dashes in docs**
The new prose uses em dashes here and again on lines 103 and 120, introducing a punctuation pattern prohibited by the repository writing guide. Replace them with periods, commas, or parentheses.
---
For each issue above, determine whether it is valid and should be fixed. If so, fix it directly.Reviews (1): Last reviewed commit: "docs(ai-observability): openai-agents id..." | Re-trigger Greptile |
…eeded Per review: keep posthog-python as-is. The released SDK already resolves a callable distinct_id per trace, so wire it once to read posthog_distinct_id from each run's RunConfig trace_metadata. All per-run values still travel with the call. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
The openai-agents installation docs pass
distinct_id="user_123"andproperties={"conversation_id": "abc123"}toinstrument(). The tracing processor registers once per process, so those values are process-global — every user's runs in a server get stamped with the same identity and "conversation". Surfaced while testingwizard ai-observabilityon the wizard-workbench openai-agents test app: the wizard follows this page and produced events with no usable person attribution.Change
No SDK changes needed — this uses the callable
distinct_idresolver the released SDK already supports, wired once so every per-run value travels with the call:instrument()example scoped to process-constant config, with an Identity scope callout: a staticdistinct_idstring only when one process serves one user (CLI/worker).group_id→$ai_session_idmapping, which the page previously used without explaining.🤖 Generated with Claude Code