-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathdebug_a2a_error.py
More file actions
71 lines (55 loc) · 1.91 KB
/
debug_a2a_error.py
File metadata and controls
71 lines (55 loc) · 1.91 KB
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
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
#!/usr/bin/env python3
import asyncio
import sys
import os
sys.path.append(os.path.join(os.path.dirname(__file__), 'multi_agent_example'))
from load_env import load_environment
from tracing import setup_openllmetry
import logging
# Set debug logging
logging.basicConfig(level=logging.DEBUG)
async def test_a2a_error():
"""Test A2A message sending to identify the error"""
load_environment()
setup_openllmetry()
from agents.a2a_dev_lead import A2ADevLeadAgent
from agents.a2a_developer import A2ADeveloperAgent
print("🧪 Testing A2A Message Error")
print("=" * 50)
# Initialize agents
dev_lead = A2ADevLeadAgent()
developer = A2ADeveloperAgent()
# Start agents
await asyncio.gather(
dev_lead.start(),
developer.start()
)
# Wait for startup
await asyncio.sleep(2)
# Let agents discover each other
await dev_lead.discover_agents()
await developer.discover_agents()
print("📋 Discovered agents:")
print(f" Dev Lead: {list(dev_lead.discovered_agents.keys())}")
print(f" Developer: {list(developer.discovered_agents.keys())}")
# Try to send a message from dev lead to developer
print("📤 Sending message from Dev Lead to Developer...")
try:
response = await dev_lead.send_message("developer_agent", {
"type": "develop_code",
"data": {
"task_id": "test_123",
"description": "Test task",
"requirements": ["Test requirement"]
}
})
print(f"📥 Response: {response}")
except Exception as e:
print(f"❌ Exception caught: {type(e).__name__}: {e}")
import traceback
print(f"Full traceback: {traceback.format_exc()}")
# Stop agents
await dev_lead.stop()
await developer.stop()
if __name__ == "__main__":
asyncio.run(test_a2a_error())