{"slug": "structured-outputs-for-anthropic-claude-models-on-amazon-bedrock", "title": "Structured outputs for Anthropic Claude models on Amazon Bedrock", "summary": "Amazon Bedrock now supports structured outputs for all Anthropic Claude models on both the bedrock-runtime and bedrock-mantle endpoints, enforcing a supplied JSON schema during token generation through constrained decoding rather than post-processing. Amazon Web Services said the feature validates schemas against a supported JSON Schema Draft 2020-12 subset, compiles a grammar artifact on the first request, and caches compiled grammars per account for 24 hours; it also covers strict tool use for validating tool parameters in agentic workflows. The capability works with batch inference and, on bedrock-runtime, cross-Region inference, and AWS said constraining responses to schema-defined fields reduces output token counts and can lower inference costs for high-volume workloads.", "body_md": "## [Artificial Intelligence](https://aws.amazon.com/blogs/machine-learning/)\n\n# Structured outputs for Anthropic Claude models on Amazon Bedrock\n\nAmazon Bedrock now supports structured outputs for all Anthropic Claude models, on both the bedrock-runtime and bedrock-mantle endpoints, where the model is available.\n\nWhether you call Claude through Boto3 and the bedrock-runtime APIs or through the Messages API and the bedrock-mantle endpoint, you can now receive schema-compliant JSON responses that conform to a defined structure. You no longer need custom parsing, retry logic, or post-processing.\n\n## Practical applications\n\nWith structured outputs for Claude on Amazon Bedrock, you can automate reliable, schema-compliant tasks across industries. Examples include extracting every required field from financial earnings reports and compliance documents, parsing clinical notes into Electronic Health Records (EHR), and enriching product catalogs with consistent, validated results. You can also analyze contracts for key terms, parties, and obligations, or power intelligent support ticket routing where intents, sentiments, and entities always match your application’s data model.\n\n## What changes with structured outputs on Amazon Bedrock\n\nStructured outputs use constrained decoding to enforce your JSON schema during token generation, not after the fact. The model doesn’t produce tokens that would violate your schema. This changes output formatting from probabilistic to deterministic.\n\nTwo complementary mechanisms are now available on both Amazon Bedrock endpoints:\n\n| **Feature** | **Purpose** | **Use case** | \n| JSON Schema output format | Control the model’s response structure | Data extraction, report generation, API responses | \n| Strict tool use | Validate tool parameters against schemas | Agentic workflows, function calling, multi-step automation | \n\n## What this means for you\n\nEach response is a valid JSON, so you no longer encounter `JSON.parse()` errors or parsing exceptions. Responses are also type safe: field types are enforced, and required fields are always present. Because outputs always conform to your schema, you don’t need retries to handle schema violations, making your integration more reliable. Structured outputs also constrains responses to only the fields your schema defines, which reduces output token count and can lower inference costs for high-volume workloads. These properties make structured outputs production ready, so you can deploy at scale without additional schema-validation code.\n\n## Supported models and availability\n\nStructured outputs works with [batch inference](https://docs.aws.amazon.com/bedrock/latest/userguide/batch-inference.html), so you can process large volumes of requests asynchronously while still receiving schema-compliant outputs. On the bedrock-runtime endpoint, it also works with cross-Region inference, so you can use it across AWS Regions without additional setup. If you need responses in real time, you can stream structured responses as typed events.\n\n## How it works\n\nWhen you make a request with a JSON schema, here’s what happens behind the scenes:\n\n1. **Schema validation –** Amazon Bedrock validates your JSON schema against the supported JSON Schema Draft 2020-12 subset.\n2. **Grammar compilation –** For new schemas, Amazon Bedrock compiles a grammar artifact (the first request might take slightly longer).\n3. **Caching –** Compiled grammars are cached for 24 hours, making subsequent requests faster.\n4. **Constrained generation –** The model generates tokens that produce valid JSON matching your schema.\n\n## Performance considerations\n\nFor performance, the first request with a new schema might take longer because Amazon Bedrock compiles a grammar artifact before generation begins. After that initial compilation, subsequent requests using the same schema run with minimal overhead because the compiled grammar is cached. This cache is scoped to your account and lasts for 24 hours from first access. Changing the structure of your JSON schema invalidates the cache and triggers a fresh compilation, while changing only the name or description fields leaves the cached grammar intact.\n\n## Getting started: Structured outputs with the InvokeModel API (bedrock-runtime)\n\nThe InvokeModel API takes the Anthropic-native request body, so the schema goes in `output_config.format` as a JSON object rather than a JSON string. The following example shows how to extract the structured lead data from a customer email using boto3 with an Anthropic Claude model:\n\nPython\n\nJSON\n\nThe response conforms to your schema. No additional validation is required.\n\nFor additional API usage examples, including the Messages API, see the accompanying [sample notebook](https://github.com/aws-samples/anthropic-on-aws/blob/main/notebooks/structured_outputs/structured-outputs-on-bedrock.ipynb).\n\n## Strict tool use for agentic workflows\n\n[Amazon Bedrock Mantle](https://docs.aws.amazon.com/bedrock/latest/userguide/endpoints.html) is designed for agentic applications with server-side tools, background inference, and stateful conversations. With strict tool use on the bedrock-mantle endpoint, you can now guarantee that tool parameters match your input schema exactly. The following example shows how to define a tool with strict schema enforcement:\n\nSetting `strict: true` constrains the model’s tool input to match your schema exactly. The location field is always a string, and the unit field is always either celsius or fahrenheit. The model can’t add fields outside your schema, so the tool input contains only what your schema specifies.\n\nThis 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.\n\n## Top use cases for Claude structured outputs\n\nStructured outputs reduce error-handling complexity the most in three common patterns:\n\n- **Data extraction:** Extract fields from invoices, contracts, email, and transcripts into JSON that always matches your schema, ready to load into databases or customer relationship management (CRM) systems.\n- **Reliable agent tool calls:** Validate tool arguments against their schemas at generation time, so multi-step agent workflows run without failures from malformed input.\n- **Classification at scale:** Classify tickets, leads, or content by intent, priority, and sentiment for routing, moderation, and evaluation.\n\nClaude Haiku 5.5 reliably handles quick and repetitive workloads such as summaries, compactions, database queries, and classification requests. The following example shows how to classify and route incoming data using the Invoke API and Haiku 5.5:\n\n## Requirements and best practices\n\nTo use structured outputs effectively on Amazon Bedrock, follow these guidelines:\n\n1. **Set additionalProperties: false on all objects** : This is required for structured outputs to work. Without it, your schema won’t be accepted.\n2. **Use descriptive field names and descriptions** : Models use property names and descriptions to understand what data to extract. Clear names like`customer_email` outperform generic names like`field1` .\n3. **Use enum for constrained values** : When a field has a limited set of valid values, use`enum` to constrain options.\n4. **Start basic, then add complexity** : Begin with the minimum required fields and add complexity incrementally. Basic schemas compile faster, are easier to debug, and keep your request payload lean because the schema counts toward the Converse API payload size.\n5. **Reuse schemas to benefit from caching** : Structure your application to reuse schemas across requests. The 24-hour grammar cache improves performance for repeated queries.\n6. **Check the stop reason in every response** : Two scenarios can produce non-conforming responses: refusals (when the model declines for safety reasons) and token limits (when`max_tokens` is reached before completing). Handle both cases in your code.\n7. **Test with realistic data before deployment** : Validate your schemas against production-representative inputs. Edge cases in real data often reveal schema design issues.\n\nFor additional best practices and schema design recommendations, see [Structured outputs](https://docs.aws.amazon.com/bedrock/latest/userguide/structured-output.html) in the Amazon Bedrock User Guide.\n\n## Supported JSON Schema features\n\n1. All basic types: `object` ,`array` ,`string` ,`integer` ,`number` ,`boolean` ,`null` .\n2. `enum` (strings, numbers, booleans, or nulls only).\n3. `const` ,`anyOf` ,`allOf` (with limitations).\n4. `$ref` ,`$def` , and`definitions` (internal references only).\n5. String formats: `date-time` ,`time` ,`date` ,`duration` ,`email` ,`hostname` ,`uri` ,`ipv4` ,`ipv6` ,`uuid` .\n6. Array `minItems` (only values 0 and 1).\n\n### Not supported\n\nThese keywords are accepted by the API but are not enforced during generation. A request that includes them returns a successful response, and the model can still return values that violate them. Validate these constraints in your application rather than relying on the schema to enforce them.\n\n1. Recursive schemas.\n2. External `$ref` references.\n3. Numerical constraints (`minimum` ,`maximum` ,`multipleOf` ).\n4. String constraints (`minLength` ,`maxLength` ).\n5. `additionalProperties` set to anything other than false.\n\n## Conclusion\n\nStructured outputs for Anthropic Claude models on Amazon Bedrock provides the reliability that production AI applications require. It is available now on both the bedrock-runtime and bedrock-mantle endpoints. By combining JSON Schema output format and strict tool use, you can build data pipelines that need no additional validation. You can also create reliable agentic workflows and production AI applications without custom parsing or retry logic.\n\nStructured outputs for Claude on Amazon Bedrock is now generally available. To learn more, see the [Amazon Bedrock documentation](https://docs.aws.amazon.com/bedrock/) and explore our [sample notebook](https://github.com/aws-samples/anthropic-on-aws/blob/main/notebooks/structured_outputs/structured-outputs-on-bedrock.ipynb).\n\nWhat workflows could validated, schema-compliant JSON improve in your organization? Share your feedback and questions in the comments.", "url": "https://wpnews.pro/news/structured-outputs-for-anthropic-claude-models-on-amazon-bedrock", "canonical_source": "https://aws.amazon.com/blogs/machine-learning/structured-outputs-for-anthropic-claude-models-on-amazon-bedrock/", "published_at": "2026-10-19 23:32:19+00:00", "updated_at": "2026-10-20 15:49:29.574605+00:00", "lang": "en", "topics": ["artificial-intelligence", "large-language-models", "ai-agents", "structured-data", "ai-infrastructure"], "entities": ["Amazon Bedrock", "Anthropic", "Claude", "Amazon Web Services", "bedrock-runtime", "bedrock-mantle", "JSON Schema Draft 2020-12", "Boto3"], "also_reported_by": [], "alternates": {"html": "https://wpnews.pro/news/structured-outputs-for-anthropic-claude-models-on-amazon-bedrock", "markdown": "https://wpnews.pro/news/structured-outputs-for-anthropic-claude-models-on-amazon-bedrock.md", "text": "https://wpnews.pro/news/structured-outputs-for-anthropic-claude-models-on-amazon-bedrock.txt", "jsonld": "https://wpnews.pro/news/structured-outputs-for-anthropic-claude-models-on-amazon-bedrock.jsonld"}}