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.
Package modules
Section titled “Package modules”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.
Top-level exports
Section titled “Top-level exports”Drift and profiling
Section titled “Drift and profiling”Drifter
Section titled “Drifter”Drifter()Instantiate Rust Drifter class that is used to create monitoring profiles and compute drifts.
SpcDriftConfig
Section titled “SpcDriftConfig”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
SpcDriftProfile
Section titled “SpcDriftProfile”class SpcDriftProfileSee the signature above and the guide docs for usage examples.
SpcFeatureDriftProfile
Section titled “SpcFeatureDriftProfile”class SpcFeatureDriftProfileSee the signature above and the guide docs for usage examples.
SpcFeatureDrift
Section titled “SpcFeatureDrift”class SpcFeatureDriftSee the signature above and the guide docs for usage examples.
SpcDriftMap
Section titled “SpcDriftMap”class SpcDriftMapDrift map of features
PsiDriftConfig
Section titled “PsiDriftConfig”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
PsiDriftProfile
Section titled “PsiDriftProfile”class PsiDriftProfileSee the signature above and the guide docs for usage examples.
PsiDriftMap
Section titled “PsiDriftMap”class PsiDriftMapDrift map of features
FeatureMap
Section titled “FeatureMap”class FeatureMapSee the signature above and the guide docs for usage examples.
CustomMetric
Section titled “CustomMetric”CustomMetric(name: str, baseline_value: float, alert_threshold: AlertThreshold, delta: Optional[float] = None)Initialize a custom metric for alerting.
CustomDriftProfile
Section titled “CustomDriftProfile”CustomDriftProfile(config: CustomMetricDriftConfig, metrics: list[CustomMetric])Initialize a CustomDriftProfile instance.
CustomMetricDriftConfig
Section titled “CustomMetricDriftConfig”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
Section titled “QuantileBinning”QuantileBinning(num_bins: int = 10)Initialize the quantile binning strategy.
EqualWidthBinning
Section titled “EqualWidthBinning”EqualWidthBinning(method: EqualWidthMethods = Doane())Initialize the equal-width binning configuration.
Manual
Section titled “Manual”Manual(num_bins: int)Manual equal-width binning strategy.
SquareRoot
Section titled “SquareRoot”SquareRoot()Use the SquareRoot equal-width method.
Sturges
Section titled “Sturges”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
Section titled “TerrellScott”TerrellScott()Use the Terrell-Scott equal-width method.
FreedmanDiaconis
Section titled “FreedmanDiaconis”FreedmanDiaconis()Use the Freedman–Diaconis equal-width method.
DataProfiler
Section titled “DataProfiler”DataProfiler()Instantiate DataProfiler class that is used to profile data
DataProfile
Section titled “DataProfile”class DataProfileData profile of features
Queue and transport
Section titled “Queue and transport”ScouterQueue
Section titled “ScouterQueue”class ScouterQueueMain queue class for Scouter. Publishes drift records to the configured transport
class QueueIndividual queue associated with a drift profile
ScouterClient
Section titled “ScouterClient”ScouterClient(config: Optional[HttpConfig] = None)Helper client for interacting with Scouter Server
DatasetClient
Section titled “DatasetClient”DatasetClient(transport: Any, table_config: Optional[TableConfig] = None)Dataset client for reading and querying datasets.
DatasetProducer
Section titled “DatasetProducer”DatasetProducer(table_config: TableConfig, transport: Any, write_config: Optional[WriteConfig] = None)Real-time streaming producer for the Scouter dataset engine.
TableConfig
Section titled “TableConfig”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
Section titled “WriteConfig”WriteConfig(batch_size: int = 1000, scheduled_delay_secs: int = 30)Configuration for dataset write behavior.
HttpConfig
Section titled “HttpConfig”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
Section titled “GrpcConfig”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
Section titled “KafkaConfig”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
Section titled “RabbitMQConfig”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
Section titled “RedisConfig”RedisConfig(address: Optional[str] = None, chanel: Optional[str] = None)Redis configuration to use with a Redis producer
Evaluation
Section titled “Evaluation”AgentEvalConfig
Section titled “AgentEvalConfig”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
Section titled “AgentEvalProfile”AgentEvalProfile(tasks: _TASK_TYPES, config: Optional[AgentEvalConfig] = None, alias: Optional[str] = None)Profile for LLM evaluation and drift detection.
EvalRecord
Section titled “EvalRecord”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
Section titled “LLMJudgeTask”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
Section titled “AssertionTask”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.
ComparisonOperator
Section titled “ComparisonOperator”class ComparisonOperatorComparison operators for assertion-based evaluations.
EvalResults
Section titled “EvalResults”class EvalResultsDefines the results of an LLM eval metric
TraceAssertion
Section titled “TraceAssertion”class TraceAssertionAssertion target for trace and span properties.
TraceAssertionTask
Section titled “TraceAssertionTask”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.
SpanStatus
Section titled “SpanStatus”class SpanStatusStatus codes for trace spans.
AggregationType
Section titled “AggregationType”class AggregationTypeAggregation operations for span attribute values.
SpanFilter
Section titled “SpanFilter”class SpanFilterFilter for selecting specific spans within a trace.
Shared types and scheduling
Section titled “Shared types and scheduling”Feature
Section titled “Feature”FeatureNo stub docstring was found for this export.
Features
Section titled “Features”Features(features: List[QueueFeature] | Dict[str, Union[int, float, str]])Initialize a features class
Metric
Section titled “Metric”Metric(name: str, value: float | int)Initialize metric
Metrics
Section titled “Metrics”Metrics(metrics: List[Metric] | Dict[str, Union[int, float]])Initialize metrics
CommonCrons
Section titled “CommonCrons”class CommonCronsSee the signature above and the guide docs for usage examples.
PsiAlertConfig
Section titled “PsiAlertConfig”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
Section titled “SpcAlertConfig”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
Section titled “CustomMetricAlertConfig”CustomMetricAlertConfig(dispatch_config: Optional[SlackDispatchConfig | OpsGenieDispatchConfig] = None, schedule: Optional[str | CommonCrons] = None)Initialize alert config
Bifrost
Section titled “Bifrost”Bifrost(table_config: TableConfig, transport: Any, write_config: Optional[WriteConfig] = None)Unified read/write client for the Bifrost dataset engine.
Service map
Section titled “Service map”ServiceConnectionRecord
Section titled “ServiceConnectionRecord”ServiceConnectionRecordNo stub docstring was found for this export.
ServiceMapMiddleware
Section titled “ServiceMapMiddleware”ServiceMapMiddlewareNo stub docstring was found for this export.