Comprehensive telemetry system for monitoring agent
performance, tracking metrics, and optimizing AI workflows.
The Telemetry system provides minimal, privacy-focused usage
tracking for Praison Labs Agents. It collects only anonymous
metrics about feature usage, with no personal data, prompts,
or responses tracked. Telemetry is enabled by default but can
be easily disabled via environment variables.
# Set any of these before running your codeexport PRAISONAI_TELEMETRY_DISABLED=trueexport PRAISONAI_DISABLE_TELEMETRY=trueexport DO_NOT_TRACK=true # Universal standard
from praisonaiagents.telemetry import get_telemetry# Get the global telemetry instancetelemetry = get_telemetry()# Check if telemetry is enabledif telemetry.enabled: print("Telemetry is active")# Get current metricsmetrics = telemetry.get_metrics()print(f"Total agent executions: {metrics['agent_executions']}")print(f"Total task completions: {metrics['task_completions']}")print(f"Total tool calls: {metrics['tool_calls']}")print(f"Total errors: {metrics['errors']}")# Get session infoprint(f"Session ID: {telemetry.session_id}")print(f"Environment: {telemetry._environment}")
Praison Labs telemetry includes built-in PostHog support for
anonymous analytics:
Copy
# PostHog integration is automatic when available# Metrics are sent anonymously with session IDs only# No configuration needed - it just works# To verify PostHog is available:try: import posthog print("PostHog integration available")except ImportError: print("PostHog not installed - metrics stored locally only")
Telemetry is designed to be minimal and
privacy-focused
No personal data, prompts, or responses are ever
collected
Always respect user preferences for tracking
Use environment variables for easy opt-out
Performance Impact
Telemetry has minimal overhead
Metrics are stored in memory only (no network calls in
current version)
Automatic integration means no extra code needed
PostHog integration (when available) uses async mode
to prevent blocking
Development vs Production
Copy
# Development - verbose metricsimport osos.environ['LOGLEVEL'] = 'DEBUG'# Production - disable if neededos.environ['PRAISONAI_TELEMETRY_DISABLED'] = 'true'
Praison Labs telemetry is designed to be minimal,
privacy-focused, and helpful. It collects only anonymous
usage metrics to help improve the framework while
respecting user privacy. Telemetry can be easily disabled
at any time.
Assistant
Responses are generated using AI and may contain
mistakes.