Commit baff7e3
feat(workflows): support combined message + checkpoint_id for multi-turn continuation
Allow Workflow.run(message=..., checkpoint_id=...) so callers can restore
prior workflow state from a checkpoint AND deliver a new message to the
start executor in a single call. The existing reset_context logic
already preserves shared state when checkpoint_id is set, so this gives
us 'fresh start executor invocation with prior state intact' - exactly
what hosted multi-turn declarative workflows need.
- _workflow.py: drop the message+checkpoint_id mutual exclusion and
update _execute_with_message_or_checkpoint to do both (restore then
execute) when both are provided.
- _agent.py: in _run_core's checkpoint branch, also forward
input_messages so WorkflowAgent.run(messages, checkpoint_id=...) works
end-to-end. Falls back to the legacy 'restore only' behavior when
messages are absent.
- _declarative_base.py: detect continuation in _ensure_state_initialized
by checking whether DECLARATIVE_STATE_KEY already exists in shared
state; if so, refresh inputs/LastMessage* and append non-user trigger
messages instead of calling state.initialize() (which would wipe
Conversation/Local/System).
- foundry_hosting/_responses.py: collapse the host's two-call pattern
(restore-only, then fresh run) into a single combined call now that
the underlying APIs support it.
- tests: drop the assertion that combined message+checkpoint_id raises.
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>1 parent dde1edf commit baff7e3
5 files changed
Lines changed: 113 additions & 92 deletions
File tree
- python/packages
- core
- agent_framework/_workflows
- tests/workflow
- declarative/agent_framework_declarative/_workflows
- foundry_hosting/agent_framework_foundry_hosting
Lines changed: 10 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
437 | 437 | | |
438 | 438 | | |
439 | 439 | | |
| 440 | + | |
| 441 | + | |
| 442 | + | |
| 443 | + | |
| 444 | + | |
| 445 | + | |
| 446 | + | |
| 447 | + | |
440 | 448 | | |
441 | 449 | | |
| 450 | + | |
442 | 451 | | |
443 | 452 | | |
444 | 453 | | |
| |||
448 | 457 | | |
449 | 458 | | |
450 | 459 | | |
| 460 | + | |
451 | 461 | | |
452 | 462 | | |
453 | 463 | | |
| |||
Lines changed: 12 additions & 4 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
443 | 443 | | |
444 | 444 | | |
445 | 445 | | |
446 | | - | |
| 446 | + | |
447 | 447 | | |
448 | 448 | | |
449 | 449 | | |
| |||
455 | 455 | | |
456 | 456 | | |
457 | 457 | | |
458 | | - | |
459 | | - | |
| 458 | + | |
| 459 | + | |
| 460 | + | |
| 461 | + | |
460 | 462 | | |
461 | 463 | | |
462 | 464 | | |
| |||
660 | 662 | | |
661 | 663 | | |
662 | 664 | | |
663 | | - | |
| 665 | + | |
| 666 | + | |
| 667 | + | |
| 668 | + | |
| 669 | + | |
| 670 | + | |
| 671 | + | |
664 | 672 | | |
665 | 673 | | |
666 | 674 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
942 | 942 | | |
943 | 943 | | |
944 | 944 | | |
945 | | - | |
946 | | - | |
947 | | - | |
948 | | - | |
949 | | - | |
950 | | - | |
951 | | - | |
952 | | - | |
| 945 | + | |
| 946 | + | |
| 947 | + | |
| 948 | + | |
| 949 | + | |
| 950 | + | |
| 951 | + | |
953 | 952 | | |
954 | 953 | | |
955 | 954 | | |
| |||
Lines changed: 59 additions & 45 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
914 | 914 | | |
915 | 915 | | |
916 | 916 | | |
917 | | - | |
918 | | - | |
919 | | - | |
920 | | - | |
921 | 917 | | |
922 | 918 | | |
923 | | - | |
924 | | - | |
925 | | - | |
926 | | - | |
927 | | - | |
928 | | - | |
929 | | - | |
930 | | - | |
| 919 | + | |
| 920 | + | |
| 921 | + | |
| 922 | + | |
| 923 | + | |
| 924 | + | |
| 925 | + | |
| 926 | + | |
| 927 | + | |
| 928 | + | |
| 929 | + | |
| 930 | + | |
| 931 | + | |
| 932 | + | |
| 933 | + | |
| 934 | + | |
| 935 | + | |
| 936 | + | |
931 | 937 | | |
932 | 938 | | |
933 | 939 | | |
| |||
938 | 944 | | |
939 | 945 | | |
940 | 946 | | |
941 | | - | |
942 | | - | |
943 | | - | |
944 | 947 | | |
945 | 948 | | |
946 | 949 | | |
947 | 950 | | |
948 | | - | |
949 | | - | |
950 | | - | |
951 | | - | |
952 | 951 | | |
953 | 952 | | |
954 | 953 | | |
955 | 954 | | |
956 | 955 | | |
957 | 956 | | |
958 | | - | |
959 | | - | |
960 | | - | |
961 | | - | |
962 | | - | |
963 | | - | |
964 | | - | |
965 | | - | |
966 | | - | |
967 | | - | |
968 | | - | |
969 | | - | |
970 | | - | |
971 | | - | |
972 | | - | |
973 | | - | |
974 | | - | |
975 | | - | |
976 | | - | |
977 | | - | |
| 957 | + | |
| 958 | + | |
| 959 | + | |
| 960 | + | |
| 961 | + | |
| 962 | + | |
| 963 | + | |
| 964 | + | |
| 965 | + | |
| 966 | + | |
| 967 | + | |
| 968 | + | |
| 969 | + | |
| 970 | + | |
| 971 | + | |
978 | 972 | | |
979 | | - | |
| 973 | + | |
| 974 | + | |
| 975 | + | |
| 976 | + | |
| 977 | + | |
| 978 | + | |
| 979 | + | |
| 980 | + | |
| 981 | + | |
| 982 | + | |
| 983 | + | |
| 984 | + | |
| 985 | + | |
980 | 986 | | |
981 | | - | |
982 | | - | |
983 | | - | |
984 | | - | |
985 | | - | |
| 987 | + | |
| 988 | + | |
| 989 | + | |
| 990 | + | |
| 991 | + | |
| 992 | + | |
| 993 | + | |
| 994 | + | |
| 995 | + | |
| 996 | + | |
| 997 | + | |
| 998 | + | |
| 999 | + | |
986 | 1000 | | |
987 | 1001 | | |
988 | 1002 | | |
| |||
Lines changed: 25 additions & 35 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
256 | 256 | | |
257 | 257 | | |
258 | 258 | | |
259 | | - | |
260 | | - | |
261 | | - | |
262 | | - | |
263 | | - | |
264 | | - | |
265 | | - | |
266 | | - | |
267 | | - | |
268 | | - | |
269 | | - | |
270 | | - | |
271 | | - | |
272 | 259 | | |
273 | 260 | | |
274 | 261 | | |
| |||
284 | 271 | | |
285 | 272 | | |
286 | 273 | | |
287 | | - | |
| 274 | + | |
| 275 | + | |
| 276 | + | |
| 277 | + | |
| 278 | + | |
| 279 | + | |
| 280 | + | |
| 281 | + | |
| 282 | + | |
288 | 283 | | |
289 | 284 | | |
290 | 285 | | |
291 | 286 | | |
292 | | - | |
293 | | - | |
294 | | - | |
295 | | - | |
296 | | - | |
297 | | - | |
298 | | - | |
299 | | - | |
300 | | - | |
301 | | - | |
302 | | - | |
303 | | - | |
304 | | - | |
305 | | - | |
| 287 | + | |
306 | 288 | | |
307 | 289 | | |
308 | 290 | | |
309 | 291 | | |
310 | | - | |
311 | | - | |
312 | | - | |
313 | | - | |
314 | | - | |
| 292 | + | |
| 293 | + | |
| 294 | + | |
315 | 295 | | |
316 | 296 | | |
317 | 297 | | |
| |||
320 | 300 | | |
321 | 301 | | |
322 | 302 | | |
323 | | - | |
| 303 | + | |
| 304 | + | |
| 305 | + | |
| 306 | + | |
| 307 | + | |
| 308 | + | |
324 | 309 | | |
325 | 310 | | |
326 | 311 | | |
| |||
336 | 321 | | |
337 | 322 | | |
338 | 323 | | |
339 | | - | |
| 324 | + | |
| 325 | + | |
| 326 | + | |
| 327 | + | |
| 328 | + | |
| 329 | + | |
340 | 330 | | |
341 | 331 | | |
342 | 332 | | |
| |||
0 commit comments