For AI agents: a documentation index is available at the root level at /llms.txt and /llms-full.txt. Append /llms.txt to any URL for a page-level index, or .md for the markdown version of any page.
  • About NVIDIA NeMo Relay
    • Overview
    • Architecture
    • Ecosystem
    • Concepts
    • Release Notes
  • Getting Started
    • Agent Runtime Primer
    • Prerequisites
    • Installation
    • Configuration / Setup
    • Quick Start
  • NVIDIA NeMo Relay CLI
    • About
    • Basic Usage
    • Claude Code
    • Codex
    • Cursor
    • Hermes Agent
  • Supported Integrations
    • About
    • OpenClaw Plugin Guide
    • LangChain Integration Guide
    • LangGraph Integration Guide
    • Deep Agents Integration Guide
  • Instrument Applications
    • About
    • Adding Scopes and Marks
    • Instrument a Tool Call
    • Instrument an LLM Call
    • Add Middleware
    • Code Examples
  • Observability Plugin
    • About
    • Configuration
    • Agent Trajectory Interchange Format (ATIF)
    • Agent Trajectory Observability Format (ATOF)
    • OpenTelemetry
    • OpenInference
  • Adaptive Plugin
    • About
    • Configuration
    • Adaptive Cache Governor (ACG)
    • Adaptive Hints
  • NeMo Guardrails Plugin
    • About
    • Configuration
  • Integrate into Frameworks
    • About
    • Adding Scopes
    • Wrap Tool Calls
    • Wrap LLM Calls
    • Handle Non-Serializable Data
    • Using Codecs
    • Provider Codecs
    • Provider Response Codecs
    • Code Examples
  • Build Plugins
    • About
    • Define a Plugin
    • Validate Plugin Configuration
    • Plugin Configuration Files
    • Register Plugin Behavior
    • Design Plugin Configuration
    • NeMo Guardrails Example Plugin
    • Code Examples
  • Contribute
    • About
    • Development Setup
    • Workflow and Reviews
    • Testing and Documentation
  • Reference
    • APIs
    • Performance
  • Resources
    • Support and FAQs
    • Glossary
    • Troubleshooting Guide
    • Community
    • Legal
NVIDIANVIDIA
Developer-friendly docs for your API
Privacy Policy | Your Privacy Choices | Terms of Service | Accessibility | Corporate Policies | Product Security | Contact

Copyright © 2026, NVIDIA Corporation.

LogoLogo
On this page
  • Requirements
  • Transparent Run
  • Shared Config
  • Standalone Gateway
  • Captured Events
  • Smoke Test
  • Verify Export
  • Troubleshoot LLM Lifecycle
NVIDIA NeMo Relay CLI

Codex

||View as Markdown|
Previous

Claude Code

Next

Cursor

Use this guide to observe local Codex CLI sessions and local Codex GUI or app sessions that honor the same local config and gateway routing. Cloud or remote Codex tasks are partial or unsupported for local gateway LLM capture because the local gateway cannot observe provider traffic that never reaches the machine.

Requirements

codex-cli >= 0.129.0. The gateway uses the features.hooks flag and the nemo-relay-openai provider alias, both of which require this version. Earlier versions either reject the provider override or do not recognize the hooks feature flag.

As of Codex 0.129, Codex requires hooks to be manually reviewed and activated before they run. Generated NeMo Relay hook configuration is not enough on its own if Codex leaves those hooks inactive. Review and activate the installed or injected hooks in Codex before expecting NeMo Relay events. This is being tracked upstream as openai/codex#21639.

Transparent Run

Use the wrapper for no-install local observability:

$nemo-relay codex

Pass Codex arguments after --:

$nemo-relay codex -- exec "Summarize this repository."

This shortcut is equivalent to nemo-relay run -- codex. The wrapper starts a gateway on a dynamic 127.0.0.1 port, enables Codex hooks with CLI config overrides, injects hook commands that use NEMO_RELAY_GATEWAY_URL, and points Codex at a temporary nemo-relay-openai provider alias that uses the gateway URL while preserving Codex’s OpenAI auth path.

Inspect what would be launched without starting Codex:

$nemo-relay run \
> --dry-run \
> --print \
> -- codex

Shared Config

Create .nemo-relay/config.toml for project defaults or ~/.config/nemo-relay/config.toml for user defaults:

1[upstream]
2openai_base_url = "https://api.openai.com/v1"
3
4[agents.codex]
5command = "codex"

Then configure observability with nemo-relay plugins edit --project or .nemo-relay/plugins.toml:

1version = 1
2
3[[components]]
4kind = "observability"
5enabled = true
6
7[components.config.atif]
8enabled = true
9output_directory = ".nemo-relay/atif"

Run nemo-relay run --agent codex to use the configured command and plugin config. User config takes priority over project and system config.

Standalone Gateway

Use the long-running gateway only when you want Codex running outside the wrapper:

$nemo-relay --bind 127.0.0.1:4040

Then edit ~/.codex/config.toml and configure local Codex to use a gateway provider alias instead of overriding the reserved built-in openai provider:

1model_provider = "nemo-relay-openai"
2
3[model_providers.nemo-relay-openai]
4name = "NeMo Relay OpenAI"
5base_url = "http://127.0.0.1:4040"
6wire_api = "responses"
7requires_openai_auth = true
8supports_websockets = false

After saving the file, restart the Codex GUI or app so it reloads the provider configuration. For CLI usage, start a new codex process.

Some Codex GUI or app versions appear to scope visible conversation history by the active provider configuration. If existing conversations disappear after switching model_provider to nemo-relay-openai, the history has not been removed if it returns after restoring the previous provider configuration. Use this standalone provider alias only while capturing gateway telemetry, or prefer the transparent wrapper for CLI sessions. See the upstream Codex history visibility discussion for context.

Local Codex GUI or app sessions have the same support level only when they read the same local hook/plugin config and provider routing. Cloud tasks may still emit some lifecycle hooks, but complete LLM lifecycle capture requires model traffic to pass through the gateway.

Captured Events

Generated Codex hooks include SessionStart, SessionEnd, SubagentStart, SubagentStop, PreToolUse, PostToolUse, PostToolUseFailure, Notification, and PreCompact for scope, tool, and mark events. UserPromptSubmit, AfterAgentResponse, AfterAgentThought, and Stop are retained as private LLM correlation hints and are not emitted as standalone NeMo Relay events.

The transparent wrapper passes hook entries as Codex CLI config overrides and sets features.hooks=true for that launched process. Persistent install writes .codex/config.toml with features.hooks = true and merges generated hook entries into .codex/hooks.json.

Smoke Test

Run a small Codex prompt that starts a session and uses one simple tool. Then check hook forwarding directly:

$curl -f http://127.0.0.1:4040/healthz
$printf '{"session_id":"smoke-codex","hook_event_name":"sessionStart"}' \
> | NEMO_RELAY_GATEWAY_URL=http://127.0.0.1:4040 nemo-relay hook-forward codex --fail-closed

The response should match Codex hook semantics. For most lifecycle events it is an empty JSON object.

Verify Export

End the Codex session and confirm Agent Trajectory Interchange Format (ATIF) exists:

$ls .nemo-relay/atif

The gateway writes <session-id>.atif.json after every conversation turn for Codex sessions (Codex’s hook surface has no SessionEnd-equivalent event, so the gateway uses each per-turn Stop hook to snapshot the trajectory; the file grows cumulatively across turns and the final write reflects the full session). For agents that do emit a session-end hook, the same file is written once on session close. If the file is missing, confirm features.hooks = true, hook config loading, and that plugins.toml enables the ATIF exporter with a writable output_directory.

Troubleshoot LLM Lifecycle

If agent/tool events exist but LLM spans are missing, the active Codex provider is not pointing at the gateway for the active Codex process. If only GUI sessions are missing spans, confirm the GUI is using local provider configuration rather than a remote execution path.

If LLM spans exist but attach to the session instead of a subagent, pass x-nemo-relay-subagent-id on gateway requests or include shared conversation_id, generation_id, or request_id values in both hook payloads and provider requests.