SDK

Advanced Features

Advanced Features for the Nora Observability Python SDK

Advanced Features

Session and User Tracking

import nora
from openai import OpenAI

nora_client = nora.init(
    api_key="your-nora-api-key",
    thread_id="conversation-456",
    user_id="user-123"
)

client = OpenAI(api_key="your-openai-key")

@nora_client.trace_group(name="user_conversation")
def handle_conversation(message):
    response = client.responses.create(
        model="gpt-5",
        input=[
            {
                "role": "user",
                "content": message
            }
        ]
    )
    return response.output_text

result1 = handle_conversation("Hello")
result2 = handle_conversation("Tell me about AI")
print(result1)
print(result2)

All traces are automatically associated with the specified session and user.

Metadata

import nora
from openai import OpenAI

nora_client = nora.init(api_key="your-nora-api-key")
client = OpenAI(api_key="your-openai-key")

@nora_client.trace_group(
    name="custom_workflow",
    metadata={
        "version": "1.0",
        "department": "research",
        "priority": "high"
    }
)
def custom_workflow():
    response = client.responses.create(
        model="gpt-5",
        input=[
            {
                "role": "user",
                "content": "Hello"
            }
        ]
    )
    return response.output_text

result = custom_workflow()
print(result)

Was this page helpful?