Observability
Instrument your agents with OpenTelemetry using the SDK’s hooks system to capture traces for every agent turn and tool use.
AI Gateway Beta
Route your Claude calls through the AI Gateway with a single base URL change. Zero vendor lock-in: always run on the best model at the lowest cost for your use case.
Observability
Overview
The Claude Agent SDK (claude-agent-sdk) drives the Claude CLI as a programmable agent supporting multi-turn conversations, tool use, and MCP servers. Use the SDK’s built-in hooks system to attach OpenTelemetry instrumentation at key execution points. Every tool invocation becomes a span, and the full agent workflow is captured as a trace in orq.ai without modifying your agent logic.
Key Benefits
Full Agent Visibility
Track every agent turn, tool use, and LLM call with detailed traces and analytics
Zero Code Changes
Attach observability through hooks without modifying your agent logic
Cost Tracking
Real-time cost and token usage per agent run synced to Orq.ai
Tool Inspection
Inspect every tool input and output with full execution context
Prerequisites
- An Orq.ai account and API Key
- Python 3.10 or higher, or Node.js 18 or higher
- Claude Code CLI installed and authenticated
To set up your API key, see API keys & Endpoints.
Install Dependencies
- TypeScript
- Python
Configuration
Set up the OTel tracer provider to export spans to Orq.ai:- TypeScript
- Python
TypeScript
Basic Example
- TypeScript
- Python
Spread the imported SDK module into a mutable namespace, then call
ClaudeAgentSDKInstrumentation.manuallyInstrument(...) before sdk.start(). The instrumentation patches every query() call, tool use, and subagent into spans automatically.TypeScript
View Traces
View your traces in the AI Studio in the Traces tab.Visit your AI Studio to view real-time analytics and traces.
AI Gateway
Overview
Route the Claude Agent SDK’s model calls through Orq.ai’s AI Gateway without changing any agent logic. The SDK drives the Claude CLI, which readsANTHROPIC_BASE_URL and ANTHROPIC_AUTH_TOKEN from the environment, so pointing those variables at the gateway routes every turn through Orq.ai.
For the raw Claude Messages API without the agent runtime, see the Anthropic SDK integration.
Configuration
Set the following environment variables before running the agent:Basic Example
With the environment variables set, every agent run routes through the AI Gateway with no change to the calling code:- TypeScript
- Python
TypeScript
Other Integrations
Claude Code
Route Claude Code through the AI Gateway using environment variables. Integrate Claude Code with our MCP to access 20+ tools and actions on the platform.
Claude Desktop
Connect your Orq.ai workspace to Claude Desktop using the MCP integration.