Skip to main content
Before you can capture spans you must initialize the tracer. Initialization registers metadata about your application, environment, and any optional detections you want to run on traces.

Basic Initialization

initialize_tracer.py
from quotientai import QuotientAI

quotient = QuotientAI(api_key="your-quotient-api-key")

quotient.tracer.init(
    app_name="my-first-app",
    environment="dev",
)

Advanced: Adding Detections to Traces

For more advanced use cases, you can enable detections on your traces to automatically analyze spans for issues like hallucinations or document relevancy:
advanced_tracer.py
from quotientai import QuotientAI, DetectionType

quotient = QuotientAI(api_key="your-quotient-api-key")

quotient.tracer.init(
    app_name="my-first-app",
    environment="dev",
    detections=[DetectionType.HALLUCINATION, DetectionType.DOCUMENT_RELEVANCY],
)
The detections parameter accepts an array of detection types that will be automatically run on trace data when available.

Parameters

  • app_name (string): Human-friendly name displayed in the Quotient UI.
  • environment (string): Deployment environment (dev, staging, prod, etc.).
  • detections (array): Optional list of detections to run on traces. Currently supports HALLUCINATION and DOCUMENT_RELEVANCY.
  • instruments (array): Instrumentors that automatically attach to supported frameworks. See framework integrations.
  • tags (object, optional): Default metadata attached to every trace.

Tips

  • Initialize the tracer once at application startup—subsequent calls reuse the same configuration.
  • Combine tracer initialization with logger initialization so logs and traces share names and environments.
  • Pass instrumentors during initialization to automatically capture spans from supported frameworks.

Next: Record Traces
I