# Codex

> Send Codex CLI operational traces to Radiant Platform over OTLP.

Export Codex’s coding-session activity to Radiant using its OTLP trace exporter. The records include session, model-request and tool-execution operations. To let Codex query Radiant’s project data instead, [connect it through MCP](/docs/platform/integrations/mcp.md).

Use a current Codex CLI and the endpoint and ingestion key from [Set up your project](/docs/platform/set-up-your-project.md). Keep your existing model provider and sign-in configuration.

## Configure the trace exporter

Add the following to the existing `[otel]` section in `~/.codex/config.toml`, or create that section if it is absent. Replace the endpoint and key locally:

**\~/.codex/config.toml**

```toml
[otel]
trace_exporter = { otlp-http = { endpoint = "https://YOUR_INGESTION_HOST/v1/traces", protocol = "binary", headers = { Authorization = "Bearer YOUR_INGESTION_KEY" } } }
```

`trace_exporter` sends spans. The separate `exporter` setting sends OpenTelemetry log events, so pointing that log exporter at `/v1/traces` will not record the session as traces. Retain any existing log destination separately.

Trace headers are static configuration values. Put the actual ingestion key in this private file; a shell expression such as `${RADIANT_INGESTION_KEY}` is not resolved by the trace-header configuration in Codex CLI 0.165.0. Keep the file out of source control and restrict its access to your user.

To label the environment, add `environment = "development"` inside the existing `[otel]` section. Codex exports this as the `env` resource attribute; its default is `dev`. The value applies to telemetry from that process, rather than an individual turn or tool call.

Start a new `codex` session or run the existing `codex exec` workflow. Let the process exit normally so its telemetry exporter can flush.

## Inspect a session

Open the project’s **Logs** and find the turn in **All agent runs**. Radiant recognizes native `codex_exec` turn spans and uses **Codex** as the agent identity when the exporter does not supply one. Open the run to inspect its model-transport and tool-execution records, with the usage reported for that turn.

Use **Conversations** to follow turns from the same coding session. For recognized Codex telemetry, Radiant maps its native conversation identifier to the field used by this view. The original operations, including preparation and transport work, remain in **All traces**. A session can span several traces; grouping brings its turns together without changing their recorded parent relationships.

Prompt logging is controlled separately by `otel.log_user_prompt` on the [log-export path](https://learn.chatgpt.com/docs/config-file/config-advanced#observability-and-telemetry). Radiant’s ingestion endpoint accepts traces, so enabling this setting does not add prompt text to the stored spans. Codex’s native operational traces do not provide a complete normalized model-message Thread.

If the session completes but no records appear, check the trace exporter rather than the log exporter, confirm the `/v1/traces` endpoint and static bearer header, and restart the process after changing configuration. The [OpenAI configuration reference](https://learn.chatgpt.com/docs/config-file/config-reference) lists the trace-exporter settings; [tracing troubleshooting](/docs/platform/reference/telemetry.md#troubleshoot-tracing) covers endpoint and authentication failures.
