-
Notifications
You must be signed in to change notification settings - Fork 887
Python: Fix WorkflowAgent to include thread convo history. Enable checkpointing. #2774
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
Python Test Coverage Report •
Python Unit Test Overview
|
||||||||||||||||||||||||||||||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull request overview
This pull request fixes issue #2754 by enabling WorkflowAgent to properly include thread conversation history when running workflows and adds support for checkpoint storage parameters.
Key changes:
- Modified
_run_stream_impl()to retrieve and prepend thread message history to input messages for workflow execution - Added
checkpoint_idandcheckpoint_storageparameters toWorkflowAgent.run()andrun_stream()methods - Added comprehensive test coverage for thread history handling and checkpoint storage integration
Reviewed changes
Copilot reviewed 5 out of 5 changed files in this pull request and generated 3 comments.
Show a summary per file
| File | Description |
|---|---|
| python/packages/core/agent_framework/_workflows/_agent.py | Core implementation: added checkpoint parameters to run/run_stream methods and modified _run_stream_impl to prepend thread history to messages before workflow execution |
| python/packages/core/tests/workflow/test_workflow_agent.py | Added ConversationHistoryCapturingExecutor test helper and four new test cases covering thread history inclusion, empty threads, and checkpoint storage |
| python/samples/getting_started/workflows/agents/workflow_as_agent_with_thread.py | New sample demonstrating multi-turn conversations with workflow-as-agent using AgentThread for conversation history persistence |
| python/samples/getting_started/workflows/checkpoint/workflow_as_agent_checkpoint.py | New sample demonstrating checkpoint storage usage with workflow-as-agent for state persistence and resume capability |
| python/samples/getting_started/workflows/README.md | Added table entries for the two new sample files in the agents and checkpoint sections |
python/samples/getting_started/workflows/agents/workflow_as_agent_with_thread.py
Show resolved
Hide resolved
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Copilot encountered an error and was unable to review this pull request. You can try again by re-requesting a review.
Motivation and Context
Fixes #2754 - Workflows wrapped as agents via
as_agent()now properly include thread conversation history when running.When using
workflow.as_agent()with anAgentThread, the thread's conversation history was not being passed to the workflow execution. This caused the workflow participants to lose context from previous turns, making multi-turn conversations impossible.Modified
WorkflowAgent._run_stream_impl()to retrieve messages fromthread.message_store.list_messages()and prepend them to the input messages before callingworkflow.run_stream().Also added support for
checkpoint_idandcheckpoint_storageparameters inWorkflowAgent.run()andrun_stream()to enable workflow state persistence.Description
Contribution Checklist