Skip to content

SDK Reference

The Orq SDK is available for Python and Node.js. It wraps your LLM calls to capture traces and forwards eval results to the Orq platform.

Installation

Python
pip install orq-ai-sdk
Node
npm install @orq-ai/sdk

orq.trace()

Wraps a callable and captures its inputs, outputs, latency, and token counts as a trace event.

Python
import orq

@orq.trace(name="my_agent_step")
def call_llm(prompt: str) -> str:
    response = openai.chat.completions.create(
        model="gpt-4o-mini",
        messages=[{"role": "user", "content": prompt}]
    )
    return response.choices[0].message.content

orq.eval()

Scores a trace against a named eval suite. Returns a score object with pass/fail per metric.

Python
result = orq.eval(
    trace_id=trace.id,
    suite="production-quality-v2"
)
if not result.passed:
    print("Metrics that regressed:", result.failed_metrics)

Configuration

Set your API key via environment variable or explicitly in code:

Shell
export ORQ_API_KEY="sk-orq-..."

Next steps