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
`user_says` → `turn`, now a `@workflow.update` returning the assistant's
reply directly so callers no longer need a separate `messages` query to
discover what the agent said. The run loop drains in-flight handlers via
`workflow.all_handlers_finished` before continue-as-new.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Copy file name to clipboardExpand all lines: strands_plugin/continue_as_new/README.md
+4-3Lines changed: 4 additions & 3 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -4,9 +4,10 @@ A chat-style workflow accumulates history with every turn and will eventually hi
4
4
5
5
## What This Sample Demonstrates
6
6
7
-
-Maintaining a multi-turn chat over signals and queries
7
+
-Driving a multi-turn chat with **updates**, so each caller gets the assistant's reply back from the same call
8
8
- Seeding a new `TemporalAgent` with prior `agent.messages`
9
9
- Using `workflow.info().is_continue_as_new_suggested()` + `workflow.continue_as_new(...)` to keep the workflow alive indefinitely
10
+
- Draining in-flight update handlers with `workflow.all_handlers_finished` before continue-as-new
10
11
11
12
## Running the Sample
12
13
@@ -18,12 +19,12 @@ uv run strands_plugin/continue_as_new/run_worker.py
18
19
uv run strands_plugin/continue_as_new/run_workflow.py
19
20
```
20
21
21
-
The starter sends a couple of `user_says` signals, queries the message history, then signals `end_chat`. In a real chatbot, a UI would drive the signals and the workflow would run indefinitely, continuing-as-new whenever history gets large.
22
+
The starter calls the `turn` update for each user message and prints the assistant's reply, then signals `end_chat`. In a real chatbot, a UI would drive the updates and the workflow would run indefinitely, continuing-as-new whenever history gets large.
22
23
23
24
## Files
24
25
25
26
| File | Description |
26
27
|------|-------------|
27
-
|`workflow.py`|`ChatInput`, `ChatWorkflow` with `user_says` /`end_chat`signals and `messages` query |
28
+
|`workflow.py`|`ChatInput`, `ChatWorkflow` with `turn` update,`end_chat`signal, and `messages` query |
28
29
|`run_worker.py`| Registers `StrandsPlugin`, starts the worker |
29
30
|`run_workflow.py`| Starts the chat, sends a few turns, ends it |
0 commit comments