NexusOpenAITracingProcessor to capture every span emitted by the OpenAI Agents SDK and send it to Nexus automatically.
Install
Set up the processor
Runner.run calls in the process are captured automatically.
Environment variables
| Variable | Values | Behavior |
|---|---|---|
NEXUS_API_KEY | your API key | Authenticates the Nexus client |
NEXUS_DEV_MODE | true | Disables external trigger POST — use locally and in CI |
NEXUS_DEV_MODE | false (default) | Fires the trigger endpoint — use in production |
Full example
Dev vs production
- Development — set
NEXUS_DEV_MODE=truein your.envfile. The processor records traces locally without firing the external trigger endpoint. - Production — set
NEXUS_DEV_MODE=false(or leave it unset). The processor firesPOST {trigger_url}/catch_route_manualwithuser_idandtrace_idafter each root span completes.
Best practices
- Store
NEXUS_API_KEYin environment variables — never hardcode it. - Reuse one
NexusClientfor the lifetime of the process. - Call
set_trace_processorsonce at startup, before anyRunner.runcalls.
nexus_api_key from the Nexus platform: Nexus platform.