Files
agent-framework/python/packages/orchestrations
T
Evan Mattson c5ed8209df Python: Fix StandardMagenticManager to propagate session to manager agent (#4409)
* Fix #4371: Propagate session to manager agent in StandardMagenticManager

StandardMagenticManager._complete() was calling self._agent.run(messages)
without passing a session. This caused context providers (e.g.
RedisHistoryProvider) configured on the manager agent to silently fail,
as each call created a new ephemeral session with a different session_id.

Changes:
- Create an AgentSession in StandardMagenticManager.__init__()
- Pass session=self._session in _complete() calls to agent.run()
- Persist/restore the session in checkpoint save/restore methods
- Add regression tests for session propagation and checkpoint round-trip

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

* Add type: ignore[reportPrivateUsage] to private attribute assertions in tests

Address PR review feedback: add # type: ignore[reportPrivateUsage] comments
to _session attribute accesses in the new regression tests, matching the
existing convention used elsewhere in test_magentic.py (e.g., lines 401-406).

The @pytest.mark.asyncio decorator is not needed because pyproject.toml
sets asyncio_mode = "auto".

Fixes #4371

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

* Address review: use getattr for private _session access in tests (#4371)

Replace direct mgr._session access with getattr(mgr, "_session") to avoid
reportPrivateUsage type-checking warnings without needing type: ignore comments.

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

* Apply pre-commit auto-fixes

* Address PR review: fix session restore guard and improve test robustness (#4371)

- Use 'is not None' instead of truthiness check for session_payload restore
- Use getattr() for private _session attribute access in tests
- Add backward-compatibility test for on_checkpoint_restore with empty state

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

* Make non-async tests plain def to avoid pytest-asyncio dependency (#4409)

Tests that never await anything don't need to be async. Using plain def
ensures they always run regardless of pytest-asyncio configuration.

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

* Apply pre-commit auto-fixes

---------

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
c5ed8209df ยท 2026-03-03 18:26:04 +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.