Files
agent-framework/python/packages/orchestrations
T
Evan Mattson 3c31ac28b5 Python: Fix HandoffBuilder dropping function-level middleware when cloning agents (#5220)
* Fix HandoffBuilder dropping function-level middleware when cloning agents (#5173)

_clone_chat_agent() was using agent.agent_middleware (agent-level only)
instead of agent.middleware (all types), which silently dropped any
function middleware registered on the original agent.

Changed to use agent.middleware to preserve all middleware types
(agent, function, and chat) during cloning.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>

* Python: Fix HandoffBuilder dropping function-level middleware when cloning agents

Fixes #5173

* Fix false-positive middleware regression test (#5173)

The test used isinstance(m, FunctionMiddleware) which matched
_AutoHandoffMiddleware (always appended during build) instead of the
user's @function_middleware decorator. Assert directly that
tracking_middleware is present in the cloned agent's middleware list.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>

* Address review feedback for #5173: Python: [Bug]: HandoffBuilder drops function-level middleware when cloning agents

---------

Co-authored-by: Copilot <copilot@github.com>
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
3c31ac28b5 ยท 2026-04-14 04:52:03 +00:00
History
..

Agent Framework Orchestrations

Orchestration patterns for Microsoft Agent Framework. This package provides high-level builders for common multi-agent workflow patterns.

Installation

pip install agent-framework-orchestrations --pre

Orchestration Patterns

SequentialBuilder

Chain agents/executors in sequence, passing conversation context along:

from agent_framework.orchestrations import SequentialBuilder

workflow = SequentialBuilder(participants=[agent1, agent2, agent3]).build()

ConcurrentBuilder

Fan-out to multiple agents in parallel, then aggregate results:

from agent_framework.orchestrations import ConcurrentBuilder

workflow = ConcurrentBuilder(participants=[agent1, agent2, agent3]).build()

HandoffBuilder

Decentralized agent routing where agents decide handoff targets:

from agent_framework.orchestrations import HandoffBuilder

workflow = (
    HandoffBuilder()
    .participants([triage, billing, support])
    .with_start_agent(triage)
    .build()
)

GroupChatBuilder

Orchestrator-directed multi-agent conversations:

from agent_framework.orchestrations import GroupChatBuilder

workflow = GroupChatBuilder(
    participants=[agent1, agent2],
    selection_func=my_selector,
).build()

MagenticBuilder

Sophisticated multi-agent orchestration using the Magentic One pattern:

from agent_framework.orchestrations import MagenticBuilder

workflow = MagenticBuilder(
    participants=[researcher, writer, reviewer],
    manager_agent=manager_agent,
).build()

Documentation

For more information, see the Agent Framework documentation.