From a877cc8a47e6d66aa94823d599291695247a7d39 Mon Sep 17 00:00:00 2001 From: Pavan Kumar <66913595+ascender1729@users.noreply.github.com> Date: Thu, 17 Apr 2025 17:19:12 +0000 Subject: [PATCH] style: enhance output formatting in multi-agent architecture - Improved clarity and readability of agent responses in `multi_server_test.py` - Added a dedicated function to format multi-agent outputs consistently --- examples/mcp_example/multi_server_test.py | 26 ++++++++++++++++++++--- 1 file changed, 23 insertions(+), 3 deletions(-) diff --git a/examples/mcp_example/multi_server_test.py b/examples/mcp_example/multi_server_test.py index de1144f9..21c2a098 100644 --- a/examples/mcp_example/multi_server_test.py +++ b/examples/mcp_example/multi_server_test.py @@ -52,9 +52,20 @@ super_agent = Agent( model_name="gpt-4o-mini" ) +def format_agent_output(agent_name: str, output: str) -> str: + return f""" +╭─── {agent_name} Response ───╮ +{output} +╰───────────────────────────╯ +""" + def main(): print("\nMulti-Agent MCP Test Environment") print("Type 'exit' to quit\n") + print("Available commands:") + print("- math: (e.g., 'math: add 5 and 3')") + print("- finance: (e.g., 'finance: calculate compound interest on 1000 at 5% for 3 years')") + print("- Any other calculation will use the super agent\n") while True: try: @@ -66,13 +77,22 @@ def main(): # Route request to appropriate agent based on keywords if 'finance' in user_input.lower(): response = finance_agent.run(user_input) - print(f"\nFinance Agent Response: {response}") + print("\nFinance Agent Response:") + print("-" * 50) + print(f"Response: {response}") + print("-" * 50) elif 'math' in user_input.lower(): response = math_agent.run(user_input) - print(f"\nMath Agent Response: {response}") + print("\nMath Agent Response:") + print("-" * 50) + print(f"Response: {response}") + print("-" * 50) else: response = super_agent.run(user_input) - print(f"\nSuper Agent Response: {response}") + print("\nSuper Agent Response:") + print("-" * 50) + print(f"Response: {response}") + print("-" * 50) except KeyboardInterrupt: print("\nExiting gracefully...")