Spaces:
Build error
Build error
File size: 1,806 Bytes
e20bd8e | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 | 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() |