OTel Collector
AI coding agents — Claude Code, OpenAI Codex CLI, and GitHub Copilot — can emit OpenTelemetry (OTLP) data that AgenticAnts ingests. This gives you per-tool usage: sessions, token counts, models, and tool calls, attributed to the user and device.
Content capture is configurable. The setup below enables prompt/tool capture (OTEL_LOG_USER_PROMPTS, OTEL_LOG_TOOL_DETAILS, Codex log_user_prompt = true) so the trace list shows the real question and tool calls. To capture only usage metadata (counts, models, durations, tool names) and keep prompt/response content out of the telemetry, set those switches to 0 / false (or leave them unset).
How it works
Each tool exports OTLP over HTTP to a single ingest endpoint, authenticated with your project keys. AgenticAnts detects which tool sent the data (from the OTel service.name / scope) and parses it into usage records.
| Value | |
|---|---|
| Endpoint (base) | https://<your-agenticants-host>/api/public/shadow-ai/otlp |
| Protocol | http/json (HTTP/protobuf also accepted) |
| Auth | your project's public + secret API key |
Replace <your-agenticants-host> with your platform host (e.g. api.agenticants.ai). Get the public and secret API keys from Settings → API Keys.
Authentication
Send your keys as these headers:
These are equivalent to standard HTTP Basic auth — Authorization: Basic base64(publicKey:secretKey) — so either form works.
Setup
Set the OTel values for each coding agent you use. On macOS you can set them session-wide with launchctl setenv; otherwise add them to your shell profile.
Claude Code reads standard OTEL_* environment variables. Add these to your shell profile (~/.zshrc / ~/.bashrc), or on macOS set them session-wide with launchctl setenv:
OTEL_LOG_USER_PROMPTS and OTEL_LOG_TOOL_DETAILS capture prompt text and tool inputs so the trace list shows the real question and tool calls. To keep content out of the telemetry, set both to 0 (or leave them unset) — usage metadata (counts, models, durations) is still captured.
Restart your terminal (or the Claude Code session) so the variables are picked up.
Environment variable reference
| Tool | Key | Value |
|---|---|---|
| Claude Code | CLAUDE_CODE_ENABLE_TELEMETRY | 1 |
| Claude Code | OTEL_METRICS_EXPORTER | otlp |
| Claude Code | OTEL_LOGS_EXPORTER | otlp |
| Claude Code | OTEL_EXPORTER_OTLP_PROTOCOL | http/json |
| Claude Code | OTEL_EXPORTER_OTLP_ENDPOINT | https://<host>/api/public/shadow-ai/otlp |
| Claude Code / Copilot | OTEL_EXPORTER_OTLP_HEADERS | X-Shadow-Ai-Public-Key=pk-...,X-Shadow-Ai-Secret-Key=sk-... |
| Claude Code | OTEL_LOG_USER_PROMPTS | 1 (capture prompt text; 0/unset to redact) |
| Claude Code | OTEL_LOG_TOOL_DETAILS | 1 (capture tool inputs; 0/unset to redact) |
| Claude Code | OTEL_LOGS_EXPORT_INTERVAL | 5000 (ms) |
| Claude Code | OTEL_METRIC_EXPORT_INTERVAL | 10000 (ms) |
| Claude Code / Codex | OTEL_RESOURCE_ATTRIBUTES | user.id=<email>,user.account_id=<email> |
| Copilot | COPILOT_OTEL_ENABLED | 1 |
| Copilot | COPILOT_OTEL_ENDPOINT | https://<host>/api/public/shadow-ai/otlp |
| Copilot | OTEL_RESOURCE_ATTRIBUTES | service.name=github-copilot-cli,deployment.environment=dev,user.id=<email>,user.account_id=<email> |
| Codex | (see ~/.codex/config.toml [otel] block above; log_user_prompt = true) | — |
OTEL_RESOURCE_ATTRIBUTES ties telemetry to a user (and, when set by the agent, host.id=<device-uuid> ties it to a specific device).
Verify it's working
Confirm the variables are set
Generate activity
Run a prompt in the tool (e.g. ask Claude Code a question, or run a Codex/Copilot command).
Check AgenticAnts
Open AgenticAnts — the tool should appear in your usage/traces view with sessions and token counts within a minute or two.
Troubleshooting
Nothing shows up
- Endpoint reachable? A quick check — an unauthenticated POST should return
401(auth required), not404:Abashcurl -s -o /dev/null -w "%{http_code}\n" -X POST \ -H "Content-Type: application/json" --data '{}' \ https://<your-agenticants-host>/api/public/shadow-ai/otlp/v1/logs404means the OTLP ingest endpoint isn't available on that host — confirm the host and that the endpoint is deployed. 401errors? Check the public/secret keys and that they belong to the right project.- Variables not picked up? Restart the terminal/tool. On macOS,
launchctl setenvapplies to new processes — fully quit and reopen the app.
Codex won't start ("duplicate key")
Codex allows only one [otel] table. Remove any extra [otel*] sections so there's a single managed block.