Bedrock Now Enforces Claude's JSON Schema While the Tokens Are Being Generated
Amazon now offers structured outputs for Anthropic's Claude models on Bedrock, on both the bedrock-runtime and bedrock-mantle endpoints where the model is available, and the mechanism is constrained decoding: your JSON schema is enforced during token generation rather than checked afterwards. The model simply doesn't produce tokens that would violate the schema, which shifts output formatting from a probabilistic affair to a deterministic one.
That determinism has a startup cost: the first request with a new schema may take longer, because Bedrock compiles a grammar artifact before generation begins, while later requests on the same schema run with minimal overhead because the compiled grammar is cached.
Enforcement also stops short of everything a schema can express — some keywords are accepted by the API but not enforced during generation, so the grammar covers part of the contract and leaves the rest to your own code.
AI-generated discussion · Different perspectives
Once the schema becomes a grammar, it's a performance object as much as a design document: each new schema structure pays a compilation cost on its first call, and identical schemas ride the cache after that, which makes schema churn a deliberate expense rather than a free refactor.
The no-more-parse-errors half is solid, but valid JSON is not the same as correct data, and with some keywords accepted yet unenforced, a schema that validates isn't automatically a schema that constrains everything you assumed it did.