|
| 1 | +--- |
| 2 | +title: AI Agents Console |
| 3 | +private: true |
| 4 | +further_reading: |
| 5 | + - link: 'https://docs.claude.com/en/docs/claude-code/settings' |
| 6 | + tag: 'Anthropic Documentation' |
| 7 | + text: 'Claude Code settings' |
| 8 | +--- |
| 9 | + |
| 10 | +{{< callout url="https://www.datadoghq.com/product-preview/ai-agents-console/" btn_hidden="false" header="Join the Preview!">}} |
| 11 | +AI Agents Console is in Preview. Complete the form to request access. |
| 12 | +{{< /callout >}} |
| 13 | + |
| 14 | +Datadog's [AI Agents Console][1] provides monitoring for agentic tools like [Claude Code][2], enabling you to collect logs and metrics from developer environments and view them in real time within Datadog. |
| 15 | + |
| 16 | +## Set up AI Agents Console for Claude Code |
| 17 | + |
| 18 | +The following procedure configures Claude Code to send telemetry directly to Datadog with the OpenTelemetry protocol (OTLP). To send telemetry through the Datadog Agent instead, see [Forward data through the Datadog Agent](#via-dd-agent). |
| 19 | + |
| 20 | +1. Ensure that your [Logs configuration][3] includes a catch-all [index][4], or an index that covers `service:claude-code`. |
| 21 | +2. Generate a [Datadog API key][5]. |
| 22 | +3. Set the following environment variables in your Claude Code settings file (for example, `~/.claude/settings.json`): |
| 23 | + |
| 24 | + ```json |
| 25 | + { |
| 26 | + "env": { |
| 27 | + "CLAUDE_CODE_ENABLE_TELEMETRY": "1", |
| 28 | + "OTEL_LOGS_EXPORTER": "otlp", |
| 29 | + "OTEL_EXPORTER_OTLP_LOGS_PROTOCOL": "http/protobuf", |
| 30 | + "OTEL_EXPORTER_OTLP_LOGS_ENDPOINT": "{{< region-param key="http_endpoint_full" >}}/v1/logs", |
| 31 | + "OTEL_EXPORTER_OTLP_HEADERS": "dd-api-key=<DATADOG_API_KEY>", |
| 32 | + "OTEL_METRICS_EXPORTER": "otlp", |
| 33 | + "OTEL_EXPORTER_OTLP_METRICS_PROTOCOL": "http/protobuf", |
| 34 | + "OTEL_EXPORTER_OTLP_METRICS_ENDPOINT": "{{< region-param key="otlp_metrics_endpoint" >}}" |
| 35 | + } |
| 36 | + } |
| 37 | + ``` |
| 38 | + |
| 39 | + Replace `<DATADOG_API_KEY>` with your Datadog API key. |
| 40 | + |
| 41 | + <div class="alert alert-info">To set up AI Agents Console for Claude Code across your organization, your IT team can use a Mobile Device Management (MDM) system to distribute the Claude Code settings file across all managed devices.</div> |
| 42 | +4. Restart Claude Code. |
| 43 | + |
| 44 | +{{% collapse-content title="Alternative setup: Forward data through the Datadog Agent" level="h4" expanded=false id="via-dd-agent" %}} |
| 45 | +1. Ensure that your [Logs configuration][3] includes a catch-all [index][4], or an index that covers `service:claude-code`. |
| 46 | +2. [Install the Datadog Agent][6]. |
| 47 | +3. Configure your Datadog Agent to enable the OpenTelemetry Collector: |
| 48 | + ```yaml |
| 49 | + otlp_config: |
| 50 | + receiver: |
| 51 | + protocols: |
| 52 | + grpc: |
| 53 | + endpoint: 0.0.0.0:4317 |
| 54 | + logs: |
| 55 | + enabled: true |
| 56 | + otelCollector: |
| 57 | + enabled: true |
| 58 | + ``` |
| 59 | +4. Set the following environment variables in your Claude Code settings file (for example, `~/.claude/settings.json`): |
| 60 | + ```json |
| 61 | + { |
| 62 | + "env": { |
| 63 | + "CLAUDE_CODE_ENABLE_TELEMETRY": "1", |
| 64 | + "OTEL_METRICS_EXPORTER": "otlp", |
| 65 | + "OTEL_LOGS_EXPORTER": "otlp", |
| 66 | + "OTEL_EXPORTER_OTLP_ENDPOINT": "http://127.0.0.1:4317", |
| 67 | + "OTEL_EXPORTER_OTLP_PROTOCOL": "grpc", |
| 68 | + "OTEL_METRIC_EXPORT_INTERVAL": "10000" |
| 69 | + } |
| 70 | + } |
| 71 | + ``` |
| 72 | + |
| 73 | + <div class="alert alert-info">To set up AI Agents Console for Claude Code across your organization, your IT team can use a Mobile Device Management (MDM) system to distribute the Claude Code settings file across all managed devices.</div> |
| 74 | + |
| 75 | +5. Restart Claude Code. |
| 76 | +{{% /collapse-content %}} |
| 77 | + |
| 78 | +## Verification |
| 79 | + |
| 80 | +After you restart Claude Code, navigate to the [AI Agents Console][1] in Datadog and click on the **Claude Code** tile. Metrics (usage, cost, latency, errors) should appear within a few minutes. |
| 81 | + |
| 82 | +## Further reading |
| 83 | + |
| 84 | +{{< partial name="whats-next/whats-next.html" >}} |
| 85 | + |
| 86 | +[1]: https://app.datadoghq.com/llm/ai-agents-console |
| 87 | +[2]: https://docs.claude.com/en/docs/claude-code/overview |
| 88 | +[3]: /logs/log_configuration/ |
| 89 | +[4]: /logs/log_configuration/indexes/ |
| 90 | +[5]: https://app.datadoghq.com/organization-settings/api-keys |
| 91 | +[6]: /agent/?tab=Host-based |
0 commit comments