Skip to main content
Define a Pydantic contract once. Harnest applies it to agents, tools, JSON, SSE, WebSockets, SubAgents, and session messages.

Choose a content type

Media constraints can limit MIME type, decoded byte size, dimensions, pixels, duration, pages, frame rate, sample rate, channels, animation, and archive expansion.

Define the contract

Keep shared contracts in the root models/ directory. Use Annotated to keep limits beside the field they protect.
models/vision.py
Harnest inspects decoded bytes. Client-supplied metadata does not bypass the contract.

Apply the contract

agent.py
Client-tool stubs execute on the client. Harnest validates the submitted result before the waiting agent or SubAgent resumes.

Send transient media

Without a storage annotation, media is available only to the current model turn.
1

Harnest validates the bytes

The Pydantic field limits are applied to inspected content.
2

The adapter builds the model request

ADK or LangGraph receives the media only for the immediate provider call. This includes mid-turn tool results inside SubAgents.
3

Harnest clears the private lease

Success clears the bytes. A provider retry can reuse them before that point.

Store and retrieve media

Return durable references or make media replayable.

Build client tools

Resume an agent with browser or device data.