import requests import json def test_chat(): url = "http://localhost:6000/api/chat" payload = {"message": "I need a prayer for strength"} headers = {"Content-Type": "application/json"} print(f"Testing {url}...") response = requests.post(url, json=payload, headers=headers) if response.status_code == 200: data = response.json() print("Success!") print(json.dumps(data, indent=2)) # Check if trace exists and is populated trace = data.get("response", {}).get("trace", []) if trace: print(f"\nTrace detected with {len(trace)} steps.") for step in trace: print(f" - {step['agent']}: {step['action']}") else: print("\nWarning: No trace detected.") else: print(f"Error: {response.status_code}") print(response.text) if __name__ == "__main__": test_chat()