Skip to main content

Hajer SDK

Hajer records what your AI application does in production and checks it against the behaviour you declare. The hajer Python package does both halves:

  • Telemetry: instrument your model clients and declare workflows, components and tools. Spans are exported over OpenTelemetry (OTLP/HTTP) to your team in Hajer, where you read them as traces and sessions.
  • Evals: hajer eval runs your promptfoo suites on a pinned engine, ties each test to the workflows and obligations you declare in hajer.yaml, and uploads the run so it shows on the Tests page next to your repository.

The SDK is open source (MIT) at HajerAI/hajer-sdk and published on PyPI. It supports Python 3.11, 3.12 and 3.13.

Install​

Pick the extra that matches what you run:

pip install "hajer[otel]" # telemetry: the SDK plus the OpenTelemetry exporter
pip install "hajer[evals]" # hajer eval (includes otel); needs Node >= 22.22 on PATH
pip install hajer # core only: records locally, exports nothing
pip install "hajer[openai]" # the SDK with the OpenAI SDK alongside; "hajer[anthropic]" likewise

The core package depends only on httpx>=0.28.1 and pydantic>=2.12. The otel extra adds opentelemetry-sdk>=1.37 and the OTLP/HTTP exporter. It is a separate extra so that installing hajer never moves the OpenTelemetry version your application pins, but without it no span leaves the process, and hajer doctor tells you so. The openai and anthropic extras are a convenience only: the SDK never imports a provider library.

The SDK does not sit in your provider path or act on your behalf. It records what your application already does and exports it.

Get an API key​

The SDK authenticates with a team API key. In app.hajer.ai, open Settings → API keys → Create key. The dialog shows the key once, as a block you can paste into your .env:

HAJER_API_KEY=...
HAJER_TEAM_ID=...
HAJER_BASE_URL=https://api.hajer.ai

Without HAJER_API_KEY and HAJER_TEAM_ID the SDK is inert: your code runs unchanged, it records nothing remotely, and it never raises. Run hajer doctor to see what the SDK picked up.

Where to go next​

You want toRead
See your first trace in five minutesTelemetry quickstart
Instrument OpenAI, Anthropic, LangChain, LiteLLM or GeminiInstrumenting clients
Group spans into conversationsSessions and context
Run your first eval and upload itEvals quickstart
Declare suites and obligationshajer.yaml
Run evals in CIEvals in CI