Skip to content

:hedgehog: PostHog is the leading platform for building self-driving products. Our developer tools – AI observability, analytics, session replay, flags, experiments, error tracking, logs, and more – capture all the context agents need to diagnose problems, uncover opportunities, and ship fixes. Steer it all from Slack, web, desktop, or the MCP.

fix(ai-observability): correct PostHogSpanProcessor option and pin AI SDK version (#79843)

Vincent (Wen Yu) Ge80e4e27e4290
diff --git a/docs/onboarding/ai-observability/aws-bedrock.tsx b/docs/onboarding/ai-observability/aws-bedrock.tsx
index 0a6b11dae363..da67075941be 100644
--- a/docs/onboarding/ai-observability/aws-bedrock.tsx
+++ b/docs/onboarding/ai-observability/aws-bedrock.tsx
@@ -91,7 +91,7 @@ export const getAWSBedrockSteps = (ctx: OnboardingComponentsContext): StepDefini
}),
spanProcessors: [
new PostHogSpanProcessor({
- apiKey: '<ph_project_token>',
+ projectToken: '<ph_project_token>',
host: '<ph_client_api_host>',
}),
],
diff --git a/docs/onboarding/ai-observability/instructor.tsx b/docs/onboarding/ai-observability/instructor.tsx
index 4e7e125e460c..767087eb50fc 100644
--- a/docs/onboarding/ai-observability/instructor.tsx
+++ b/docs/onboarding/ai-observability/instructor.tsx
@@ -108,7 +108,7 @@ export const getInstructorSteps = (ctx: OnboardingComponentsContext): StepDefini
}),
spanProcessors: [
new PostHogSpanProcessor({
- apiKey: '<ph_project_token>',
+ projectToken: '<ph_project_token>',
host: '<ph_client_api_host>',
}),
],
diff --git a/docs/onboarding/ai-observability/vercel-ai.tsx b/docs/onboarding/ai-observability/vercel-ai.tsx
index adf3f45aec6d..516d370ac9c3 100644
--- a/docs/onboarding/ai-observability/vercel-ai.tsx
+++ b/docs/onboarding/ai-observability/vercel-ai.tsx
@@ -21,9 +21,19 @@ export const getVercelAISteps = (ctx: OnboardingComponentsContext): StepDefiniti
<CodeBlock
language="bash"
code={dedent`
- npm install @posthog/ai @ai-sdk/openai ai @opentelemetry/sdk-node @opentelemetry/resources zod
+ npm install @posthog/ai "ai@^6" "@ai-sdk/openai@^3" @opentelemetry/sdk-node @opentelemetry/resources zod
`}
/>
+
+ <Blockquote>
+ <Markdown>
+ **AI SDK version:** this integration requires AI SDK v5 or v6. AI SDK v7 removed its
+ OpenTelemetry instrumentation, so it no longer emits the `ai.*` spans that
+ `PostHogSpanProcessor` reads, and `telemetry.metadata` is no longer accepted. Installing
+ `ai` without a version constraint gets you v7, which will not produce any events. Pin
+ `ai@^6` with the matching `@ai-sdk/openai@^3` until PostHog ships v7 support.
+ </Markdown>
+ </Blockquote>
</>
),
},
@@ -51,7 +61,7 @@ export const getVercelAISteps = (ctx: OnboardingComponentsContext): StepDefiniti
}),
spanProcessors: [
new PostHogSpanProcessor({
- apiKey: '<ph_project_token>',
+ projectToken: '<ph_project_token>',
host: '<ph_client_api_host>',
}),
],