TheDocumentation Index
Fetch the complete documentation index at: https://docs.langchain.com/llms.txt
Use this file to discover all available pages before exploring further.
langsmith-codex-plugins marketplace ships a tracing plugin that sends OpenAI Codex session data to LangSmith. Use it to inspect agent turns, model metadata, token usage, tool calls, and subagent threads from your Codex workflows.
Prerequisites
Before setting up tracing, ensure you have:- Codex CLI v0.128 or later.
- A LangSmith API key.
Install and enable the plugin
Add the marketplace using the Codex CLI:~/.codex/config.toml, or only for a specific project in .codex/config.toml:
Configure tracing
Tracing is disabled until eitherTRACE_TO_LANGSMITH is "true" or enabled is true in a config file. Configure credentials with environment variables, a JSON config file, or both.
Environment variables
The plugin reads Codex-specific variables first, then falls back to the generic LangSmith SDK variables.| Variable | Required | Default | Description |
|---|---|---|---|
TRACE_TO_LANGSMITH | Yes | - | Set to "true" to enable tracing. |
LANGSMITH_CODEX_API_KEY | Conditional | - | LangSmith API key. Falls back to LANGSMITH_API_KEY. Required unless every replica provides its own API key. |
LANGSMITH_CODEX_ENDPOINT | No | https://api.smith.langchain.com | LangSmith API URL. Falls back to LANGSMITH_ENDPOINT. |
LANGSMITH_CODEX_PROJECT | No | codex | LangSmith project name. Falls back to LANGSMITH_PROJECT. |
LANGSMITH_CODEX_METADATA | No | - | JSON object merged into root trace metadata. Falls back to LANGSMITH_METADATA. |
LANGSMITH_CODEX_RUNS_ENDPOINTS | No | - | JSON array of replica destinations. Falls back to LANGSMITH_RUNS_ENDPOINTS. |
~/.zshrc, ~/.bashrc, or ~/.bash_profile):
Config file
Use<project>/.codex/langsmith.json for project-level settings or ~/.codex/langsmith.json for global defaults. The global file loads first, the project file overrides it, and matching environment variables take precedence over both.
| Field | Environment variable | Default | Description |
|---|---|---|---|
enabled | TRACE_TO_LANGSMITH | false | Set to true to enable tracing. |
api_key | LANGSMITH_CODEX_API_KEY, LANGSMITH_API_KEY | - | LangSmith API key. |
api_url | LANGSMITH_CODEX_ENDPOINT, LANGSMITH_ENDPOINT | LangSmith default | LangSmith API URL. |
project | LANGSMITH_CODEX_PROJECT, LANGSMITH_PROJECT | codex | LangSmith project name. |
metadata | LANGSMITH_CODEX_METADATA, LANGSMITH_METADATA | - | Object merged into root trace metadata. |
replicas | LANGSMITH_CODEX_RUNS_ENDPOINTS, LANGSMITH_RUNS_ENDPOINTS | - | Additional LangSmith destinations to replicate traces to. |
Trace to multiple destinations
Setreplicas in langsmith.json or LANGSMITH_CODEX_RUNS_ENDPOINTS to send the same trace data to additional LangSmith workspaces or projects. When set, the replica list overrides the other client settings.
Tracing to multiple replicas is useful for:
- Sending traces to both a production and staging project.
- Tracing to multiple workspaces with different API keys.
- Adding extra metadata to specific replica destinations.
- Config file (recommended)
- Shell environment variable
In
<project>/.codex/langsmith.json or ~/.codex/langsmith.json:| Field | Required | Description |
|---|---|---|
apiUrl | Yes | LangSmith API URL (typically https://api.smith.langchain.com). |
apiKey | Yes | API key for the destination workspace. |
projectName | Yes | Project name in the destination workspace. |
updates | No | Optional run fields to override on replicated runs, such as extra metadata. |
What gets traced
Each LLM run includes:- Inputs: accumulated conversation messages.
- Outputs: assistant response content.
- Metadata: model provider, model name, stop reason, and token usage.
View traces in LangSmith
Open the configured LangSmith project and complete a Codex turn. By default traces appear in thecodex project. The plugin uploads completed Codex transcript data, including messages, tool call inputs and outputs, model metadata, token usage, and subagent thread structure.
Troubleshooting
If traces do not appear in LangSmith:- Confirm
plugin_hooks = trueand the tracing plugin is enabled inconfig.toml. - Confirm
TRACE_TO_LANGSMITH=trueis visible to the Codex process. - Confirm
LANGSMITH_CODEX_API_KEYorLANGSMITH_API_KEYis set and valid. - If runs land in the wrong project, set
LANGSMITH_CODEX_PROJECTor theprojectconfig key. - If a custom endpoint is not used, set
LANGSMITH_CODEX_ENDPOINTor theapi_urlconfig key.
Connect these docs to Claude, VSCode, and more via MCP for real-time answers.

