Skip to content

Conversation

@TaoChenOSU
Copy link
Contributor

@TaoChenOSU TaoChenOSU commented Nov 7, 2025

Motivation and Context

Closes: #1799

Description

This PR adds the following:

  1. Allow agent executor to surface requests from the underlying agent to the workflow
  2. Add a sample to demonstrate
  3. Add unit tests

Contribution Checklist

  • The code builds clean without any errors or warnings
  • The PR follows the Contribution Guidelines
  • All unit tests pass, and I have added new tests where possible
  • Is this a breaking change? If yes, add "[BREAKING]" prefix to the title of the PR.

@TaoChenOSU TaoChenOSU self-assigned this Nov 7, 2025
Copilot AI review requested due to automatic review settings November 7, 2025 23:34
@TaoChenOSU TaoChenOSU added python workflows Related to Workflows in agent-framework labels Nov 7, 2025
@github-actions github-actions bot changed the title Handle agent user input request in AgentExecutor Python: Handle agent user input request in AgentExecutor Nov 7, 2025
Copy link
Contributor

Copilot AI left a 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 AgentExecutor to 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

@markwallace-microsoft
Copy link
Member

Python Test Coverage

Python Test Coverage Report •
FileStmtsMissCoverMissing
packages/core/agent_framework/_workflows
   _agent_executor.py1462682%86, 98–100, 125–126, 128–129, 144–145, 195–196, 198, 202, 232–234, 244–246, 248, 252, 256, 260–261, 281
TOTAL13075192385% 

Python Unit Test Overview

Tests Skipped Failures Errors Time
1744 107 💤 0 ❌ 0 🔥 35.140s ⏱️

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

python workflows Related to Workflows in agent-framework

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Expose function approval requests from AgentExecutor

2 participants