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 rootmodels/ directory. Use Annotated to keep limits beside the field they protect.
models/vision.py
Apply the contract
- Agent input and output
- Server tool output
- Client tool output
agent.py
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.