You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
docs(ai-chat): document AI SDK 7 support and version compatibility
Update the compatibility matrix with the v7 peer range and an
`@ai-sdk/otel` row, add an "AI SDK 7 telemetry" section covering the
adapter install and the auto-register opt-out, and surface the
supported `ai` versions (v5/v6/v7) up front in the quick start.
Copy file name to clipboardExpand all lines: docs/ai-chat/quick-start.mdx
+2Lines changed: 2 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -10,6 +10,8 @@ import RcBanner from "/snippets/ai-chat-rc-banner.mdx";
10
10
11
11
These steps assume you already have a Trigger.dev project with the SDK installed and the CLI authenticated — if you don't, follow [Manual setup](/manual-setup) (or `npx trigger.dev@latest init` in an existing project) first. You should be able to run `pnpm exec trigger dev` from your project root before continuing.
12
12
13
+
The chat surface works with Vercel AI SDK **v5, v6, or v7**; install whichever major you want. On **v7**, also install `@ai-sdk/otel` so your model calls are traced (the SDK registers it for you). See [compatibility](/ai-chat/reference#compatibility) for the full matrix.
14
+
13
15
<Steps>
14
16
<Steptitle="Define a chat agent">
15
17
Use `chat.agent` from `@trigger.dev/sdk/ai` to define an agent that handles chat messages. The `run` function receives `ModelMessage[]` (already converted from the frontend's `UIMessage[]`) — pass them directly to `streamText`.
Copy file name to clipboardExpand all lines: docs/ai-chat/reference.mdx
+14-1Lines changed: 14 additions & 1 deletion
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -13,14 +13,27 @@ import RcBanner from "/snippets/ai-chat-rc-banner.mdx";
13
13
| Dependency | Supported | Notes |
14
14
|---|---|---|
15
15
|`@trigger.dev/sdk`|`>=4.5.0-rc.0`| The chat agent surface lives in this SDK release. Install with `@trigger.dev/sdk@rc`. |
16
-
|`ai` (Vercel AI SDK) |`^5.0.0 \|\| ^6.0.0`| Declared as a peer. v6 is what we develop against day to day. |
16
+
|`ai` (Vercel AI SDK) |`^5.0.0 \|\| ^6.0.0 \|\| >=7.0.0-canary <8`| Declared as a peer. v6 is what we develop against day to day; v5 and v7 work too (v7 is in canary/beta upstream). Your installed `ai` major drives the chat surface's types. |
17
+
|`@ai-sdk/otel`|`1.x` (v7 only) | Optional. AI SDK 7 moved model-call span emission out of `ai` core into this adapter. Install it alongside `ai@7` and the SDK auto-registers it, so your model calls show up as spans in the run trace. Not needed on v5/v6, where `ai` core emits spans. See [AI SDK 7 telemetry](#ai-sdk-7-telemetry) below. |
17
18
|`@ai-sdk/react`| matches your `ai` major | Pulled in by `useChat`. The transport works with whichever React hook ships in the same major as your `ai` version. |
18
19
|`react`|`^18.0 \|\| ^19.0`| Required only if you use `@trigger.dev/sdk/chat/react` (the frontend transport). Server-only consumers can skip React entirely. |
19
20
| Node.js |`>=18.20.0`| The SDK's engine constraint. The chat agent itself works on any version the SDK supports. |
20
21
| Provider packages (`@ai-sdk/openai`, `@ai-sdk/anthropic`, etc.) | versions that target your `ai` major | Pick a provider package whose `ai` peer matches yours. The chat agent doesn't depend on any specific provider — pass whatever model you want into `streamText`. |
21
22
22
23
The `ai` peer is **optional** — server-only setups that don't call `streamText` (raw `task()` with chat primitives) can skip the AI SDK entirely.
23
24
25
+
### AI SDK 7 telemetry
26
+
27
+
On **AI SDK 7**, model-call spans are emitted by `@ai-sdk/otel` rather than `ai` core. Install it alongside `ai@7`:
28
+
29
+
```bash
30
+
npm install @ai-sdk/otel
31
+
```
32
+
33
+
The SDK registers it once per worker at chat agent boot, so the `experimental_telemetry` config wired up by `chat.toStreamTextOptions()` keeps producing spans in your run trace with no extra setup. On v5 and v6 nothing changes: `ai` core emits the spans and `@ai-sdk/otel` isn't needed.
34
+
35
+
If you (or a library you import) already register `@ai-sdk/otel` yourself, the SDK detects the existing integration and skips its own registration, so you won't get duplicate spans. To opt out of the auto-registration entirely, set `TRIGGER_AI_SDK_OTEL_AUTOREGISTER=0`.
0 commit comments