-
Notifications
You must be signed in to change notification settings - Fork 686
Python: Handle agent user input request in AgentExecutor #2022
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
base: main
Are you sure you want to change the base?
Python: Handle agent user input request in AgentExecutor #2022
Conversation
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 PR adds support for function approval requests in agent workflows, allowing AI functions to require human approval before execution. The implementation includes both streaming and non-streaming modes with proper state checkpointing.
Key changes:
- Extended
AgentExecutorto handle function approval requests from agents and pause execution until approvals are received - Added checkpoint/restore support for pending approval requests and responses
- Implemented comprehensive test coverage for approval workflows in both streaming and non-streaming modes
Reviewed Changes
Copilot reviewed 4 out of 4 changed files in this pull request and generated 4 comments.
| File | Description |
|---|---|
python/packages/core/agent_framework/_workflows/_agent_executor.py |
Added response handler for function approvals, checkpoint support for pending requests/responses, and refactored agent execution to handle user input requests |
python/packages/core/tests/workflow/test_agent_executor_tool_calls.py |
Added 4 new tests covering approval workflows in streaming/non-streaming modes with single and parallel tool calls |
python/packages/core/tests/workflow/test_agent_executor.py |
Added assertion to verify checkpoint includes pending agent requests and responses |
python/samples/getting_started/workflows/human-in-the-loop/agents_with_approval_requests.py |
Added comprehensive sample demonstrating email workflow with approval requests for reading historical data and sending emails |
python/samples/getting_started/workflows/human-in-the-loop/agents_with_approval_requests.py
Outdated
Show resolved
Hide resolved
Python Test Coverage Report •
Python Unit Test Overview
|
||||||||||||||||||||||||||||||
Motivation and Context
Closes: #1799
Description
This PR adds the following:
Contribution Checklist