cleandataengineering.aiAgent Harness, drawn simply
You are here: Tech stack › L6 · I/O contracts

Agent Harness Tutorial · Tech stack

L6 · I/O contracts

Typed inputs and outputs at every edge. Family: Act · one turn, in order.

AZURE OPTIONSAPIM schema validation◐ planned: chosen, not in the deployed policyOUR CHOICEPydantic modelsfrozen, everywherejsonschematool argumentsMCP structured outputOPEN-SOURCE OPTIONSPydantic✓ usedJSON Schema✓ usedWHO DOES THE WORKAzure gives 10% · we code once 50% · each agent team still does 40%
Dark boxes are what we run. Solid boxes are used or planned; dashed boxes were considered or dropped (crossed). The bar: grey is what Azure gives, dark is what we code once, hatched is what each agent team writes.
Why our choiceOur contract library gives a typed run record and typed tool schemas everywhere; Pydantic is already the base of the stack.
OptionWhere fromVerdictWhy
Pydantic modelsours✓ chosenfrozen, everywhere
jsonschemaours✓ chosentool arguments
MCP structured outputours✓ chosen
APIM schema validationAzure◐ plannedchosen, not in the deployed policy
Pydanticopen source✓ used
JSON Schemaopen source✓ used

How it works inside the harness: Read the answer.

Compared: How are inputs, outputs and records typed?

Pydantic (frozen …open sourcechosenjsonschemaopen sourcechosendataclasses + jso…open sourcenot chosenattrs (+ cattrs)open sourcenot evaluatedmsgspecopen sourcenot evaluatedAPIM schema valid…Azureat the edge
Dark: what we chose. Crossed and dashed: rejected or not for us. Added here (not a Series table).
OptionFromVerdictValidationJSON Schema for toolsImmutabilityStatus
Pydantic (frozen models)open sourcechosenfull, with clear errorsyes: Field descriptionsyes: frozen=Truebuilt: every contract
jsonschemaopen sourcechosenvalidates against a schemauses the tool's scheman/abuilt: tool arguments
dataclasses + jsonschemaopen sourcenot chosennone built in; via jsonschemaby handyes: frozen=Truenot chosen
attrs (+ cattrs)open sourcenot evaluatedvalidators you writeno built-inyes: frozennot evaluated
msgspecopen sourcenot evaluatedtyped decoding, very fastyesyes: frozen Structsnot evaluated
APIM schema validationAzureat the edgeat the gatewayuses API scheman/adesign: 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)."""