import requests import json import logging from tools.port_manager import PortManager logging.basicConfig(level=logging.INFO) logger = logging.getLogger(__name__) port_manager = PortManager() def send_test_request(): main_port = port_manager.get_port("main_agent") or 8000 url = f"http://localhost:{main_port}/execute" payload = { "task": { "type": "text_task", "input": """ check online for the cheapest flights from providence rhode island (pvd) to orlando florida (MCO) on feb 17th 2025 compile a list of the cheapest flights write a short email to sp103107@live.com with the list of flights send an email to sp103107@live.com """, "agents": ["travel_search", "email_manager"] } } try: # First check if agents are healthy from check_agents import main as check_agents if not check_agents(): logger.error("Not all required agents are running!") return False # Send request response = requests.post(url, json=payload) logger.info(f"Response status: {response.status_code}") logger.info(f"Response body: {json.dumps(response.json(), indent=2)}") # Check for specific errors in results if response.status_code == 200: results = response.json().get("results", []) for result in results: if "error" in result: logger.error(f"Error in {result['agent']}: {result['error']}") return response.status_code == 200 except Exception as e: logger.error(f"Error sending request: {str(e)}") return False if __name__ == "__main__": send_test_request()