-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathtest_telemetry_automatic.py
More file actions
47 lines (40 loc) · 1.27 KB
/
test_telemetry_automatic.py
File metadata and controls
47 lines (40 loc) · 1.27 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
#!/usr/bin/env python3
"""
Test that telemetry works automatically without manual instrumentation.
"""
# NO manual telemetry setup - it should work automatically!
from praisonaiagents import Agent, Task, PraisonAIAgents
# Create a simple agent
agent = Agent(
name="AutoTelemetryTest",
role="Math Expert",
goal="Perform calculations",
instructions="You are a helpful math expert."
)
# Create a task
task = Task(
description="Calculate 5 + 5",
expected_output="The sum",
agent=agent
)
# Create and run workflow
workflow = PraisonAIAgents(
agents=[agent],
tasks=[task],
process="sequential"
)
print("Running workflow (telemetry should be automatic)...")
result = workflow.start()
print(f"Result: {result}")
# Check if telemetry was collected
from praisonaiagents.telemetry import get_telemetry
telemetry = get_telemetry()
if telemetry.enabled:
metrics = telemetry.get_metrics()
print(f"\n✅ Telemetry is working automatically!")
print(f"- Agent executions: {metrics['metrics']['agent_executions']}")
print(f"- Task completions: {metrics['metrics']['task_completions']}")
print(f"- Session ID: {metrics['session_id']}")
print("\nTelemetry data will be sent to PostHog on program exit.")
else:
print("\n❌ Telemetry is disabled")