Getting Started

Quickstart

Get your first agent session traced and visible in the dashboard in under five minutes.

1

Install the SDK

bash
# Core SDK (always needed)
pip install niitaka-sdk

# Include your LLM provider
pip install "niitaka-sdk[openai]"      # OpenAI
pip install "niitaka-sdk[anthropic]"   # Anthropic
pip install "niitaka-sdk[gemini]"      # Google Gemini
pip install "niitaka-sdk[groq]"        # Groq
pip install "niitaka-sdk[langchain]"   # LangChain
pip install "niitaka-sdk[all]"         # Everything

Only install the extras for providers you actually use. The core package is always required.

2

Get your API key

Log in to the Niitaka dashboard, go to Organization → API Keys, and create a key. Store it as an environment variable:

bash
NIITAKA_API_KEY=nii_live_xxxxxxxxxxxx
3

Configure the SDK

Call niitaka.configure() once at startup — before any LLM calls or session starts.

python
import niitaka
import os

niitaka.configure(
    api_key=os.getenv("NIITAKA_API_KEY"),
    api_url="https://api.niitaka.ai",   # or your self-hosted backend
)
4

Instrument your provider

Instrumentation patches the provider client so every call is automatically captured. You don't need to change any of your existing API calls.

python
# Call once at startup — before any LLM calls
niitaka.instrument_openai()

# Or instrument multiple providers
niitaka.instrument_openai()
niitaka.instrument_anthropic()

# Or instrument OpenAI, Anthropic, Gemini, and Groq in one call
niitaka.auto_instrument()

# LiteLLM is not included in auto_instrument() — call it separately if you use it
niitaka.instrument_litellm()
5

Wrap your run in a session

Use start_session() as a context manager around your agent run. Everything inside — LLM calls, tool calls, errors — is automatically associated with this session.

python
import openai

client = openai.OpenAI()

with niitaka.start_session(
    goal="Summarise the quarterly report",
    agent_id="report-summariser",      # matches an agent in the dashboard
):
    response = client.chat.completions.create(
        model="gpt-4o-mini",
        messages=[
            {"role": "system", "content": "You are a concise summariser."},
            {"role": "user",   "content": "Summarise: ..."},
        ],
    )
    print(response.choices[0].message.content)

agent_id should match the Agent you created in the dashboard. If it doesn't exist yet, Niitaka will create it automatically on first use.

6

View your session

Run your agent. Open the Sessions dashboard — your session will appear within seconds with full cost, latency, and event breakdown.