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-agents): address review feedback on the chat agent guide
Describe the chat agent lifecycle as a durable session rather than a single
run, add an authorization note to the token-minting example, switch the guide
code fences to the typescript language tag, and enable telemetry on the news
verifier's claim-extraction call so it matches the guide's description.
Copy file name to clipboardExpand all lines: docs/guides/ai-agents/chat-agent.mdx
+7-4Lines changed: 7 additions & 4 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -6,15 +6,15 @@ description: "Create a durable, multi-turn chat agent with chat.agent(), then ad
6
6
7
7
## Overview
8
8
9
-
Build a **durable, multi-turn chat agent**. One Trigger.dev run holds the whole conversation, streams tokens to your UI, and stays alive across many back-and-forth messages. The other guides in this section are one-shot workflows (trigger a task, run a fixed sequence of LLM calls, return a result); a chat agent instead owns the session for its whole lifetime.
9
+
Build a **durable, multi-turn chat agent**. A durable session owns the conversation, streams tokens to your UI, and stays alive across many back-and-forth messages. The other guides in this section are one-shot workflows (trigger a task, run a fixed sequence of LLM calls, return a result); a chat agent instead owns the session for its whole lifetime.
10
10
11
11
[`chat.agent()`](/ai-chat/overview) handles the queuing, retries, resumability and streaming for you. You write the model call, Trigger.dev owns the session. For the full feature set (sessions, fast starts, compaction, sub-agents, the frontend transport), see the [AI chat docs](/ai-chat/overview).
12
12
13
13
## A minimal agent
14
14
15
15
Define an agent with `chat.agent()`. The `run` function receives the conversation `messages` (already converted from the frontend's `UIMessage[]`) and an abort `signal`. Return a `StreamTextResult` and it's piped to the frontend automatically.
A chat agent uses tools exactly like any other AI SDK agent. Declare them on the config so their results survive across turns, then pass the `tools` you receive in `run` straight to `streamText`:
@@ -80,7 +80,7 @@ Swap `getCurrentTime` for whatever your agent needs to do: query a database, cal
80
80
81
81
The browser talks to Trigger.dev directly through the [chat transport](/ai-chat/frontend), so there's no API route to maintain. Expose two server actions (one to start the session, one to mint a session-scoped token) and pass them to `useTriggerChatTransport`, then hand the transport to the AI SDK's `useChat`:
82
82
83
-
```ts app/actions.ts
83
+
```typescript app/actions.ts
84
84
"use server";
85
85
86
86
import { auth } from"@trigger.dev/sdk";
@@ -89,6 +89,9 @@ import { chat } from "@trigger.dev/sdk/ai";
Copy file name to clipboardExpand all lines: docs/guides/ai-agents/overview.mdx
+1-1Lines changed: 1 addition & 1 deletion
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -78,7 +78,7 @@ description: "Real world AI agent example tasks using Trigger.dev"
78
78
79
79
## Chat agents
80
80
81
-
Build a durable, multi-turn chat agent with [`chat.agent()`](/ai-chat/overview). One run per conversation, with streaming, sessions and resumability handled for you.
81
+
Build a durable, multi-turn chat agent with [`chat.agent()`](/ai-chat/overview). A durable session per conversation, with streaming and resumability handled for you.
0 commit comments