Agent Harness Tutorial · Tech stack
L6 · I/O contracts
Typed inputs and outputs at every edge. Family: Act · one turn, in order.
Why our choiceOur contract library gives a typed run record and typed tool schemas everywhere; Pydantic is already the base of the stack.
| Option | Where from | Verdict | Why |
|---|---|---|---|
| Pydantic models | ours | ✓ chosen | frozen, everywhere |
| jsonschema | ours | ✓ chosen | tool arguments |
| MCP structured output | ours | ✓ chosen | |
| APIM schema validation | Azure | ◐ planned | chosen, not in the deployed policy |
| Pydantic | open source | ✓ used | |
| JSON Schema | open source | ✓ used |
How it works inside the harness: Read the answer.
Compared: How are inputs, outputs and records typed?
| Option | From | Verdict | Validation | JSON Schema for tools | Immutability | Status |
|---|---|---|---|---|---|---|
| Pydantic (frozen models) | open source | chosen | full, with clear errors | yes: Field descriptions | yes: frozen=True | built: every contract |
| jsonschema | open source | chosen | validates against a schema | uses the tool's schema | n/a | built: tool arguments |
| dataclasses + jsonschema | open source | not chosen | none built in; via jsonschema | by hand | yes: frozen=True | not chosen |
| attrs (+ cattrs) | open source | not evaluated | validators you write | no built-in | yes: frozen | not evaluated |
| msgspec | open source | not evaluated | typed decoding, very fast | yes | yes: frozen Structs | not evaluated |
| APIM schema validation | Azure | at the edge | at the gateway | uses API schema | n/a | design: edge check |
DecisionEvery contract is a frozen Pydantic model, which also generates the tool schemas the model sees, and jsonschema validates tool arguments before any call. msgspec would be worth a look only if decoding speed ever mattered.
How it is done: the real code
Cut from the live repositories each time the site is built, so it always matches what runs.
class ModelRequest(BaseModel):
model_config = ConfigDict(frozen=True)
messages: tuple[Message, ...]
tools: tuple[dict[str, object], ...] = ()
max_tokens: int = 4096
temperature: float | None = None
"""None takes the client's configured temperature, which is zero by default:
determinism is the floor, variance is opted into. A number is this call's
own. It was `0.0` meaning *unset*, so asking for zero under a non-zero
configuration was read as not asking (F-064)."""