From 77a35bb16e597e3792bc1cce881fba58965a6490 Mon Sep 17 00:00:00 2001 From: Eric Allam Date: Thu, 25 Jun 2026 11:19:50 +0100 Subject: [PATCH 1/2] docs(ai-chat): add the 4.5.0-rc.8 changelog entry Covers the chat.agent changes in 4.5.0-rc.8: the apiClient option on chat.headStart and chat.createStartSessionAction, the preview-branch x-trigger-branch fix, and the Head Start prepareMessages fix. --- docs/ai-chat/changelog.mdx | 33 +++++++++++++++++++++++++++++++++ 1 file changed, 33 insertions(+) diff --git a/docs/ai-chat/changelog.mdx b/docs/ai-chat/changelog.mdx index c4c90061b8c..402dbea1fec 100644 --- a/docs/ai-chat/changelog.mdx +++ b/docs/ai-chat/changelog.mdx @@ -4,6 +4,39 @@ sidebarTitle: "Changelog" description: "Pre-release updates for AI chat agents." --- + + +## Point chat sessions at a different project or environment + +[`chat.headStart`](/ai-chat/fast-starts#head-start) and [`chat.createStartSessionAction`](/ai-chat/sessions) now take an `apiClient` option (`baseURL` + `accessToken`). The server that creates the session and triggers the run can target a different project or environment than its ambient Trigger config, without setting a global `TRIGGER_SECRET_KEY`. Useful when your `chat.agent` lives in a separate project from the app serving the route, or when one server starts chats across more than one environment. Your LLM provider keys stay in the `run` callback and are unaffected. ([#4018](https://github.com/triggerdotdev/trigger.dev/pull/4018)) + +```ts +export const POST = chat.headStart({ + agentId: "my-agent", + apiClient: { baseURL, accessToken }, + run: async ({ chat }) => + streamText({ ...chat.toStreamTextOptions({ tools }), model: anthropic("claude-sonnet-4-6") }), +}); +``` + +```ts +const startSession = chat.createStartSessionAction("my-chat", { + apiClient: { baseURL, accessToken }, +}); + +await startSession({ chatId, clientData }); +``` + +## Fix: chat agents on preview branches + +Messaging a `chat.agent` (or `AgentChat`) deployed to a preview branch failed with `x-trigger-branch header required for preview env`. The realtime message-append and stream-subscribe calls now send the `x-trigger-branch` header, resolved the same way `sessions.start` resolves it, so preview-branch chat agents work. ([#4018](https://github.com/triggerdotdev/trigger.dev/pull/4018)) + +## Fix: Head Start handovers with a prepareMessages hook + +A [Head Start](/ai-chat/fast-starts#head-start) handover passes the first turn's pending tool call to the agent as a tool-approval round whose trailing tool message must reach the model untouched. A `prepareMessages` hook that rewrites the last message (for example the recommended [prompt-caching](/ai-chat/prompt-caching) breakpoint) could disturb that tail, so the turn failed with `tool_use ids were found without tool_result`. The agent now preserves the approval tail across `prepareMessages`, so prompt caching and Head Start compose cleanly. ([#4018](https://github.com/triggerdotdev/trigger.dev/pull/4018)) + + + ## chat.headStart now works for custom agents and sessions From c2ea9d17641700ff2582806f6ec032047e8cd7cb Mon Sep 17 00:00:00 2001 From: Eric Allam Date: Wed, 1 Jul 2026 16:37:51 +0100 Subject: [PATCH 2/2] docs(ai-chat): mark the latest changelog entry as the 4.5.0 GA release --- docs/ai-chat/changelog.mdx | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/docs/ai-chat/changelog.mdx b/docs/ai-chat/changelog.mdx index 402dbea1fec..4bd667a4148 100644 --- a/docs/ai-chat/changelog.mdx +++ b/docs/ai-chat/changelog.mdx @@ -1,10 +1,10 @@ --- title: "Changelog" sidebarTitle: "Changelog" -description: "Pre-release updates for AI chat agents." +description: "Changelog for the AI Agents SDK." --- - + ## Point chat sessions at a different project or environment