Skip to content

cayu.evals.models

Public Cayu API. Definitions are grouped by their public source module, and definitions from private implementation modules appear on their package’s page; adding a symbol does not move existing links. The import shown at each entry is a supported public namespace. Read the Python API overview and install the required extra.

from cayu.evals import EVAL_SCHEMA_VERSION
EVAL_SCHEMA_VERSION = 11

Release source · Runtime guarantees · Capability guides

from cayu.evals import EvalAssertionResult

Bases: BaseModel.

Defaults below are source expressions; Field(...) includes schema/validation settings and default_factory creates a fresh value. Inherited declarations are included. Constructor behavior follows the model or dataclass shown in the bases/decorators.

Name Type Default
name str required
assertion_revision str | None None
outcome EvalOutcome required
score StrictFloat | None Field(default=None, ge=0.0, le=1.0)
threshold StrictFloat | None Field(default=None, ge=0.0, le=1.0)
message str ''
metadata dict[str, Any] Field(default_factory=dict)
cost_summary SessionCostSummary | None None
EvalAssertionResult.check_outcome_score_consistency() -> EvalAssertionResult
EvalAssertionResult.passed() -> bool

Return the boolean view used by assertion consumers.

EvalAssertionResult.validate_name(value: str, info) -> str
EvalAssertionResult.validate_assertion_revision(value: str | None, info) -> str | None
EvalAssertionResult.validate_message(value: str, info) -> str
EvalAssertionResult.copy_metadata(value)
EvalAssertionResult.copy_cost_summary(value: SessionCostSummary | None) -> SessionCostSummary | None

Release source · Runtime guarantees · Capability guides

from cayu.evals import EvalCaseContractV1

One immutable case revision selected before an eval run starts.

Bases: BaseModel.

Defaults below are source expressions; Field(...) includes schema/validation settings and default_factory creates a fresh value. Inherited declarations are included. Constructor behavior follows the model or dataclass shown in the bases/decorators.

Name Type Default
case_id StrictStr required
case_revision StrictStr required
EvalCaseContractV1.validate_case_id(value: str, info) -> str
EvalCaseContractV1.validate_case_revision(value: str, info) -> str

Release source · Runtime guarantees · Capability guides

from cayu.evals import EvalCaseResult

Bases: BaseModel.

Defaults below are source expressions; Field(...) includes schema/validation settings and default_factory creates a fresh value. Inherited declarations are included. Constructor behavior follows the model or dataclass shown in the bases/decorators.

Name Type Default
case_id str required
status EvalStatus required
authored_session_id str | None None
trials tuple[EvalTrialResult, ...] Field(min_length=1)
trial_policy EvalSuiteTrialPolicyV1 required
score StrictFloat | None Field(default=None, ge=0.0, le=1.0)
assertions tuple[EvalAssertionResult, ...] Field(default_factory=tuple)
error str | None None
unavailable_reason str | None None
started_at datetime required
completed_at datetime required
duration_ms StrictInt Field(default=0, ge=0)
metadata dict[str, Any] Field(default_factory=dict)
EvalCaseResult.from_trials(*, case_id: str, trials: Iterable[EvalTrialResult], authored_session_id: str | None=None, started_at: datetime | None=None, completed_at: datetime | None=None, metadata: dict[str, Any] | None=None, trial_policy: EvalSuiteTrialPolicyV1 | None=None) -> EvalCaseResult
EvalCaseResult.validate_case_id(value: str, info) -> str
EvalCaseResult.validate_session_id(value: str | None, info) -> str | None
EvalCaseResult.normalize_error(value: object) -> str | None
EvalCaseResult.copy_json_data(value, info)
EvalCaseResult.copy_trial_policy(value: object) -> object
EvalCaseResult.validate_aggregate_contract() -> EvalCaseResult

Release source · Runtime guarantees · Capability guides

from cayu.evals import EvalContext

The assertion’s view of a run: the Trajectory under test + case identity.

Where Trajectory is the serializable run record, EvalContext is what an assertion’s evaluate() receives — it exposes the trajectory’s data (session / events / transcript / usage_summary / final_output / probes) plus the suite_id / case_id / metadata, and carries no live app handle (assertions run offline). root_evidence_available is true by default for deliberately synthetic assertion contexts; public replay and fresh-run entry points set it from the durable root session so missing evidence cannot become a conclusive empty observation. It is also the intended home for future dataset expectations (a reference of expected values an assertion compares the trajectory against).

Decorators: @dataclass(frozen=True).

Defaults below are source expressions; Field(...) includes schema/validation settings and default_factory creates a fresh value. Inherited declarations are included. Constructor behavior follows the model or dataclass shown in the bases/decorators.

Name Type Default
trajectory Trajectory required
suite_id str required
case_id str required
metadata dict[str, Any] required
root_evidence_available bool True
EvalContext.session() -> Session | None
EvalContext.events() -> tuple[Event, ...]
EvalContext.transcript() -> tuple[Message, ...]
EvalContext.usage_summary() -> SessionUsageSummary | None
EvalContext.final_output() -> str
EvalContext.probes() -> TrajectoryProbes
EvalContext.probe_session() -> Session | None

Session that owns the unambiguous structural probe projection.

Release source · Runtime guarantees · Capability guides

from cayu.evals import EvalOutcome

One evaluated assertion outcome.

unavailable means the assertion could not obtain complete evidence; error means execution or evaluation failed. Neither has a numeric score.

Bases: StrEnum.

Defaults below are source expressions; Field(...) includes schema/validation settings and default_factory creates a fresh value. Inherited declarations are included. Constructor behavior follows the model or dataclass shown in the bases/decorators.

Name Type Default
PASSED class attribute 'passed'
FAILED class attribute 'failed'
UNAVAILABLE class attribute 'unavailable'
ERROR class attribute 'error'

Release source · Runtime guarantees · Capability guides

from cayu.evals import EvalRun

Bases: BaseModel.

Defaults below are source expressions; Field(...) includes schema/validation settings and default_factory creates a fresh value. Inherited declarations are included. Constructor behavior follows the model or dataclass shown in the bases/decorators.

Name Type Default
schema_version Literal[11] EVAL_SCHEMA_VERSION
run_id str Field(default_factory=lambda: str(uuid4()))
suite_id str required
status EvalStatus required
score StrictFloat | None Field(default=None, ge=0.0, le=1.0)
cases tuple[EvalCaseResult, ...] Field(min_length=1)
started_at datetime Field(default_factory=lambda: datetime.now(UTC))
completed_at datetime Field(default_factory=lambda: datetime.now(UTC))
duration_ms StrictInt Field(default=0, ge=0)
metadata dict[str, Any] Field(default_factory=dict)
run_contract EvalRunContractV1 | EvalRunContractV2 | None None

require_versioned_memory_evidence (method)

Section titled “require_versioned_memory_evidence (method)”
EvalRun.require_versioned_memory_evidence(value: object) -> object

Reject versioned mappings that silently omit required memory evidence.

Standalone Python EvalTrialResult construction retains its explicit typed-unavailable default for extension boundaries. A durable EvalRun mapping has a schema discriminator, so absence there is malformed rather than evidence that may be inferred as missing.

EvalRun.validate_ids(value: str, info) -> str
EvalRun.copy_metadata(value: dict[str, Any]) -> dict[str, Any]
EvalRun.revalidate_run_contract(value)
EvalRun.validate_aggregate_contract() -> EvalRun

Release source · Runtime guarantees · Capability guides

from cayu.evals import EvalRunContractV1

Portable execution contract fixed before a corpus-backed run dispatches.

Bases: BaseModel.

Defaults below are source expressions; Field(...) includes schema/validation settings and default_factory creates a fresh value. Inherited declarations are included. Constructor behavior follows the model or dataclass shown in the bases/decorators.

Name Type Default
schema_version Literal[1] 1
corpus_revision StrictStr required
target_key StrictStr required
suite_id StrictStr required
suite_revision StrictStr required
evidence_policy_revision StrictStr required
pricing_profile_fingerprint StrictStr | None None
trials StrictInt Field(ge=1, le=100)
timeout_seconds StrictInt Field(ge=1, le=3600)
cases tuple[EvalCaseContractV1, ...] Field(min_length=1, max_length=_EVAL_RUN_CONTRACT_MAX_CASES)
EvalRunContractV1.validate_schema_version_type(value: object) -> object
EvalRunContractV1.validate_ids(value: str, info) -> str
EvalRunContractV1.validate_revision(value: str | None, info) -> str | None
EvalRunContractV1.revalidate_cases(value)
EvalRunContractV1.validate_case_contract() -> EvalRunContractV1

Release source · Runtime guarantees · Capability guides

from cayu.evals import EvalRunContractV2

Portable execution contract including the immutable suite trial policy.

Bases: BaseModel.

Defaults below are source expressions; Field(...) includes schema/validation settings and default_factory creates a fresh value. Inherited declarations are included. Constructor behavior follows the model or dataclass shown in the bases/decorators.

Name Type Default
schema_version Literal[2] 2
corpus_revision StrictStr required
target_key StrictStr required
suite_id StrictStr required
suite_revision StrictStr required
evidence_policy_revision StrictStr required
pricing_profile_fingerprint StrictStr | None None
trials StrictInt Field(ge=1, le=100)
timeout_seconds StrictInt Field(ge=1, le=3600)
trial_policy EvalSuiteTrialPolicyV1 required
cases tuple[EvalCaseContractV1, ...] Field(min_length=1, max_length=_EVAL_RUN_CONTRACT_MAX_CASES)
EvalRunContractV2.validate_schema_version_type(value: object) -> object
EvalRunContractV2.validate_ids(value: str, info) -> str
EvalRunContractV2.validate_revision(value: str | None, info) -> str | None
EvalRunContractV2.copy_trial_policy(value: object) -> object
EvalRunContractV2.revalidate_cases(value)
EvalRunContractV2.validate_contract() -> EvalRunContractV2

Release source · Runtime guarantees · Capability guides

from cayu.evals import EvalStatus

Bases: StrEnum.

Defaults below are source expressions; Field(...) includes schema/validation settings and default_factory creates a fresh value. Inherited declarations are included. Constructor behavior follows the model or dataclass shown in the bases/decorators.

Name Type Default
PASSED class attribute 'passed'
FAILED class attribute 'failed'
UNAVAILABLE class attribute 'unavailable'
ERROR class attribute 'error'
SKIPPED class attribute 'skipped'

Release source · Runtime guarantees · Capability guides

from cayu.evals import EvalTrialResult

Lossless result for one concrete, independently executed case trial.

Bases: BaseModel.

Defaults below are source expressions; Field(...) includes schema/validation settings and default_factory creates a fresh value. Inherited declarations are included. Constructor behavior follows the model or dataclass shown in the bases/decorators.

Name Type Default
trial_number StrictInt Field(ge=1)
status EvalStatus required
session_id str | None None
score StrictFloat | None Field(default=None, ge=0.0, le=1.0)
final_output str ''
structured_output dict[str, Any] | None Field(default=None, exclude_if=lambda value: value is None)
assertions tuple[EvalAssertionResult, ...] Field(default_factory=tuple)
error str | None None
unavailable_reason str | None None
operation_outcomes OperationOutcomeSummary | None Field(default=None, exclude_if=lambda value: value is None)
execution_status Literal['completed', 'failed'] | None Field(default=None, exclude_if=lambda value: value is None)
execution_failure_category Literal['provider_failure', 'environment_failure', 'execution_failure'] | None Field(default=None, exclude_if=lambda value: value is None)
failure_evidence FailureEvidence | None Field(default=None, exclude_if=lambda value: value is None)
failure_capture WorkflowFailureCapture | None Field(default=None, exclude_if=lambda value: value is None)
capture_bounds SessionTrajectoryBounds | None Field(default=None, exclude_if=lambda value: value is None)
capture_diagnostic WorkflowCaptureDiagnostic | None Field(default=None, exclude_if=lambda value: value is None)
workflow_attempt WorkflowAttemptAnchor | None Field(default=None, exclude_if=lambda value: value is None)
retained_workflow_output RetainedWorkflowEvalOutput | None Field(default=None, exclude_if=lambda value: value is None, repr=False)
workflow_output_retention Literal['retained', 'disabled', 'limit_exceeded'] | None Field(default=None, exclude_if=lambda value: value is None)
evidence_complete StrictBool False
events_count StrictInt Field(default=0, ge=0)
usage_summary dict[str, Any] | None None
usage_evidence_state Literal['complete', 'partial', 'unavailable'] | None Field(default=None, exclude_if=lambda value: value is None)
memory_attribution EvalMemoryAttributionEvidenceV1 Field(default_factory=lambda: EvalMemoryAttributionEvidenceV1.unavailable(EvalMemoryEvidenceLimitation.MISSING))
started_at datetime required
completed_at datetime required
duration_ms StrictInt Field(default=0, ge=0)
trajectory Trajectory | None Field(default=None, exclude=True, repr=False)
EvalTrialResult.validate_session_id(value: str | None, info) -> str | None
EvalTrialResult.validate_final_output(value: str, info) -> str
EvalTrialResult.copy_structured_output(value)
EvalTrialResult.revalidate_trajectory(value)

revalidate_eval_memory_attribution (method)

Section titled “revalidate_eval_memory_attribution (method)”
EvalTrialResult.revalidate_eval_memory_attribution(value)
EvalTrialResult.normalize_diagnostic(value: object, info) -> str | None
EvalTrialResult.copy_usage_summary(value)
EvalTrialResult.validate_result_contract() -> EvalTrialResult

Release source · Runtime guarantees · Capability guides

from cayu.evals import ProbeRequirements

What an assertion needs captured from the live environment to evaluate offline.

The runner unions these across a case’s assertions and snapshots the result into the Trajectory while the environment is still live, so assertions never touch the app.

Decorators: @dataclass(frozen=True).

Defaults below are source expressions; Field(...) includes schema/validation settings and default_factory creates a fresh value. Inherited declarations are included. Constructor behavior follows the model or dataclass shown in the bases/decorators.

Name Type Default
workspace_paths frozenset[str] frozenset()
workspace_structure_paths frozenset[str] frozenset()
artifact_scopes frozenset[ArtifactScope] frozenset()
artifact_requirements tuple[ArtifactProbeRequirement, ...] ()
ProbeRequirements.merged_with(other: ProbeRequirements) -> ProbeRequirements

Release source · Runtime guarantees · Capability guides

from cayu.evals import Trajectory

The serializable record of one completed run — and the eval assertion substrate.

Composes already-serializable cayu types (events / transcript / usage / session) with a captured probe snapshot and the recursive sub-agent trajectories, so a whole run — its sub-agent tree included — can be persisted, reloaded, and replayed against assertions without a live runtime. It is the single object that flows through the lifecycle: a run produces it (EvalTrialResult.trajectory), write_trajectory_json / load_trajectory move it to and from disk, and evaluate_assertions re-checks it (the replay path). Distinct from EvalContext, which is the assertion’s view of a Trajectory.

Bases: BaseModel.

Defaults below are source expressions; Field(...) includes schema/validation settings and default_factory creates a fresh value. Inherited declarations are included. Constructor behavior follows the model or dataclass shown in the bases/decorators.

Name Type Default
session Session | None None
events tuple[Event, ...] Field(default_factory=tuple)
transcript tuple[Message, ...] Field(default_factory=tuple)
usage_summary SessionUsageSummary | None None
memory_attribution MemoryAttribution | None None
final_output str ''
workflow_output WorkflowEvalOutputEvidenceV1 | None Field(default=None, exclude_if=lambda value: value is None)
probes TrajectoryProbes Field(default_factory=TrajectoryProbes)
children tuple[Trajectory, ...] Field(default_factory=tuple)
children_incomplete StrictBool False
metadata dict[str, Any] Field(default_factory=dict)

initial_input_message_start_index (property)

Section titled “initial_input_message_start_index (property)”
Trajectory.initial_input_message_start_index() -> int | None

Runtime-attested transcript index where fresh-run caller input begins.

Trajectory.initial_input_message_count() -> int | None

Runtime-attested fresh-run input count, absent from serialized trajectories.

Trajectory.initial_input_messages_sha256() -> str | None

Runtime-attested fresh-run input digest, absent from serialized trajectories.

Trajectory.structured_output_requested() -> bool | None

Runtime-attested structured-output mode, absent from serialized trajectories.

Trajectory.input_redactions_applied() -> bool | None

Runtime-attested input-redaction mode, absent from serialized trajectories.

Trajectory.revalidate_session(value)
Trajectory.revalidate_events(value)
Trajectory.revalidate_transcript(value)
Trajectory.revalidate_usage_summary(value)
Trajectory.revalidate_memory_attribution(value)
Trajectory.revalidate_probes(value)
Trajectory.revalidate_children(value)
Trajectory.validate_final_output(value: str, info) -> str
Trajectory.revalidate_workflow_output(value)
Trajectory.copy_metadata(value)
Trajectory.validate_session_attribution() -> Trajectory

Release source · Runtime guarantees · Capability guides

from cayu.evals import TRAJECTORY_SCHEMA_VERSION
TRAJECTORY_SCHEMA_VERSION = 5

Release source · Runtime guarantees · Capability guides

from cayu.evals import TrajectoryProbes

Serializable snapshot of the live-environment data assertions need.

Captured by the runner before the environment is torn down. The *_available flags distinguish “no workspace / artifact store configured” from “configured but the file / artifact is absent”, which the workspace and artifact assertions report differently.

Bases: BaseModel.

Defaults below are source expressions; Field(...) includes schema/validation settings and default_factory creates a fresh value. Inherited declarations are included. Constructor behavior follows the model or dataclass shown in the bases/decorators.

Name Type Default
workspace_available StrictBool False
workspace_files dict[str, bytes | None] Field(default_factory=dict)
workspace_file_stats dict[str, WorkspaceFileProbe] Field(default_factory=dict)
workspace_unavailable_paths tuple[str, ...] Field(default_factory=tuple)
workspace_structures dict[str, WorkspaceStructuralProbe] Field(default_factory=dict, max_length=64)
artifacts_available StrictBool False
artifact_scopes_captured tuple[ArtifactScope, ...] Field(default_factory=tuple)
artifact_scopes_truncated tuple[ArtifactScope, ...] Field(default_factory=tuple)
artifact_scopes_unavailable tuple[ArtifactScope, ...] Field(default_factory=tuple)
artifacts tuple[ArtifactMetadata, ...] Field(default_factory=tuple)
artifact_content_probes tuple[ArtifactContentProbe, ...] Field(default_factory=tuple)

validate_workspace_unavailable_paths (method)

Section titled “validate_workspace_unavailable_paths (method)”
TrajectoryProbes.validate_workspace_unavailable_paths(value) -> tuple[str, ...]
TrajectoryProbes.validate_workspace_file_paths(value)
TrajectoryProbes.validate_artifact_scope_sets(value, info) -> tuple[ArtifactScope, ...]
TrajectoryProbes.revalidate_workspace_file_stats(value)
TrajectoryProbes.revalidate_workspace_structures(value)
TrajectoryProbes.revalidate_artifacts(value)

revalidate_artifact_content_probes (method)

Section titled “revalidate_artifact_content_probes (method)”
TrajectoryProbes.revalidate_artifact_content_probes(value)
TrajectoryProbes.validate_capture_provenance() -> TrajectoryProbes

Release source · Runtime guarantees · Capability guides

from cayu.evals import WORKSPACE_PROBE_MAX_BYTES
WORKSPACE_PROBE_MAX_BYTES = 1 << 20

Release source · Runtime guarantees · Capability guides

from cayu.evals import WorkspaceFileProbe

Stat + integrity record for a probed workspace file.

Companion to TrajectoryProbes.workspace_files (the captured, possibly-truncated bytes): records the file’s true size on disk, whether the captured window was truncated at WORKSPACE_PROBE_MAX_BYTES, and a sha256 of the captured bytes. Direct Python assertions may use that prefix identity; portable structural assertions use WorkspaceStructuralProbe and never expose a truncated prefix digest as whole-file identity.

Bases: BaseModel.

Defaults below are source expressions; Field(...) includes schema/validation settings and default_factory creates a fresh value. Inherited declarations are included. Constructor behavior follows the model or dataclass shown in the bases/decorators.

Name Type Default
total_bytes StrictInt Field(ge=0)
truncated StrictBool False
sha256 str required
WorkspaceFileProbe.validate_sha256(value: str, info) -> str

Release source · Runtime guarantees · Capability guides