Skip to content

Schemas

Configuration and data models. ProjectConfig is the root of apab.yaml; the result models define the shapes tools return.

apab.core.schemas

Pydantic schemas for APAB configuration and data models.

ObservabilitySpec

Bases: BaseModel

OpenTelemetry tracing configuration.

Requires the observability extra (pip install "apab[observability]"). With the extra missing or enabled false, tracing is a no-op.

Source code in src/apab/core/schemas.py
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
class ObservabilitySpec(BaseModel):
    """OpenTelemetry tracing configuration.

    Requires the ``observability`` extra (``pip install "apab[observability]"``).
    With the extra missing or ``enabled`` false, tracing is a no-op.
    """

    enabled: bool = False
    service_name: str = "apab"
    # Print spans to stdout (ConsoleSpanExporter).
    console_exporter: bool = False
    # OTLP HTTP endpoint, e.g. "http://localhost:4318". Falls back to the
    # OTEL_EXPORTER_OTLP_ENDPOINT env var when unset.
    otlp_endpoint: str | None = None
    # Write one JSON object per span to <run_dir>/trace.jsonl.
    trace_jsonl: bool = True
    # Redaction level for captured tool args/results in span attributes.
    # None inherits llm.redaction_mode.
    capture_mode: RedactionMode | None = None
    # Install APAB's tracer provider as the OTel global provider. Off by
    # default so embedding applications keep control of the global.
    set_global: bool = False

MeasurementProvenance

Bases: BaseModel

Provenance sidecar for measured datasets (docs/measurement-contract.md).

Loaded from the <name>.meta.yaml file next to a measured dataset. Free-text fields are deliberately prose; synthetic marks generated data and must propagate into any report built from it.

Source code in src/apab/core/schemas.py
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
class MeasurementProvenance(BaseModel):
    """Provenance sidecar for measured datasets (docs/measurement-contract.md).

    Loaded from the ``<name>.meta.yaml`` file next to a measured dataset.
    Free-text fields are deliberately prose; ``synthetic`` marks generated
    data and must propagate into any report built from it.
    """

    model_config = ConfigDict(extra="allow")

    instrument: str
    date: str
    calibration_state: str
    uncertainty: str
    operator: str
    synthetic: bool