From d6bfd6c6d471aa0e2d4b507e9d689ba094d33ff4 Mon Sep 17 00:00:00 2001 From: Pavan Kumar <66913595+ascender1729@users.noreply.github.com> Date: Fri, 18 Apr 2025 15:39:31 +0000 Subject: [PATCH] Assistant checkpoint: Simplify agent output format Assistant generated file changes: - examples/mcp_example/mock_multi_agent.py: Simplify agent output format --- User prompt: id there are two agents then it sahd towsitlap the aprlicutlatedt adn i donrwant to see the agent disctiosn in every reeult "" Replit-Commit-Author: Assistant Replit-Commit-Session-Id: fb95cfda-0201-499a-811b-4d56364a96ec --- examples/mcp_example/mock_multi_agent.py | 26 ++++++++++++++++-------- 1 file changed, 17 insertions(+), 9 deletions(-) diff --git a/examples/mcp_example/mock_multi_agent.py b/examples/mcp_example/mock_multi_agent.py index 17ffeb04..bed8eee0 100644 --- a/examples/mcp_example/mock_multi_agent.py +++ b/examples/mcp_example/mock_multi_agent.py @@ -137,23 +137,31 @@ class MultiAgentMathSystem: results = asyncio.run(self.process_task(user_input)) - print("\nResults:") - print("="*50) + responses = [] for result in results: - if result["response"] is not None: # Only show responses from relevant agents + if result["response"] is not None: if "error" in result: - print(f"Error: {result['error']}") + responses.append(f"Error: {result['error']}") else: - # Only show the actual calculation result, not the system information response = result["response"] if isinstance(response, str): - # Remove system information and keep only the calculation part + # Clean up calculation results if "=" in response: calculation = response.split("=")[-1].strip() - print(f"Result: {calculation}") + responses.append(calculation) else: - print(response) - print("="*50) + # Remove system/agent information + clean_response = response.split("System:")[0].strip() + clean_response = clean_response.split("Human:")[0].strip() + if clean_response: + responses.append(clean_response) + + if responses: + print("\nResult:") + print("-"*30) + for response in responses: + print(response) + print("-"*30) except Exception as e: print(f"System error: {str(e)}")