Structured outputs are available for Anthropic Claude models on Amazon Bedrock.
Bedrock Claude outputs are schema-valid JSON, cutting parsing, retries, and validation while supporting agentic workflows, batch, streaming and cache.
Key Takeaways
- Structured outputs are now available for all Anthropic Claude models on Amazon Bedrock through both bedrock-runtime and bedrock-mantle endpoints, enabling schema-compliant JSON responses.
- The feature uses constrained decoding to enforce JSON schemas during generation, making outputs deterministic, type-safe, and more reliable while reducing parsing, retries, and post-processing.
- It supports two key mechanisms: JSON Schema output format for data extraction and API-style responses, and strict tool use for agentic workflows, function calling, and multi-step automation.
- Structured outputs work with batch inference, cross-Region inference, and streaming; schemas are validated against JSON Schema Draft 2020-12, and compiled grammars are cached for 24 hours for better performance.
Meta description: Amazon Bedrock now supports schema-compliant JSON outputs for all Anthropic Claude models across bedrock-runtime and bedrock-mantle endpoints.
Tags: Amazon Bedrock, Anthropic Claude, structured outputs, JSON schema, agentic workflows
Featured image: abstract friendly illustration style, no real people, no logos, no text
Amazon Bedrock structured outputs are now available for all Anthropic Claude models on both the bedrock-runtime and bedrock-mantle endpoints, where the model is available. Developers calling Claude through Boto3 and the bedrock-runtime APIs, or through the Messages API and the bedrock-mantle endpoint, can now receive schema-compliant JSON responses that conform to a defined structure. That means custom parsing, retry logic, and post-processing can be removed from many Claude integrations.
The capability is aimed at tasks that need repeatable machine-readable results across industries. Examples include extracting every required field from financial earnings reports and compliance documents, parsing clinical notes into Electronic Health Records, and enriching product catalogs with consistent, validated results. It can also analyze contracts for key terms, parties, and obligations, or power intelligent support ticket routing where intents, sentiments, and entities always match an application data model.
How the feature changes output reliability
Structured outputs use constrained decoding to enforce a JSON schema during token generation rather than checking the result after generation. The model does not produce tokens that would violate the schema, which moves output formatting from probabilistic to deterministic.
Two complementary mechanisms are available on both Amazon Bedrock endpoints. The JSON Schema output format controls the model response structure and is useful for data extraction, report generation, and API responses. Strict tool use validates tool parameters against schemas and is aimed at agentic workflows, function calling, and multi-step automation.
For developers, each response is valid JSON, so JSON.parse errors and parsing exceptions are no longer expected. Responses are type safe because field types are enforced and required fields are always present. Because outputs conform to the schema, retries are not needed to handle schema violations, making integrations more reliable. The feature also constrains responses to only the fields defined by the schema, reducing output token count and potentially lowering inference costs for high-volume workloads. This makes structured outputs production ready, allowing deployment at scale without additional schema-validation code.
Availability, caching, and performance
Structured outputs work with batch inference, so large volumes of requests can be processed asynchronously while still returning schema-compliant outputs. On the bedrock-runtime endpoint, the feature also works with cross-Region inference, allowing use across AWS Regions without additional setup. For real-time applications, structured responses can be streamed as typed events.
When a request includes a JSON schema, Amazon Bedrock validates it against the supported JSON Schema Draft 2020-12 subset. For new schemas, Amazon Bedrock compiles a grammar artifact, so the first request may take slightly longer. Compiled grammars are cached for 24 hours, making subsequent requests faster. During constrained generation, the model produces tokens that form valid JSON matching the schema.
The performance cache is scoped to the account and lasts for 24 hours from first access. Changing the structure of a JSON schema invalidates the cache and triggers a fresh compilation. Changing only the name or description fields leaves the cached grammar intact.
InvokeModel example on bedrock-runtime
The InvokeModel API takes the Anthropic-native request body. In that request, the schema belongs in output_config.format as a JSON object, not as a JSON string, and the format uses type json_schema with the schema object.
The example uses Boto3 in the us-east-1 Region with a client for the bedrock-runtime service. It defines a schema for lead data with four required fields: name as a string described as Customer name, email as a string described as Customer email address, plan_interest as a string described as Product plan of interest, and demo_requested as a boolean described as Whether a demo was requested. It sets additionalProperties to false.
The request uses modelId global.anthropic.claude-sonnet-5-5, anthropic_version bedrock-2023-05-31, and max_tokens 512. The user message says: Paulo Santos ([email protected]) is interested in our Enterprise plan and wants to schedule a demo for next Tuesday at 2pm.
The response JSON contains name Paulo Santos, email [email protected], plan_interest Enterprise, and demo_requested true. The code checks stop_reason before parsing. If stop_reason is end_turn, it reads the text block and parses it. If stop_reason is max_tokens, the response is truncated and max_tokens should be increased and retried. The response conforms to the schema, so no additional validation is required. Additional API usage examples, including the Messages API, are available in the accompanying sample notebook.
Strict tool use on bedrock-mantle
Amazon Bedrock Mantle is designed for agentic applications with server-side tools, background inference, and stateful conversations. With strict tool use on the bedrock-mantle endpoint, tool parameters can be guaranteed to match an input schema exactly.
The example creates an AnthropicBedrockMantle client in us-east-1 and calls model anthropic.claude-sonnet-5 with max_tokens 512. The user asks: What's the weather like in San Francisco? It defines a get_weather tool with strict set to true. The tool description is Get the current weather for a specified location. The input_schema requires location and unit, sets additionalProperties to false, and describes location as a string for The city and state, e.g., San Francisco, CA. It restricts unit to celsius or fahrenheit and describes it as Temperature unit.
Setting strict to true constrains tool input to match the schema exactly. The location field is always a string, and the unit field is always either celsius or fahrenheit. The model cannot add fields outside the schema, so the tool input contains only what the schema specifies. This is especially valuable for agentic use cases on Amazon Bedrock Mantle, where models orchestrate multi-step workflows with server-side tools like web search and code interpreter.
Use cases and schema practices
Structured outputs reduce error-handling complexity most in three common patterns. Data extraction pulls fields from invoices, contracts, email, and transcripts into JSON that always matches the schema, ready to load into databases or customer relationship management systems. Reliable agent tool calls validate tool arguments against their schemas at generation time, so multi-step agent workflows run without failures from malformed input. Classification at scale classifies tickets, leads, or content by intent, priority, and sentiment for routing, moderation, and evaluation.
Claude Haiku 5.5 reliably handles quick and repetitive workloads such as summaries, compactions, database queries, and classification requests. The classification example uses the Invoke API and modelId global.anthropic.claude-haiku-5-5 in us-east-1 with anthropic_version bedrock-2023-05-31 and max_tokens 512. The system prompt says: You are a support ticket classifier. Classify the ticket accurately. The ticket text says: Our production API calls have been failing with 500 errors since this morning. We're losing orders every minute. This is the second outage this month!
The classification schema uses enums to restrict output to fixed labels. Category can be billing, technical, account, sales, or other and represents the primary ticket category. Priority can be low, medium, high, or urgent and represents urgency based on business impact. Sentiment can be positive, neutral, or negative and represents customer sentiment. Escalate is a boolean indicating whether a human should review immediately, and reason is a string containing a one-sentence justification. additionalProperties is false. The example checks stop_reason, parses the text block, prints the result, and routes tickets when escalate is true by printing Escalating to on-call with the category and priority. If stop_reason is max_tokens, the response is truncated and max_tokens should be increased and retried.
For effective use, set additionalProperties to false on all objects; this is required for structured outputs to work, and without it the schema will not be accepted. Use descriptive field names and descriptions because models use property names and descriptions to understand what data to extract; clear names like customer_email outperform generic names like field1. Use enum for fields with a limited set of valid values. Start with the minimum required fields and add complexity incrementally because basic schemas compile faster, are easier to debug, and keep request payloads lean since the schema counts toward the Converse API payload size. Reusing schemas also helps benefit from caching.

Comments (0)