[BREAKING] Python: Move single-config fluent methods to constructor parameters (#3693)

* Move single-config fluent methods to constructor parameters

* Updates

* Adjust magentic and group chat
This commit is contained in:
Evan Mattson
2026-02-07 15:01:52 +09:00
committed by GitHub
Unverified
parent 5d355ac507
commit 74ac470a56
132 changed files with 1341 additions and 2386 deletions
@@ -77,7 +77,7 @@ async def run_agent_framework() -> None:
)
# Create sequential workflow
workflow = SequentialBuilder().participants([researcher, writer, editor]).build()
workflow = SequentialBuilder(participants=[researcher, writer, editor]).build()
# Run the workflow
print("[Agent Framework] Sequential conversation:")
@@ -137,7 +137,7 @@ async def run_agent_framework_with_cycle() -> None:
await context.send_message(AgentExecutorRequest(messages=response.full_conversation, should_respond=True))
workflow = (
WorkflowBuilder()
WorkflowBuilder(start_executor=researcher)
.add_edge(researcher, writer)
.add_edge(writer, editor)
.add_edge(
@@ -145,7 +145,6 @@ async def run_agent_framework_with_cycle() -> None:
check_approval,
)
.add_edge(check_approval, researcher)
.set_start_executor(researcher)
.build()
)
@@ -85,18 +85,14 @@ async def run_agent_framework() -> None:
description="Expert in databases and SQL",
)
workflow = (
GroupChatBuilder()
.participants([python_expert, javascript_expert, database_expert])
.with_orchestrator(
agent=client.as_agent(
name="selector_manager",
instructions="Based on the conversation, select the most appropriate expert to respond next.",
),
)
.with_max_rounds(1)
.build()
)
workflow = GroupChatBuilder(
participants=[python_expert, javascript_expert, database_expert],
max_rounds=1,
orchestrator_agent=client.as_agent(
name="selector_manager",
instructions="Based on the conversation, select the most appropriate expert to respond next.",
),
).build()
# Run with a question that requires expert selection
print("[Agent Framework] Group chat conversation:")
@@ -138,10 +138,10 @@ async def run_agent_framework() -> None:
HandoffBuilder(
name="support_handoff",
participants=[triage_agent, billing_agent, tech_support],
termination_condition=lambda conv: sum(1 for msg in conv if msg.role == "user") > 3,
)
.with_start_agent(triage_agent)
.add_handoff(triage_agent, [billing_agent, tech_support])
.with_termination_condition(lambda conv: sum(1 for msg in conv if msg.role == "user") > 3)
.build()
)
@@ -91,21 +91,17 @@ async def run_agent_framework() -> None:
)
# Create Magentic workflow
workflow = (
MagenticBuilder()
.participants([researcher, coder, reviewer])
.with_manager(
agent=client.as_agent(
name="magentic_manager",
instructions="You coordinate a team to complete complex tasks efficiently.",
description="Orchestrator for team coordination",
),
max_round_count=20,
max_stall_count=3,
max_reset_count=1,
)
.build()
)
workflow = MagenticBuilder(
participants=[researcher, coder, reviewer],
manager_agent=client.as_agent(
name="magentic_manager",
instructions="You coordinate a team to complete complex tasks efficiently.",
description="Orchestrator for team coordination",
),
max_round_count=20,
max_stall_count=3,
max_reset_count=1,
).build()
# Run complex task
last_message_id: str | None = None