The telemetry system in Docker cagent collects anonymous usage data to help improve the tool. All events are processed synchronously when recorded. Telemetry can be disabled at any time.
On first startup, Docker cagent displays a notice about telemetry collection and how to disable it, so users are always informed.
# Environment variable
TELEMETRY_ENABLED=false cagent run agent.yaml
# The application defaults to enabled when no environment variable is set# Use the --debug flag to see telemetry events printed locally
cagent run agent.yaml --debug- Command names and success/failure status
- Agent names and model types
- Tool names and whether calls succeed or fail
- Token counts (input/output totals) and estimated costs
- Session metadata (durations, error counts)
- User input or prompts
- Agent responses or generated content
- File contents
- API keys or credentials
- Personally identifying information
Telemetry is automatically wrapped around all commands. If you need to record additional events, use the context-based approach:
// Recommended: Use context-based telemetry (clean, testable)
if telemetryClient := telemetry.FromContext(ctx); telemetryClient != nil {
telemetryClient.RecordToolCall(ctx, "filesystem", "session-id", "agentName", time.Millisecond*500, nil)
telemetryClient.RecordTokenUsage(ctx, "gpt-4", 100, 50, 0.01)
}
// Or use direct telemetry calls:
telemetry.TrackCommand("run", args)The system uses structured, type-safe events:
- Command events: Track CLI command execution with success status
- Tool events: Track agent tool calls with timing and error information
- Token events: Track LLM token usage by model, session, and cost
- Session events: Track agent session lifecycle with separate start/end events and aggregate metrics
Events are processed synchronously when Track() is called, sending HTTP requests immediately.
Telemetry is enabled by default. To disable it, set:
TELEMETRY_ENABLED=false