mirror of
https://github.com/microsoft/agent-framework.git
synced 2026-06-16 21:04:09 +08:00
Python: Remove deprecated add_agent() calls from workflow samples (#1508)
* Initial plan * Remove add_agent calls from workflow samples Co-authored-by: moonbox3 <35585003+moonbox3@users.noreply.github.com> --------- Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com> Co-authored-by: moonbox3 <35585003+moonbox3@users.noreply.github.com>
This commit is contained in:
committed by
GitHub
Unverified
parent
2046f16cdb
commit
151efd2e80
@@ -16,12 +16,10 @@ A Writer agent generates content, then a Reviewer agent critiques it.
|
||||
The workflow uses streaming so you can observe incremental AgentRunUpdateEvent chunks as each agent produces tokens.
|
||||
|
||||
Purpose:
|
||||
Show how to wire chat agents into a WorkflowBuilder pipeline using add_agent
|
||||
with settings for streaming and workflow outputs.
|
||||
Show how to wire chat agents into a WorkflowBuilder pipeline by adding agents directly as edges.
|
||||
|
||||
Demonstrate:
|
||||
- Automatic streaming of agent deltas via AgentRunUpdateEvent when using run_stream().
|
||||
- Add an agent via WorkflowBuilder.add_agent() with output_response=True to emit final AgentRunResponse.
|
||||
- Agents adapt to workflow mode: run_stream() emits incremental updates, run() emits complete responses.
|
||||
|
||||
Prerequisites:
|
||||
@@ -67,13 +65,10 @@ async def main() -> None:
|
||||
"Provide the feedback in the most concise manner possible."
|
||||
),
|
||||
)
|
||||
# Add agents to workflow with custom settings using add_agent.
|
||||
# Build the workflow by adding agents directly as edges.
|
||||
# Agents adapt to workflow mode: run_stream() for incremental updates, run() for complete responses.
|
||||
# Reviewer agent emits final AgentRunResponse as a workflow output.
|
||||
workflow = (
|
||||
WorkflowBuilder()
|
||||
.add_agent(writer, id="Writer")
|
||||
.add_agent(reviewer, id="Reviewer", output_response=True)
|
||||
.set_start_executor(writer)
|
||||
.add_edge(writer, reviewer)
|
||||
.build()
|
||||
|
||||
+1
-3
@@ -107,11 +107,9 @@ async def main() -> None:
|
||||
|
||||
workflow = (
|
||||
WorkflowBuilder()
|
||||
.add_agent(research_agent, id="research_agent")
|
||||
.add_agent(final_editor_agent, id="final_editor_agent", output_response=True)
|
||||
.set_start_executor(research_agent)
|
||||
.add_edge(research_agent, enrich_with_references)
|
||||
.add_edge(enrich_with_references, final_editor_agent)
|
||||
.set_start_executor(research_agent)
|
||||
.build()
|
||||
)
|
||||
|
||||
|
||||
@@ -13,12 +13,10 @@ A Writer agent generates content, then a Reviewer agent critiques it.
|
||||
The workflow uses streaming so you can observe incremental AgentRunUpdateEvent chunks as each agent produces tokens.
|
||||
|
||||
Purpose:
|
||||
Show how to wire chat agents into a WorkflowBuilder pipeline using add_agent
|
||||
with settings for streaming and workflow outputs.
|
||||
Show how to wire chat agents into a WorkflowBuilder pipeline by adding agents directly as edges.
|
||||
|
||||
Demonstrate:
|
||||
- Automatic streaming of agent deltas via AgentRunUpdateEvent when using run_stream().
|
||||
- Add an agent via WorkflowBuilder.add_agent() with output_response=True to emit final AgentRunResponse.
|
||||
- Agents adapt to workflow mode: run_stream() emits incremental updates, run() emits complete responses.
|
||||
|
||||
Prerequisites:
|
||||
@@ -51,14 +49,10 @@ async def main():
|
||||
)
|
||||
|
||||
# Build the workflow using the fluent builder.
|
||||
# Add agents to workflow with custom settings using add_agent.
|
||||
# Agents adapt to workflow mode: run_stream() for incremental updates, run() for complete responses.
|
||||
# Reviewer agent emits final AgentRunResponse as a workflow output.
|
||||
# Set the start node and connect an edge from writer to reviewer.
|
||||
# Agents adapt to workflow mode: run_stream() for incremental updates, run() for complete responses.
|
||||
workflow = (
|
||||
WorkflowBuilder()
|
||||
.add_agent(writer_agent, id="Writer")
|
||||
.add_agent(reviewer_agent, id="Reviewer", output_response=True)
|
||||
.set_start_executor(writer_agent)
|
||||
.add_edge(writer_agent, reviewer_agent)
|
||||
.build()
|
||||
|
||||
-2
@@ -167,8 +167,6 @@ async def main() -> None:
|
||||
|
||||
workflow = (
|
||||
WorkflowBuilder()
|
||||
.add_agent(writer_agent, id="Writer")
|
||||
.add_agent(final_editor_agent, id="FinalEditor", output_response=True)
|
||||
.set_start_executor(writer_agent)
|
||||
.add_edge(writer_agent, feedback_coordinator)
|
||||
.add_edge(feedback_coordinator, request_info_executor)
|
||||
|
||||
Reference in New Issue
Block a user