The platform for continuously improving AI agents.
from typing import Literal
from uuid import UUID
from pydantic import Field, field_validator
from agent_runtime.contracts import Contract
from overbae.core.errors import InputValidationError
from overbae.core.model_registry import decision_models
MAX_EVALUATION_PARTICIPANTS = 8
class Participant(Contract):
key: str = Field(
pattern=r"^[a-z][a-z0-9-]{0,47}$", json_schema_extra={"not": {"const": "prepare"}}
)
name: str = Field(min_length=1, max_length=255)
kind: Literal["foundation", "trained", "external"]
model: str | None = Field(
default=None,
description="With kind=external, an OpenRouter model id from the benchmark catalogue.",
)
job: UUID | None = Field(
default=None,
description=(
"Saved training job in this project. With kind=trained, evaluates its retained "
"trained checkpoint; with kind=foundation, evaluates that job's unchanged base "
"model. Model identity comes from the job, not a similar catalogue model. "
"The job base is not necessarily a parent-initialized trial's initial checkpoint."
),
)
served_model: str | None = None
@field_validator("key")
@classmethod
def available_key(cls, value):
if value == "prepare":
raise ValueError("The participant key prepare is reserved for provider preparation")
return value
class PromptParticipant(Participant):
instructions: str = Field(default="", max_length=8000)
class InferenceSettings(Contract):
context_length: int = Field(default=8192, ge=128, le=131072, strict=True)
batch_size: int = Field(default=64, ge=1, le=256, strict=True)
padded_tokens: int = Field(default=32768, ge=128, le=262144, strict=True)
concurrency: int = Field(default=8, ge=1, le=16, strict=True)
def require_selectable(participants):
"""A comparison a person or agent assembles draws on OpenRouter and this project's training
runs. The training catalogue is not a source; a job's own base is measured by qualification."""
native_slugs = {model.slug for model in decision_models()}
if any(
participant.get("kind") == "foundation"
or participant.get("kind") == "external"
and participant.get("model") in native_slugs
for participant in participants
):
raise InputValidationError(
"A benchmark compares OpenRouter models (kind=external) and trained jobs "
"(kind=trained); training catalogue models are not participants"
)