Skip to content

Comments

Python: Add CreateConversationExecutor, fix input routing, remove unused handler layer#4159

Open
moonbox3 wants to merge 7 commits intomicrosoft:mainfrom
moonbox3:4129-fix
Open

Python: Add CreateConversationExecutor, fix input routing, remove unused handler layer#4159
moonbox3 wants to merge 7 commits intomicrosoft:mainfrom
moonbox3:4129-fix

Conversation

@moonbox3
Copy link
Contributor

Motivation and Context

  • Adds CreateConversationExecutor to the graph-based executor system, fixing Python: [Bug]: Declarative: Missing CreateConversation implementation #4129
  • Fixes System.LastMessage.Text not being populated from workflow string input, so YAML expressions like =System.LastMessage.Text see the user's message
  • Fixes runner convergence for looping workflows by threading max_iterations through WorkflowFactory / DeclarativeWorkflowBuilder and supporting a maxTurns YAML field
  • Fixes DeepResearch.yaml: adds maxTurns: 500, sets autoSend: false on ManagerAgent to suppress raw JSON output
  • Fixes deep_research/main.py: restores shared YAML path, adds newlines between output events
  • Removes the entire dead action handler layer (6 source files, 3 test files) confirmed unused in Python: remove unnecessary declarative workflows Action Handlers #3904

Supersedes #4065

This branch builds on sample-fixes-8 (#4065) and keeps all of its executor fixes. It supersedes #4065 because that PR worked around missing executors by using a simplified local workflow.yaml; this PR fixes the root causes instead.

Description

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.

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 enhances the Python declarative (graph-based) workflow execution path by adding missing executors (notably CreateConversation), improving input/state routing for PowerFx expressions, and removing an unused legacy “action handler” execution layer.

Changes:

  • Add CreateConversationExecutor, improve dynamic agent name expression evaluation, and adjust branch-exit/terminator handling to prevent incorrect edge wiring.
  • Thread runner iteration limits via WorkflowFactory/DeclarativeWorkflowBuilder, supporting a YAML maxTurns field; update DeepResearch sample accordingly.
  • Remove the unused legacy handler layer and associated tests; update samples/tests to use the executor-based system.

Reviewed changes

Copilot reviewed 24 out of 24 changed files in this pull request and generated 2 comments.

Show a summary per file
File Description
workflow-samples/DeepResearch.yaml Adds maxTurns: 500 and sets autoSend: false to improve looping convergence and suppress raw JSON output.
python/samples/03-workflows/declarative/human_in_loop/main.py Updates streaming output handling to align with executor-based output payloads.
python/samples/03-workflows/declarative/deep_research/main.py Adjusts streaming print formatting (adds newlines between output events).
python/samples/02-agents/context_providers/redis/redis_conversation.py Removes an unused import.
python/samples/01-get-started/06_host_your_agent.py Adds whitespace (formatting-only).
python/packages/declarative/tests/test_workflow_samples_integration.py Switches coverage check from handlers to ALL_ACTION_EXECUTORS.
python/packages/declarative/tests/test_workflow_handlers.py Removes tests for the deleted handler layer.
python/packages/declarative/tests/test_workflow_factory.py Removes tests tied to the deleted handler-layer ActionContext.
python/packages/declarative/tests/test_graph_coverage.py Adds tests for expression-based agent name resolution, terminator branch exit handling, and CreateConversationExecutor.
python/packages/declarative/tests/test_external_input.py Removes tests for the deleted handler-based HITL implementation.
python/packages/declarative/tests/test_additional_handlers.py Removes tests for the deleted handler layer (conversation/variables/etc.).
python/packages/declarative/agent_framework_declarative/_workflows/_human_input.py Removes the handler-based HITL implementation module.
python/packages/declarative/agent_framework_declarative/_workflows/_handlers.py Removes the handler registry/types module.
python/packages/declarative/agent_framework_declarative/_workflows/_factory.py Adds max_iterations plumbing into graph builder creation.
python/packages/declarative/agent_framework_declarative/_workflows/_executors_control_flow.py Ensures JoinExecutor initializes state before passing through.
python/packages/declarative/agent_framework_declarative/_workflows/_executors_basic.py Adds CreateConversationExecutor and registers it in BASIC_ACTION_EXECUTORS.
python/packages/declarative/agent_framework_declarative/_workflows/_executors_agents.py Supports = PowerFx expressions for agent name fields across schema variants.
python/packages/declarative/agent_framework_declarative/_workflows/_declarative_builder.py Adds more terminators, threads max_iterations into WorkflowBuilder, and improves _get_branch_exit terminator handling.
python/packages/declarative/agent_framework_declarative/_workflows/_declarative_base.py Populates System.LastMessage.Text from string (and non-dict) workflow inputs.
python/packages/declarative/agent_framework_declarative/_workflows/_actions_error.py Removes handler-based error actions module.
python/packages/declarative/agent_framework_declarative/_workflows/_actions_control_flow.py Removes handler-based control-flow actions module.
python/packages/declarative/agent_framework_declarative/_workflows/_actions_basic.py Removes handler-based basic actions module.
python/packages/declarative/agent_framework_declarative/_workflows/_actions_agents.py Removes handler-based agent invocation actions module.
python/packages/declarative/agent_framework_declarative/_workflows/init.py Updates exports to reflect the executor-only workflow implementation.

@corradopignato
Copy link

corradopignato commented Feb 23, 2026

Hi @moonbox3, could you also check System.ConversationId?
It seems that its value always remains _default when we call InvokeAzureAgent.
Is this the intended behavior?

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

Projects

Status: No status

Development

Successfully merging this pull request may close these issues.

Python: [Bug]: Declarative: Missing CreateConversation implementation Python: remove unnecessary declarative workflows Action Handlers

5 participants