Skip to content

Python API reference

This page covers the public names exported from scouter. For end-to-end setup and examples, start with the guides in the rest of the docs.

  • alert: Alert configuration objects for Slack, OpsGenie, and console dispatch.
  • bifrost: Data access helpers for table-oriented reads and writes.
  • client: HTTP client helpers for registering profiles and querying results.
  • drift: Drift profile creation and drift result types.
  • evaluate: Offline and online evaluation helpers, task types, and result handling.
  • agent: Provider integrations, prompt types, and LLM-facing helpers.
  • logging: Rust-backed logging configuration and logger access.
  • mock: Fixtures and mock utilities used in tests and examples.
  • observe: Observation helpers for runtime instrumentation.
  • profile: Data profiling classes and feature statistics.
  • queue: Queue producers and async ingestion helpers.
  • trace: Convenience wrappers for trace context utilities.
  • tracing: Tracing runtime, exporters, and instrumentors.
  • transport: Transport configuration for HTTP, gRPC, Kafka, RabbitMQ, and Redis.
  • types: Shared feature, metric, and alert types.
  • util: Utility helpers used by client-side integrations.
  • service_map: Service map middleware and connection records.
Drifter()

Instantiate Rust Drifter class that is used to create monitoring profiles and compute drifts.

SpcDriftConfig(space: str = '__missing__', name: str = '__missing__', version: str = '0.1.0', sample_size: int = 25, alert_config: SpcAlertConfig = SpcAlertConfig(), config_path: Optional[Path] = None)

Initialize monitor config

class SpcDriftProfile

See the signature above and the guide docs for usage examples.

class SpcFeatureDriftProfile

See the signature above and the guide docs for usage examples.

class SpcFeatureDrift

See the signature above and the guide docs for usage examples.

class SpcDriftMap

Drift map of features

PsiDriftConfig(space: str = '__missing__', name: str = '__missing__', version: str = '0.1.0', alert_config: PsiAlertConfig = PsiAlertConfig(), config_path: Optional[Path] = None, categorical_features: Optional[list[str]] = None, binning_strategy: QuantileBinning | EqualWidthBinning = QuantileBinning(num_bins=10))

Initialize monitor config

class PsiDriftProfile

See the signature above and the guide docs for usage examples.

class PsiDriftMap

Drift map of features

class FeatureMap

See the signature above and the guide docs for usage examples.

CustomMetric(name: str, baseline_value: float, alert_threshold: AlertThreshold, delta: Optional[float] = None)

Initialize a custom metric for alerting.

CustomDriftProfile(config: CustomMetricDriftConfig, metrics: list[CustomMetric])

Initialize a CustomDriftProfile instance.

CustomMetricDriftConfig(space: str = '__missing__', name: str = '__missing__', version: str = '0.1.0', sample_size: int = 25, alert_config: CustomMetricAlertConfig = CustomMetricAlertConfig())

Initialize drift config Args: space: Model space name: Model name version: Model version. Defaults to 0.1.0 sample_size: Sample size alert_config: Custom metric alert configuration

QuantileBinning(num_bins: int = 10)

Initialize the quantile binning strategy.

EqualWidthBinning(method: EqualWidthMethods = Doane())

Initialize the equal-width binning configuration.

Manual(num_bins: int)

Manual equal-width binning strategy.

SquareRoot()

Use the SquareRoot equal-width method.

Sturges()

Use the Sturges equal-width method.

Rice()

Use the Rice equal-width method.

Doane()

Use the Doane equal-width method.

Scott()

Use the Scott equal-width method.

TerrellScott()

Use the Terrell-Scott equal-width method.

FreedmanDiaconis()

Use the Freedman–Diaconis equal-width method.

DataProfiler()

Instantiate DataProfiler class that is used to profile data

class DataProfile

Data profile of features

class ScouterQueue

Main queue class for Scouter. Publishes drift records to the configured transport

class Queue

Individual queue associated with a drift profile

ScouterClient(config: Optional[HttpConfig] = None)

Helper client for interacting with Scouter Server

DatasetClient(transport: Any, table_config: Optional[TableConfig] = None)

Dataset client for reading and querying datasets.

DatasetProducer(table_config: TableConfig, transport: Any, write_config: Optional[WriteConfig] = None)

Real-time streaming producer for the Scouter dataset engine.

TableConfig(model: Type[Any], catalog: str, schema_name: str, table: str, partition_columns: Optional[List[str]] = None)

Configuration for a dataset table, derived from a Pydantic model.

WriteConfig(batch_size: int = 1000, scheduled_delay_secs: int = 30)

Configuration for dataset write behavior.

HttpConfig(server_uri: Optional[str] = None, username: Optional[str] = None, password: Optional[str] = None, auth_token: Optional[str] = None)

HTTP configuration to use with the HTTPProducer.

GrpcConfig(server_uri: Optional[str] = None, username: Optional[str] = None, password: Optional[str] = None, timeout_secs: Optional[int] = None, connect_timeout_secs: Optional[int] = None, keep_alive_interval_secs: Optional[int] = None, keep_alive_timeout_secs: Optional[int] = None, keep_alive_while_idle: Optional[bool] = None)

gRPC configuration to use with the GrpcProducer.

KafkaConfig(username: Optional[str] = None, password: Optional[str] = None, brokers: Optional[str] = None, topic: Optional[str] = None, compression_type: Optional[str] = None, message_timeout_ms: int = 600000, message_max_bytes: int = 2097164, log_level: LogLevel = LogLevel.Info, config: Dict[str, str] = {}, max_retries: int = 3)

Kafka configuration for connecting to and publishing messages to Kafka brokers.

RabbitMQConfig(host: Optional[str] = None, port: Optional[int] = None, username: Optional[str] = None, password: Optional[str] = None, queue: Optional[str] = None, max_retries: int = 3)

RabbitMQ configuration to use with the RabbitMQProducer.

RedisConfig(address: Optional[str] = None, chanel: Optional[str] = None)

Redis configuration to use with a Redis producer

AgentEvalConfig(space: str = '__missing__', name: str = '__missing__', version: str = '0.1.0', sample_ratio: float = 1.0, alert_config: AgentAlertConfig = AgentAlertConfig())

Initialize drift config Args: space: Space to associate with the config name: Name to associate with the config version: Version to associate with the config. Defaults to 0.1.0 sample_ratio: Sample rate percentage for data collection. Must be between 0.0 and 1.0. Defaults to 1.0 (100%). alert_config: Custom metric alert configuration

AgentEvalProfile(tasks: _TASK_TYPES, config: Optional[AgentEvalConfig] = None, alias: Optional[str] = None)

Profile for LLM evaluation and drift detection.

EvalRecord(context: Context, id: Optional[str] = None, session_id: Optional[str] = None, trace_id: Optional[str] = None)

LLM record containing context tied to a Large Language Model interaction that is used to evaluate drift in LLM responses.

LLMJudgeTask(id: str, prompt: Prompt[Any], expected_value: Any, context_path: Optional[str], operator: ComparisonOperator, description: Optional[str] = None, depends_on: Optional[List[str]] = None, max_retries: Optional[int] = None, condition: bool = False)

LLM-powered evaluation task for complex assessments.

AssertionTask(id: str, expected_value: Any, operator: ComparisonOperator, context_path: Optional[str] = None, item_context_path: Optional[str] = None, description: Optional[str] = None, depends_on: Optional[Sequence[str]] = None, condition: bool = False)

Assertion-based evaluation task for LLM monitoring.

class ComparisonOperator

Comparison operators for assertion-based evaluations.

class EvalResults

Defines the results of an LLM eval metric

class TraceAssertion

Assertion target for trace and span properties.

TraceAssertionTask(id: str, assertion: TraceAssertion, expected_value: Any, operator: ComparisonOperator, description: Optional[str] = None, depends_on: Optional[List[str]] = None, condition: bool = False)

Trace-based evaluation task for behavioral assertions.

class SpanStatus

Status codes for trace spans.

class AggregationType

Aggregation operations for span attribute values.

class SpanFilter

Filter for selecting specific spans within a trace.

Feature

No stub docstring was found for this export.

Features(features: List[QueueFeature] | Dict[str, Union[int, float, str]])

Initialize a features class

Metric(name: str, value: float | int)

Initialize metric

Metrics(metrics: List[Metric] | Dict[str, Union[int, float]])

Initialize metrics

class CommonCrons

See the signature above and the guide docs for usage examples.

PsiAlertConfig(dispatch_config: Optional[SlackDispatchConfig | OpsGenieDispatchConfig] = None, schedule: Optional[str | CommonCrons] = None, features_to_monitor: List[str] = [], threshold: Optional[PsiThresholdType] = PsiChiSquareThreshold())

Initialize alert config

SpcAlertConfig(rule: Optional[SpcAlertRule] = None, dispatch_config: Optional[SlackDispatchConfig | OpsGenieDispatchConfig] = None, schedule: Optional[str | CommonCrons] = None, features_to_monitor: List[str] = [])

Initialize alert config

CustomMetricAlertConfig(dispatch_config: Optional[SlackDispatchConfig | OpsGenieDispatchConfig] = None, schedule: Optional[str | CommonCrons] = None)

Initialize alert config

Bifrost(table_config: TableConfig, transport: Any, write_config: Optional[WriteConfig] = None)

Unified read/write client for the Bifrost dataset engine.

ServiceConnectionRecord

No stub docstring was found for this export.

ServiceMapMiddleware

No stub docstring was found for this export.