|
| 1 | +# PraisonAI Agents Telemetry |
| 2 | + |
| 3 | +This module provides minimal, privacy-focused telemetry for PraisonAI Agents. |
| 4 | + |
| 5 | +## Privacy Guarantees |
| 6 | + |
| 7 | +- **No personal data is collected** - No prompts, responses, or user content |
| 8 | +- **Anonymous metrics only** - Usage counts and feature adoption |
| 9 | +- **Opt-out by default** - Respects standard privacy preferences |
| 10 | +- **Transparent collection** - See exactly what's tracked below |
| 11 | + |
| 12 | +## What We Collect |
| 13 | + |
| 14 | +We collect only anonymous usage metrics: |
| 15 | +- Number of agent executions |
| 16 | +- Number of task completions |
| 17 | +- Tool usage (names only, no arguments) |
| 18 | +- Error types (no error messages) |
| 19 | +- Framework version and OS type |
| 20 | +- Anonymous session ID (regenerated each run) |
| 21 | + |
| 22 | +## Disabling Telemetry |
| 23 | + |
| 24 | +Telemetry can be disabled in three ways: |
| 25 | + |
| 26 | +### 1. Environment Variables (Recommended) |
| 27 | + |
| 28 | +Set any of these environment variables: |
| 29 | +```bash |
| 30 | +export PRAISONAI_TELEMETRY_DISABLED=true |
| 31 | +export PRAISONAI_DISABLE_TELEMETRY=true |
| 32 | +export DO_NOT_TRACK=true # Universal standard |
| 33 | +``` |
| 34 | + |
| 35 | +### 2. Programmatically |
| 36 | + |
| 37 | +```python |
| 38 | +from praisonaiagents.telemetry import disable_telemetry |
| 39 | +disable_telemetry() |
| 40 | +``` |
| 41 | + |
| 42 | +### 3. At Runtime |
| 43 | + |
| 44 | +```python |
| 45 | +from praisonaiagents.telemetry import get_telemetry |
| 46 | +telemetry = get_telemetry() |
| 47 | +telemetry.enabled = False |
| 48 | +``` |
| 49 | + |
| 50 | +## Usage |
| 51 | + |
| 52 | +The telemetry module integrates automatically with PraisonAI Agents: |
| 53 | + |
| 54 | +```python |
| 55 | +from praisonaiagents import Agent, Task, PraisonAIAgents |
| 56 | + |
| 57 | +# Telemetry is automatically enabled (unless disabled by environment) |
| 58 | +agent = Agent(name="MyAgent", role="Assistant") |
| 59 | +task = Task(description="Help user", agent=agent) |
| 60 | + |
| 61 | +workflow = PraisonAIAgents(agents=[agent], tasks=[task]) |
| 62 | +result = workflow.start() |
| 63 | + |
| 64 | +# Check telemetry metrics |
| 65 | +from praisonaiagents.telemetry import get_telemetry |
| 66 | +telemetry = get_telemetry() |
| 67 | +print(telemetry.get_metrics()) |
| 68 | +``` |
| 69 | + |
| 70 | +## Implementation Details |
| 71 | + |
| 72 | +The telemetry implementation is minimal and lightweight: |
| 73 | +- No external dependencies required |
| 74 | +- No network calls in current implementation |
| 75 | +- Metrics stored in memory only |
| 76 | +- Future versions may send to PostHog or similar privacy-focused services |
| 77 | + |
| 78 | +## Backward Compatibility |
| 79 | + |
| 80 | +The module maintains compatibility with the previous telemetry interface: |
| 81 | + |
| 82 | +```python |
| 83 | +from praisonaiagents.telemetry import TelemetryCollector |
| 84 | + |
| 85 | +collector = TelemetryCollector() |
| 86 | +collector.start() |
| 87 | + |
| 88 | +with collector.trace_agent_execution("MyAgent"): |
| 89 | + # Agent execution code |
| 90 | + pass |
| 91 | + |
| 92 | +collector.stop() |
| 93 | +``` |
| 94 | + |
| 95 | +## Contributing |
| 96 | + |
| 97 | +When contributing to telemetry: |
| 98 | +1. Never collect personal data or user content |
| 99 | +2. Always make new metrics opt-out |
| 100 | +3. Document what's collected |
| 101 | +4. Keep the implementation minimal |
| 102 | + |
| 103 | +## Future Plans |
| 104 | + |
| 105 | +- Integration with PostHog for anonymous analytics |
| 106 | +- Aggregate usage statistics dashboard |
| 107 | +- Opt-in detailed performance metrics |
| 108 | +- Self-hosted telemetry endpoint option |
0 commit comments