Docs/Integrations/Coding Agent Telemetry

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
Protocolhttp/json (HTTP/protobuf also accepted)
Authyour 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:

code
X-Shadow-Ai-Public-Key: pk-... X-Shadow-Ai-Secret-Key: sk-...

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:

bash
export CLAUDE_CODE_ENABLE_TELEMETRY=1 export OTEL_METRICS_EXPORTER=otlp export OTEL_LOGS_EXPORTER=otlp export OTEL_EXPORTER_OTLP_PROTOCOL=http/json export OTEL_EXPORTER_OTLP_ENDPOINT="https://<your-agenticants-host>/api/public/shadow-ai/otlp" export OTEL_EXPORTER_OTLP_HEADERS="X-Shadow-Ai-Public-Key=pk-...,X-Shadow-Ai-Secret-Key=sk-..." # Content capture (prompt + tool details) — required for the full trace view export OTEL_LOG_USER_PROMPTS=1 export OTEL_LOG_TOOL_DETAILS=1 # Flush intervals (ms) — how often logs / metrics are exported export OTEL_LOGS_EXPORT_INTERVAL=5000 export OTEL_METRIC_EXPORT_INTERVAL=10000 # User attribution — ties every trace to a user on the Users page export OTEL_RESOURCE_ATTRIBUTES="user.id=<your-email>,user.account_id=<your-email>"

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

ToolKeyValue
Claude CodeCLAUDE_CODE_ENABLE_TELEMETRY1
Claude CodeOTEL_METRICS_EXPORTERotlp
Claude CodeOTEL_LOGS_EXPORTERotlp
Claude CodeOTEL_EXPORTER_OTLP_PROTOCOLhttp/json
Claude CodeOTEL_EXPORTER_OTLP_ENDPOINThttps://<host>/api/public/shadow-ai/otlp
Claude Code / CopilotOTEL_EXPORTER_OTLP_HEADERSX-Shadow-Ai-Public-Key=pk-...,X-Shadow-Ai-Secret-Key=sk-...
Claude CodeOTEL_LOG_USER_PROMPTS1 (capture prompt text; 0/unset to redact)
Claude CodeOTEL_LOG_TOOL_DETAILS1 (capture tool inputs; 0/unset to redact)
Claude CodeOTEL_LOGS_EXPORT_INTERVAL5000 (ms)
Claude CodeOTEL_METRIC_EXPORT_INTERVAL10000 (ms)
Claude Code / CodexOTEL_RESOURCE_ATTRIBUTESuser.id=<email>,user.account_id=<email>
CopilotCOPILOT_OTEL_ENABLED1
CopilotCOPILOT_OTEL_ENDPOINThttps://<host>/api/public/shadow-ai/otlp
CopilotOTEL_RESOURCE_ATTRIBUTESservice.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

bash
# shell session env | grep -E "CLAUDE_CODE_ENABLE_TELEMETRY|OTEL_|COPILOT_OTEL" # macOS session-wide (set via launchctl / the agent) launchctl getenv OTEL_EXPORTER_OTLP_ENDPOINT cat ~/.codex/config.toml # Codex

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), not 404:
    bash
    curl -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/logs
    A 404 means the OTLP ingest endpoint isn't available on that host — confirm the host and that the endpoint is deployed.
  • 401 errors? Check the public/secret keys and that they belong to the right project.
  • Variables not picked up? Restart the terminal/tool. On macOS, launchctl setenv applies 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.

© 2026 ANTS Platform, Inc.Docs v1.0 · Last updated June 2026