Watsonx (tracing)
Watsonx (tracing)
IBM watsonx.ai is IBM’s enterprise AI platform for foundation models and embeddings. Respan traces the official ibm-watsonx-ai Python SDK so direct Watsonx calls show up with prompts, completions, tool calls, embeddings, token usage, latency, workflow names, and custom metadata.
Use this page when your application calls Watsonx directly with IBM credentials.
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 Watsonx gateway setup to route Watsonx calls through the Respan gateway.
Example projects
Setup
Set environment variables
RESPAN_API_KEY exports traces to Respan. WATSONX_API_KEY, WATSONX_PROJECT_ID, and WATSONX_URL are used by the IBM Watsonx SDK.
View your trace
Open the Traces page to see the Watsonx SDK spans with model names, prompt and completion content, token usage, latency, and metadata.
Supported calls
WatsonxInstrumentor() traces these official ibm-watsonx-ai SDK methods:
Chat spans include tool definitions from llm.request.functions and tool calls from the assistant completion. Embedding spans include inputs and usage metadata but do not export embedding vectors.
Configuration
Attributes
In Respan()
Set defaults at initialization. These apply to all spans.
With propagate_attributes
Override attributes for a single request or workflow.
Decorators (optional)
Decorators are not required. Watsonx SDK calls are auto-traced. Use @workflow and @task when you want to group related Watsonx calls into a named trace.