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
Copy file name to clipboardExpand all lines: docs/ai-chat/custom-agents.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
@@ -146,7 +146,7 @@ Without this, a resumed chat silently loses its history: the model sees only the
146
146
147
147
### Rotating to a new deployment
148
148
149
-
With `chat.createSession()`, use `chat.requestUpgrade()`to leave the current run after the turn. `chat.endAndContinue()`rejects while a `chat.createSession()`iterator is active. In a fully hand-rolled custom agent, use it to immediately hand the Session to a fresh run.
149
+
With `chat.createSession()`, use `chat.requestUpgrade()`and let the iterator exit normally. For an immediate handoff, close the iterator before calling `chat.endAndContinue()`; the method rejects until the iterator and any active `next()`call have settled. In a fully hand-rolled custom agent, call it directly to hand the Session to a fresh run.
150
150
151
151
Call it between turns, after detaching the old run's input listeners. If the old run completed its current turn, persist its state and write the turn-complete boundary before the handoff:
Copy file name to clipboardExpand all lines: docs/ai-chat/patterns/version-upgrades.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
@@ -153,7 +153,7 @@ This upgrades on **every** deploy, not just breaking changes. Good for fast-movi
153
153
154
154
## Custom agents
155
155
156
-
Use `chat.requestUpgrade()` with `chat.agent()` and the `chat.createSession()`iterator. In a fully hand-rolled `chat.customAgent()` task, detach input listeners, persist the completed turn, write its boundary, then call `chat.endAndContinue()` and return immediately:
156
+
Use `chat.requestUpgrade()` with `chat.agent()`. With `chat.createSession()`, call `chat.requestUpgrade()`, then advance the iterator once more so it can exit normally. For an immediate handoff, close the iterator before calling `chat.endAndContinue()`. In a fully hand-rolled `chat.customAgent()` task, detach input listeners, persist the completed turn, write its boundary, then call `chat.endAndContinue()` and return immediately:
157
157
158
158
```ts
159
159
// Detach any chat.messages.on() subscriptions you created.
0 commit comments