Amazon Bedrock has added native support for structured outputs on every Anthropic Claude model, available through the bedrock‑runtime and bedrock‑mantle APIs. Instead of receiving free‑form text that must be parsed and validated after the fact, the service now enforces a JSON schema during token generation, delivering deterministic, schema‑compliant JSON that can be consumed directly by code.
What Changed
Two mechanisms are now exposed on both endpoints:
- JSON Schema output format – callers supply a JSON Schema (Draft 2020‑12 subset) and the model generates only tokens that satisfy that schema.
- Strict tool use – tool parameters are validated against schemas, enabling reliable function‑calling style workflows.
The process works as follows: Bedrock first validates the supplied schema, then compiles a grammar artifact for new schemas, caches that artifact for 24 hours, and finally performs constrained generation that guarantees a valid JSON document.
Why It Matters to Engineers
From an implementation perspective the change eliminates three common pain points:
- Parsing failures – every response is a well‑formed JSON object, so
JSON.parse()errors disappear. - Retry loops – because the model cannot emit out‑of‑schema tokens, you no longer need to retry on schema violations.
- Token waste – the model emits only the fields defined in the schema, reducing token count and potentially lowering inference cost for high‑volume workloads.
The feature works with batch inference, cross‑region runtime calls, and real‑time streaming of typed events, giving teams flexibility in both asynchronous pipelines and low‑latency services.
Architectural and Operational Implications
Integrations now need to provide a JSON Schema object in the request payload (for example, under output_config.format when using InvokeModel). The first request that introduces a new schema incurs extra latency while Bedrock compiles the grammar; subsequent calls benefit from the 24‑hour cache. Changing the shape of the schema invalidates the cache, so teams should treat schema evolution as a versioned artifact and test the impact on latency.
Because the model enforces the schema, downstream code can skip most post‑processing steps, but it should still verify that the schema itself matches the application’s data model. Existing error‑handling paths that look for malformed JSON can be simplified, while new monitoring should focus on schema‑validation failures returned by Bedrock before generation begins.
import boto3, json
REGION = "us-east-1"
client = boto3.client("bedrock-runtime", region_name=REGION)
schema = {
"type": "object",
"properties": {
"name": {"type": "string", "description": "Customer name"},
"email": {"type": "string", "description": "Customer email address"},
"plan_interest": {"type": "string", "description": "Product plan of interest"},
"demo_requested": {"type": "boolean", "description": "Whether a demo was requested"}
},
"required": ["name", "email", "plan_interest", "demo_requested"],
"additionalProperties": False
}
# payload would include schema under output_config.format
Security and Reliability Considerations
Schema enforcement reduces the surface for malformed data that could trigger downstream exceptions, but the responsibility for defining a correct schema remains with the developer. Only the subset of JSON Schema Draft 2020‑12 documented by Bedrock is accepted; using unsupported keywords will cause validation errors before generation. Teams should treat the schema as part of the contract with the model and store it in version‑controlled repositories.
Related CloudNinjas coverage: AWS.
What This Means For Practitioners
- Update API calls to include a JSON Schema under
output_config.formatfor Claude models. - Design schemas as stable artifacts; treat changes as version bumps to avoid unexpected cache invalidation latency.
- Remove or simplify post‑generation parsing and retry logic that handled free‑form text.
- Leverage batch inference or streaming endpoints to match workload patterns without additional transformation steps.
- Monitor Bedrock’s schema‑validation responses and cache‑hit metrics to understand latency impacts.


