WithResponseFormat — the model returns parseable structured data, not free-form markdown.
Source: examples/agent_with_json_response/
What it demonstrates
interfaces.ResponseFormatwithResponseFormatJSONandJSONSchema- Parsing
result.Contentas JSON afterRun - Schema enforcement across tool rounds
Run
Fromexamples/:
Key code
Define the schema once at agent construction:Expected output
result.Content is always parseable with json.Unmarshal.
Learn more
Response Format
Schema design and parsing
Token Usage
Usage on structured runs