NEWS 9 min read

Bedrock Claude Can Stop Broken JSON—But It Cannot Stop Hallucinations

AWS now constrains Claude outputs to JSON schemas and strict tool inputs during generation. That removes parsing failures, not factual errors or unsafe business decisions.

By EgoistAI ·
Bedrock Claude Can Stop Broken JSON—But It Cannot Stop Hallucinations

Amazon Bedrock can now force Anthropic Claude responses to match a JSON schema during generation. The feature eliminates a common class of production failures: malformed JSON, missing required fields, wrong field types and invalid tool parameters.

It does not guarantee that the values inside the valid structure are true. A model can return a perfectly formed customer record with the wrong account status, or call a tool with syntactically valid but operationally dangerous arguments. Structured outputs make the container reliable; they do not make the judgment reliable.

That boundary is the most important fact in AWS’s announcement. The feature is valuable precisely because it solves a narrow, expensive problem. Teams should adopt it without confusing schema compliance with factual accuracy.

What Bedrock now guarantees

AWS says structured outputs are available for all Anthropic Claude models on Amazon Bedrock where those models are offered. They work through the bedrock-runtime and bedrock-mantle endpoints.

Developers can use two mechanisms. JSON Schema output format constrains the response structure, while strict tool use constrains tool-call parameters to a declared schema. Required fields must appear, field types are enforced, enums remain within allowed values, and undeclared properties can be rejected.

The constraint happens during decoding. Bedrock compiles the schema into a grammar and prevents the model from producing tokens that would violate it. This differs from asking for JSON in a prompt and repairing the output afterward.

For applications, that means fewer parsing exceptions and fewer retries caused solely by invalid formatting. It can also reduce output tokens because the model is restricted to the requested fields instead of surrounding the result with explanations.

How the compilation and cache work

When Bedrock receives a new schema, it validates the definition against its supported subset of JSON Schema Draft 2020-12. It then compiles a grammar artifact used during generation.

The first request may take longer because of that compilation step. AWS says compiled grammars are cached for 24 hours within the customer’s account, so later requests using the same schema should have minimal additional overhead.

Changing the schema’s structure invalidates the cache and triggers compilation again. Changing only names or descriptions does not. Teams with dynamically generated schemas should account for first-request latency and avoid unnecessary structural variation.

The failures it removes

Structured output is particularly useful for extraction, classification and tool orchestration.

An invoice pipeline can require vendor, amount, currency and due date fields. A support classifier can restrict priority to a fixed enum. An agent can call a weather or database tool only with the parameters that tool accepts.

Without constrained decoding, developers often build a repair loop: parse the text, detect an error, ask the model to fix it and retry. That loop adds latency, cost and another opportunity for inconsistent behavior. Bedrock can remove much of that plumbing when the failure is structural.

Strict tool schemas also reduce accidental interface errors in multi-step agents. If a tool expects a location string and a unit enum, Claude cannot invent an extra property or use an unsupported value when strict enforcement is enabled.

The failures it does not remove

Schema validation cannot verify whether extracted facts match the source. A required date field can contain the wrong date. A sentiment enum can be valid but misclassified. A tool call can satisfy every type rule while targeting the wrong customer record.

Business rules often exceed JSON Schema. A refund amount may be numeric and positive yet exceed the user’s authorization. A transfer destination may be a valid string but belong to an untrusted account. A medical code may match the expected pattern while being unsupported by the clinical note.

The model can also omit nuance by placing a complex situation into an allowed category. Constrained decoding narrows the output space; it does not supply missing evidence or improve the model’s underlying knowledge.

Developers must therefore keep source-grounding checks, permission enforcement, business validation and human approval for consequential actions.

A production design that uses the feature correctly

Use structured outputs as one layer in a larger reliability system.

Define the smallest schema the downstream task needs. Reject additional properties. Use enums for closed sets and explicit required fields. Keep descriptions clear, but do not rely on descriptions as security policy.

After generation, validate business rules separately. Confirm identifiers against trusted systems, check numerical ranges, enforce user permissions and require human approval for irreversible actions. Log the source context, model version, schema version and tool result so failures can be audited.

For extraction, attach evidence spans or source references to important fields. For agents, separate read-only tools from state-changing tools and use narrower credentials for each action.

Finally, monitor semantic error rates even if JSON parsing errors fall to zero. A dashboard that celebrates perfect schema compliance while ignoring wrong values measures the wrong thing.

Verdict

AWS has removed a frustrating source of production instability for Claude users on Bedrock. Generating schema-compliant JSON and strict tool inputs at decoding time is more reliable than prompt instructions and repair loops.

The feature should make extraction pipelines and agents simpler, faster and cheaper. It should not change the fundamental trust model. Valid structure is necessary for automation, but factual grounding, authorization and human accountability remain separate engineering problems.

Bedrock Claude can now stop broken JSON. It still cannot stop a well-formatted hallucination from reaching your application unless the rest of the system is designed to catch it.

Share this article

> Want more like this?

Get the best AI insights delivered weekly.

By subscribing, you agree to our Privacy Policy. You can unsubscribe at any time.

> Related Articles