Codex SDK (tracing)
Codex SDK (tracing)
The OpenAI Codex SDK (@openai/codex-sdk) lets TypeScript applications start Codex threads and run coding-agent turns programmatically. Use @respan/instrumentation-codex-sdk to send Codex turn activity through the Respan tracing pipeline.
Set up Respan
Create an account at platform.respan.ai and grab an API key.
Run npx @respan/cli setup to set up with your coding agent.
Use Respan Gateway
See Codex SDK gateway setup to route Codex SDK model calls through the Respan gateway.
Example projects
Setup
Initialize and run
Pass sdkModule when your app imports @openai/codex-sdk directly. This ensures the instrumentor patches the same SDK module instance your application uses.
View your trace
Open the Traces page to see Codex SDK turns with agent messages, reasoning, command execution, MCP tool calls, file changes, and errors.
Captured data
Attributes
Use Respan attributes to group Codex runs by user, thread, or workflow.