mechaharness.core.contract

OpenAPI-shaped request/response models for the non-DI surface.

CLI, HTTP, and mechaharness.factory.run share these types so callers who do not use pyiv still go through one serializable contract.

class mechaharness.core.contract.RunRequest(*, prompt: str, backend: str | None = None, family: str | None = None, model: str | None = None, api_key: str | None = None, base_url: str | None = None, system_prompt: str | None = None, max_turns: int = 8, temperature: float | None = None)[source]

Bases: BaseModel

OpenAPI-shaped input for mechaharness.factory.run / CLI / HTTP.

String fields map onto Settings when present; omitted fields keep environment defaults.

api_key: str | None
backend: str | None
base_url: str | None
family: str | None
max_turns: int
model: str | None
model_config = {}

Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].

prompt: str
system_prompt: str | None
temperature: float | None
class mechaharness.core.contract.RunResponse(*, final_text: str | None, turns: int, messages: list[dict[str, ~typing.Any]], events: list[dict[str, ~typing.Any]] = <factory>)[source]

Bases: BaseModel

Serializable result of a harness run (messages and events as JSON dicts).

events: list[dict[str, Any]]
final_text: str | None
messages: list[dict[str, Any]]
model_config = {}

Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].

turns: int