-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtest_google_adk.py
More file actions
181 lines (145 loc) Β· 6.81 KB
/
Copy pathtest_google_adk.py
File metadata and controls
181 lines (145 loc) Β· 6.81 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
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
#!/usr/bin/env python3
"""
Test Google ADK (Agent Development Kit) Orchestrator
"""
import sys
import asyncio
import time
# Add src to path
sys.path.append('src')
from src.agents.google_adk_orchestrator import google_adk_orchestrator
async def test_google_adk():
"""Test Google ADK orchestrator functionality"""
print("π€ Testing Google ADK (Agent Development Kit) Orchestrator")
print("=" * 70)
# Test agent status
print("π Agent Status Check")
status = google_adk_orchestrator.get_agent_status()
print(f"β
Orchestrator Initialized: {status['orchestrator_initialized']}")
print(f"β
Total Agents: {status['total_agents']}")
print(f"β
Available Agents: {', '.join(status['available_agents'])}")
if status['agent_details']:
print("\nπ§ Agent Details:")
for agent_type, details in status['agent_details'].items():
print(f" {agent_type.replace('_', ' ').title()}: {details['model_type']} ({'β
' if details['initialized'] else 'β'})")
if not status['orchestrator_initialized']:
print("\nβ οΈ Google ADK Orchestrator not fully initialized")
print("This is expected if Google Cloud credentials are not set up")
return True
# Test comprehensive analysis
print(f"\nπ Testing Comprehensive Startup Analysis")
test_startup = {
"company_name": "TechFlow AI",
"industry": "Artificial Intelligence",
"stage": "Series A",
"description": "AI-powered analytics platform for small businesses providing instant insights and recommendations",
"funding_request": "$5M",
"key_metrics": "50 pilot customers, $50K MRR, 95% customer satisfaction"
}
startup_id = f"adk_test_{int(time.time())}"
print(f"Company: {test_startup['company_name']}")
print(f"Industry: {test_startup['industry']}")
print(f"Stage: {test_startup['stage']}")
print(f"Startup ID: {startup_id}")
try:
print(f"\nβ±οΈ Starting Google ADK Analysis...")
start_time = time.time()
# Run comprehensive analysis
results = await google_adk_orchestrator.orchestrate_comprehensive_analysis(
test_startup,
startup_id,
"test_user"
)
analysis_time = time.time() - start_time
print(f"\nβ
Analysis Completed in {analysis_time:.2f} seconds")
print("=" * 70)
# Display results summary
print("π ANALYSIS SUMMARY")
print(f"Company: {results.get('company_name')}")
print(f"Processing Time: {results.get('processing_time', 0):.2f} seconds")
print(f"Agents Used: {len(results.get('agents_used', []))}")
print(f"Recommendation: {results.get('recommendation', 'Unknown')}")
print(f"Confidence Score: {results.get('confidence_score', 0):.2f}")
# Executive Summary
summary = results.get('summary', '')
if summary:
print(f"\nπ Executive Summary:")
print(f" {summary[:200]}...")
# Agent Results Overview
agent_results = results.get('agent_results', {})
if agent_results:
print(f"\nπ€ Agent Results Overview:")
for agent_type, result in agent_results.items():
status = result.get('status', 'unknown')
processing_time = result.get('processing_time', 0)
model_used = result.get('model_used', 'unknown')
print(f" {agent_type.replace('_', ' ').title()}:")
print(f" Status: {status}")
print(f" Time: {processing_time:.2f}s")
print(f" Model: {model_used}")
# Show key insights
analysis_result = result.get('analysis_result', {})
if analysis_result.get('key_points'):
print(f" Key Points: {len(analysis_result['key_points'])} insights")
# Next Steps
next_steps = results.get('next_steps', [])
if next_steps:
print(f"\nπ Recommended Next Steps:")
for i, step in enumerate(next_steps, 1):
print(f" {i}. {step}")
print("\n" + "=" * 70)
print("π Google ADK Test Completed Successfully!")
# Test individual agent if we want to see detailed output
if len(agent_results) > 0:
print(f"\nπ Sample Agent Output (First Agent):")
first_agent = list(agent_results.values())[0]
analysis_result = first_agent.get('analysis_result', {})
if analysis_result.get('analysis'):
sample_output = analysis_result['analysis'][:500]
print(f" {sample_output}...")
elif analysis_result.get('structured_data'):
print(f" Structured data with {len(analysis_result['structured_data'])} fields")
return True
except Exception as e:
print(f"β Google ADK test failed: {str(e)}")
import traceback
traceback.print_exc()
return False
async def test_individual_agent():
"""Test individual agent functionality"""
print(f"\n㪠Testing Individual Agent Functionality")
if not google_adk_orchestrator.initialized:
print("β οΈ Orchestrator not initialized, skipping individual agent test")
return
# Test data collection agent
if "data_collection" in google_adk_orchestrator.agents:
print(f"\nπ Testing Data Collection Agent")
test_data = {
"company_name": "QuickStart SaaS",
"industry": "Software",
"stage": "Seed",
"description": "Project management tool for remote teams"
}
try:
agent = google_adk_orchestrator.agents["data_collection"]
result = await agent.analyze(test_data)
print(f"β
Agent Status: {result.get('status')}")
print(f"β
Processing Time: {result.get('processing_time', 0):.2f}s")
print(f"β
Model Used: {result.get('model_used')}")
print(f"β
Confidence: {result.get('confidence_score', 0):.2f}")
# Show sample output
analysis = result.get('analysis_result', {})
if analysis.get('summary'):
print(f"β
Analysis Summary: {analysis['summary'][:100]}...")
except Exception as e:
print(f"β Individual agent test failed: {str(e)}")
if __name__ == "__main__":
async def main():
try:
await test_google_adk()
await test_individual_agent()
except Exception as e:
print(f"β Test failed: {str(e)}")
sys.exit(1)
# Run the async test
asyncio.run(main())