diff --git a/examples/multi_agent/sequential_workflow/demo_sequential_workflow_streaming.py b/examples/multi_agent/sequential_workflow/demo_sequential_workflow_streaming.py index 6b6d104e..3905f44c 100644 --- a/examples/multi_agent/sequential_workflow/demo_sequential_workflow_streaming.py +++ b/examples/multi_agent/sequential_workflow/demo_sequential_workflow_streaming.py @@ -1,17 +1,11 @@ -from typing import Callable from swarms.structs.agent import Agent from swarms.structs.sequential_workflow import SequentialWorkflow -def create_streaming_callback() -> Callable[[str, str, bool], None]: - """ - Create a streaming callback that prints each chunk as it arrives, with no duplication or timestamps. - """ - def streaming_callback(agent_name: str, chunk: str, is_final: bool): - if chunk: - print(chunk, end="", flush=True) - if is_final: - print() - return streaming_callback +def streaming_callback(agent_name: str, chunk: str, is_final: bool): + if chunk: + print(chunk, end="", flush=True) + if is_final: + print() def create_agents(): """Create specialized agents for the workflow.""" @@ -37,9 +31,6 @@ def create_agents(): ] if __name__ == "__main__": - print("šŸŽÆ SEQUENTIAL WORKFLOW STREAMING DEMO") - print("=" * 50) - agents = create_agents() workflow = SequentialWorkflow( id="research_analysis_workflow", @@ -53,19 +44,7 @@ if __name__ == "__main__": task = "What are the latest advancements in AI?" - print(f"Task: {task.strip()}") - - streaming_callback = create_streaming_callback() - - print("\nšŸŽ¬ EXECUTING WITH STREAMING CALLBACKS...") - print("Watch real-time agent outputs below:\n") - - result = workflow.run( + workflow.run( task=task, streaming_callback=streaming_callback, ) - - print("\nšŸŽ‰ EXECUTION COMPLETED!") - print("\nšŸ“Š FINAL RESULT:") - print("-" * 50) - print(result) \ No newline at end of file