-
-
Notifications
You must be signed in to change notification settings - Fork 1.2k
Expand file tree
/
Copy pathtest_agentic_functionality.py
More file actions
69 lines (51 loc) Β· 2.15 KB
/
test_agentic_functionality.py
File metadata and controls
69 lines (51 loc) Β· 2.15 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
#!/usr/bin/env python3
"""
Real agentic test as required by AGENTS.md section 9.4.
This test verifies that the Agent actually runs end-to-end and calls the LLM,
not just smoke tests. This ensures our thread safety fixes don't break actual
agent functionality.
"""
import sys
import os
# Add the path to find praisonaiagents
sys.path.insert(0, '/home/runner/work/PraisonAI/PraisonAI/src/praisonai-agents')
def test_real_agentic_functionality():
"""Test that Agent actually runs and calls LLM end-to-end."""
print("π§ͺ Running real agentic test (Agent must call LLM)...")
try:
from praisonaiagents import Agent
# Create agent and run a real task
agent = Agent(name="test", instructions="You are a helpful assistant")
print(f"π Agent created: {agent.name}")
# This MUST call the LLM and produce actual output
print("π Starting agent with real prompt...")
result = agent.start("Say hello in one sentence")
# Print full output for verification
print("π Agent output:")
print(f"Result: {result}")
# Verify we got actual output
if not result or not isinstance(result, str) or len(result.strip()) == 0:
print("β Agent did not produce valid output")
return False
print("β
Agent successfully called LLM and produced output!")
return True
except Exception as e:
print(f"β Agent test failed with exception: {e}")
import traceback
traceback.print_exc()
return False
def main():
"""Run the real agentic test."""
print("π€ Testing real agentic functionality after thread safety fixes...\n")
success = test_real_agentic_functionality()
print("\n" + "=" * 60)
if success:
print("π Real agentic test PASSED!")
print("β
Thread safety fixes do not break agent functionality")
else:
print("β Real agentic test FAILED!")
print("β οΈ Agent functionality may be broken")
return success
if __name__ == "__main__":
success = main()
sys.exit(0 if success else 1)