Skip to main content

The Problem

You want the agent to return structured data (not free-form text) so your application can parse and act on the result programmatically.

Solution: JSON Schema

Pass a JSON schema to the agent via Spring properties or the fluent API. The agent constrains its output to match the schema.

Via Spring Properties

Via the Fluent API

Provider support varies. JSON schema structured output is currently supported by the Claude provider. Codex and Gemini may return free-form text even when a schema is configured. Check the provider-specific reference pages for current support.

Provider-Specific Details

ProviderStructured OutputConfiguration
ClaudeJSON Schema via json-schema propertyClaude Reference
CodexNot currently supported—
GeminiNot currently supported—