Close Menu
    Main Menu
    • Home
    • News
    • Tech
    • Robotics
    • ML & Research
    • AI
    • Digital Transformation
    • AI Ethics & Regulation
    • Thought Leadership in AI

    Subscribe to Updates

    Get the latest creative news from FooBar about art, design and business.

    What's Hot

    Pricing Breakdown and Core Characteristic Overview

    March 12, 2026

    65% of Organisations Nonetheless Detect Unauthorised Shadow AI Regardless of Visibility Optimism

    March 12, 2026

    Nvidia's new open weights Nemotron 3 tremendous combines three totally different architectures to beat gpt-oss and Qwen in throughput

    March 12, 2026
    Facebook X (Twitter) Instagram
    UK Tech InsiderUK Tech Insider
    Facebook X (Twitter) Instagram
    UK Tech InsiderUK Tech Insider
    Home»Machine Learning & Research»Structured outputs on Amazon Bedrock: Schema-compliant AI responses
    Machine Learning & Research

    Structured outputs on Amazon Bedrock: Schema-compliant AI responses

    Oliver ChambersBy Oliver ChambersFebruary 7, 2026No Comments10 Mins Read
    Facebook Twitter Pinterest Telegram LinkedIn Tumblr Email Reddit
    Structured outputs on Amazon Bedrock: Schema-compliant AI responses
    Share
    Facebook Twitter LinkedIn Pinterest Email Copy Link


    Immediately, we’re saying structured outputs on Amazon Bedrock—a functionality that essentially transforms how one can get hold of validated JSON responses from basis fashions via constrained decoding for schema compliance.

    This represents a paradigm shift in AI software growth. As a substitute of validating JSON responses and writing fallback logic for after they fail, you’ll be able to transfer straight to constructing with the info. With structured outputs, you’ll be able to construct zero-validation knowledge pipelines that belief mannequin outputs, dependable agentic programs that confidently name exterior capabilities, and simplified software architectures with out retry logic.

    On this submit, we discover the challenges of conventional JSON technology and the way structured outputs solves them. We cowl the 2 core mechanisms—JSON Schema output format and strict device use—together with implementation particulars, greatest practices, and sensible code examples. Whether or not you’re constructing knowledge extraction pipelines, agentic workflows, or AI-powered APIs, you’ll learn to use structured outputs to create dependable, production-ready purposes. Our companion Jupyter pocket book gives hands-on examples for each function coated right here.

    The issue with conventional JSON technology

    For years, getting structured knowledge from language fashions meant crafting detailed prompts, hoping for one of the best, and constructing elaborate error-handling programs. Even with cautious prompting, builders routinely encounter:

    • Parsing failures: Invalid JSON syntax that breaks json.masses() calls
    • Lacking fields: Required knowledge factors absent from responses
    • Sort mismatches: Strings the place integers are anticipated, breaking downstream processing
    • Schema violations: Responses that technically parse however don’t match your knowledge mannequin

    In manufacturing programs, these failures compound. A single malformed response can cascade via your pipeline, requiring retries that improve latency and prices. For agentic workflows the place fashions name instruments, invalid parameters can break operate calls fully.

    Take into account a reserving system requiring passengers: int. With out schema enforcement, the mannequin may return passengers: "two" or passengers: "2"—syntactically legitimate JSON, however semantically unsuitable in your operate signature.

    What modifications with structured outputs

    Structured outputs on Amazon Bedrock isn’t incremental enchancment—it’s a elementary shift from probabilistic to deterministic output formatting. By constrained decoding, Amazon Bedrock constrains mannequin responses to evolve to your specified JSON schema. Two complementary mechanisms can be found:

    Characteristic Function Use case
    JSON Schema output format Management the mannequin’s response format Information extraction, report technology, API responses
    Strict device use Validate device parameters Agentic workflows, operate calling, multi-step automation

    These options can be utilized independently or collectively, supplying you with exact management over each what the mannequin outputs and the way it calls your capabilities.

    What structured outputs delivers:

    • All the time legitimate: No extra JSON.parse() errors or parsing exceptions
    • Sort protected: Subject sorts are enforced and required fields are at all times current
    • Dependable: No retries wanted for schema violations
    • Manufacturing prepared: Deploy with confidence at enterprise scale

    How structured outputs works

    Structured outputs makes use of constrained sampling with compiled grammar artifacts. Right here’s what occurs once you make a request:

    1. Schema validation: Amazon Bedrock validates your JSON schema towards the supported JSON Schema Draft 2020-12 subset
    2. Grammar compilation: For brand new schemas, Amazon Bedrock compiles a grammar (first request may take longer)
    3. Caching: Compiled grammars are cached for twenty-four hours, making subsequent requests sooner
    4. Constrained technology: The mannequin generates tokens that produce legitimate JSON matching your schema

    Efficiency concerns:

    • First request latency: Preliminary compilation may add latency to new schemas
    • Cached efficiency: Subsequent requests with an identical schemas have minimal overhead
    • Cache scope: Grammars are cached per account for twenty-four hours from first entry

    Altering the JSON schema construction or a device’s enter schema invalidates the cache, however altering solely identify or description fields doesn’t.

    Getting began with structured outputs

    The next instance demonstrates structured outputs with the Converse API:

    import boto3
    import json
    # Initialize the Bedrock Runtime consumer
    bedrock_runtime = boto3.consumer(
        service_name="bedrock-runtime",
        region_name="us-east-1"  # Select your most well-liked area
    )
    # Outline your JSON schema
    extraction_schema = {
        "kind": "object",
        "properties": {
            "identify": {"kind": "string", "description": "Buyer identify"},
            "e-mail": {"kind": "string", "description": "Buyer e-mail tackle"},
            "plan_interest": {"kind": "string", "description": "Product plan of curiosity"},
            "demo_requested": {"kind": "boolean", "description": "Whether or not a demo was requested"}
        },
        "required": ["name", "email", "plan_interest", "demo_requested"],
        "additionalProperties": False
    }
    # Make the request with structured outputs
    response = bedrock_runtime.converse(
        modelId="us.anthropic.claude-opus-4-5-20251101-v1:0",
        messages=[
            {
                "role": "user",
                "content": [
                    {
                        "text": "Extract the key information from this email: John Smith (john@example.com) is interested in our Enterprise plan and wants to schedule a demo for next Tuesday at 2pm."
                    }
                ]
            }
        ],
        inferenceConfig={
            "maxTokens": 1024
        },
        outputConfig={
            "textFormat": {
                "kind": "json_schema",
                "construction": {
                    "jsonSchema": {
                        "schema": json.dumps(extraction_schema),
                        "identify": "lead_extraction",
                        "description": "Extract lead info from buyer emails"
                    }
                }
            }
        }
    )
    # Parse the schema-compliant JSON response
    consequence = json.masses(response["output"]["message"]["content"][0]["text"])
    print(json.dumps(consequence, indent=2))

    Output:

    {
      "identify": "John Smith",
      "e-mail": "john@instance.com",
      "plan_interest": "Enterprise",
      "demo_requested": true
    }

    The response conforms to your schema—no extra validation required.

    Necessities and greatest practices

    To make use of structured outputs successfully, observe these tips:

    • Set additionalProperties: false on all objects. That is required for structured outputs to work. With out it, your schema received’t be accepted.
    {
      "kind": "object",
      "properties": {
        "identify": {"kind": "string"}
      },
      "required": ["name"],
      "additionalProperties": false
    }

    • Use descriptive discipline names and descriptions. Fashions use property names and descriptions to know what knowledge to extract. Clear names like customer_email outperform generic names like field1.
    • Use enum for constrained values. When a discipline has a restricted set of legitimate values, use enum to constrain choices. This improves accuracy and produces legitimate values.
    • Begin fundamental, then add complexity. Start with the minimal required fields and add complexity incrementally. Primary schemas compile sooner and are simpler to keep up.
    • Reuse schemas to learn from caching. Construction your software to reuse schemas throughout requests. The 24-hour grammar cache considerably improves efficiency for repeated queries.
    • Test stopReason in each response. Two eventualities can produce non-conforming responses: refusals (when the mannequin declines for security causes) and token limits (when max_tokens is reached earlier than finishing). Deal with each circumstances in your code.
    • Take a look at with reasonable knowledge earlier than deployment. Validate your schemas towards production-representative inputs. Edge circumstances in actual knowledge usually reveal schema design points.

    Supported JSON Schema options:

    • All fundamental sorts: object, array, string, integer, quantity, boolean, null
    • enum (strings, numbers, bools, or nulls solely)
    • const, anyOf, allOf (with limitations)
    • $ref, $def, and definitions (inside references solely)
    • String codecs: date-time, time, date, period, e-mail, hostname, uri, ipv4, ipv6, uuid
    • Array minItems (solely values 0 and 1)

    Not supported:

    • Recursive schemas
    • Exterior $ref references
    • Numerical constraints (minimal, most, multipleOf)
    • String constraints (minLength, maxLength)
    • additionalProperties set to something apart from false

    Strict device use for agentic workflows

    When constructing purposes the place fashions name instruments, set strict: true in your device definition to constrain device parameters to match your enter schema precisely:

    import boto3
    import json
    bedrock_runtime = boto3.consumer('bedrock-runtime', region_name="us-east-1")
    response = bedrock_runtime.converse(
        modelId="us.anthropic.claude-opus-4-5-20251101-v1:0",
        messages=[
            {
                "role": "user",
                "content": [{"text": "What's the weather like in San Francisco?"}]
            }
        ],
        inferenceConfig={"maxTokens": 1024},
        toolConfig={
            "instruments": [
                {
                    "toolSpec": {
                        "name": "get_weather",
                        "description": "Get the current weather for a specified location",
                        "strict": True,  # Enable strict mode
                        "inputSchema": {
                            "json": {
                                "type": "object",
                                "properties": {
                                    "location": {
                                        "type": "string",
                                        "description": "The city and state, e.g., San Francisco, CA"
                                    },
                                    "unit": {
                                        "type": "string",
                                        "enum": ["celsius", "fahrenheit"],
                                        "description": "Temperature unit"
                                    }
                                },
                                "required": ["location", "unit"],
                                "additionalProperties": False
                            }
                        }
                    }
                }
            ]
        }
    )
    # Device inputs conform to the schema
    for content_block in response["output"]["message"]["content"]:
        if "toolUse" in content_block:
            tool_input = content_block["toolUse"]["input"]
            print(f"Device: {content_block['toolUse']['name']}")
            print(f"Enter: {json.dumps(tool_input, indent=2)}")

    With strict: true, structured outputs constrains the output in order that:

    • The location discipline is at all times a string
    • The unit discipline is at all times both celsius or fahrenheit
    • No sudden fields seem within the enter

    Sensible purposes throughout industries

    The pocket book demonstrates use circumstances that span industries:

    • Monetary companies: Extract structured knowledge from earnings studies, mortgage purposes, and compliance paperwork. With structured outputs, each required discipline is current and accurately typed for downstream processing.
    • Healthcare: Parse medical notes into structured, schema-compliant information. Extract affected person info, diagnoses, and therapy plans into validated JSON for EHR integration.
    • Ecommerce: Construct dependable product catalog enrichment pipelines. Extract specs, classes, and attributes from product descriptions with constant, dependable outcomes.
    • Authorized: Analyze contracts and extract key phrases, events, dates, and obligations into structured codecs appropriate for contract administration programs.
    • Customer support: Construct clever ticket routing and response programs the place extracted intents, sentiments, and entities match your software’s knowledge mannequin.

    Selecting the best strategy

    Our testing revealed clear patterns for when to make use of every function:

    Use JSON Schema output format when:

    • You want the mannequin’s response in a selected construction
    • Constructing knowledge extraction pipelines
    • Producing API-ready responses
    • Creating structured studies or summaries

    Use strict device use when:

    • Constructing agentic programs that decision exterior capabilities
    • Implementing multi-step workflows with device chains
    • Requiring validated parameter sorts for operate calls
    • Connecting AI to databases, APIs, or exterior companies

    Use each collectively when:

    • Constructing advanced brokers that want validated device calls and structured last responses
    • Creating programs the place intermediate device outcomes feed into structured outputs
    • Implementing enterprise workflows requiring end-to-end schema compliance

    API comparability: Converse in comparison with InvokeModel

    Each the Converse API and InvokeModel API assist structured outputs, with barely completely different parameter codecs:

    Facet Converse API InvokeModel (Anthropic Claude) InvokeModel (open-weight fashions)
    Schema location outputConfig.textFormat output_config.format response_format
    Device strict flag toolSpec.strict instruments[].strict instruments[].operate.strict
    Schema format JSON string in jsonSchema.schema JSON object in schema JSON object in json_schema.schema
    Finest for Conversational workflows Single-turn inference (Claude) Single-turn inference (open-weight)

    Notice: The InvokeModel API makes use of completely different request discipline names relying on the mannequin kind. For Anthropic Claude fashions, use output_config.format for JSON schema outputs. For open-weight fashions, use response_format as a substitute.

    Select the Converse API for multi-turn conversations and the InvokeModel API once you want direct mannequin entry with provider-specific request codecs.

    Supported fashions and availability

    Structured outputs is mostly out there in all business AWS Areas for choose Amazon Bedrock mannequin suppliers:

    • Anthropic
    • DeepSeek
    • Google
    • MiniMax
    • Mistral AI
    • Moonshot AI
    • NVIDIA
    • OpenAI
    • Qwen

    The function works seamlessly with:

    • Cross-Area inference: Use structured outputs throughout AWS Areas with out extra setup
    • Batch inference: Course of massive volumes with schema-compliant outputs
    • Streaming: Stream structured responses with ConverseStream or InvokeModelWithResponseStream

    Conclusion

    On this submit, you found how structured outputs on Amazon Bedrock cut back the uncertainty of AI-generated JSON via validated, schema-compliant responses. By utilizing JSON Schema output format and strict device use, you’ll be able to construct dependable knowledge extraction pipelines, strong agentic workflows, and production-ready AI purposes—with out customized parsing or validation logic.Whether or not you’re extracting knowledge from paperwork, constructing clever automation, or creating AI-powered APIs, structured outputs ship the reliability your purposes demand.

    Structured outputs is now typically out there on Amazon Bedrock. To make use of structured outputs with the Converse APIs, replace to the newest AWS SDK. To study extra, see the Amazon Bedrock documentation and discover our pattern pocket book.

    What workflows might validated, schema-compliant JSON unlock in your group? The pocket book gives every little thing it’s good to discover out.


    In regards to the authors

    Jeffrey Zeng

    Jeffrey Zeng is a Worldwide Specialist Options Architect for Generative AI at AWS, main third-party fashions on Amazon Bedrock. He focuses on agentic coding and workflows, with hands-on expertise serving to prospects construct and deploy AI options from proof-of-concept to manufacturing.

    Jonathan Evans

    Jonathan Evans is a Worldwide Options Architect for Generative AI at AWS, the place he helps prospects leverage cutting-edge AI applied sciences with Anthropic Claude fashions on Amazon Bedrock, to resolve advanced enterprise challenges. With a background in AI/ML engineering and hands-on expertise supporting machine studying workflows within the cloud, Jonathan is keen about making superior AI accessible and impactful for organizations of all sizes.

    Share. Facebook Twitter Pinterest LinkedIn Tumblr Email
    Oliver Chambers
    • Website

    Related Posts

    We ran 16 AI Fashions on 9,000+ Actual Paperwork. Here is What We Discovered.

    March 12, 2026

    Quick Paths and Sluggish Paths – O’Reilly

    March 11, 2026

    Speed up customized LLM deployment: Effective-tune with Oumi and deploy to Amazon Bedrock

    March 11, 2026
    Top Posts

    Evaluating the Finest AI Video Mills for Social Media

    April 18, 2025

    Utilizing AI To Repair The Innovation Drawback: The Three Step Resolution

    April 18, 2025

    Midjourney V7: Quicker, smarter, extra reasonable

    April 18, 2025

    Meta resumes AI coaching utilizing EU person knowledge

    April 18, 2025
    Don't Miss

    Pricing Breakdown and Core Characteristic Overview

    By Amelia Harper JonesMarch 12, 2026

    When utilized to informal discuss, scenario-based roleplay, or extra specific dialogue, Chatto AI Story and…

    65% of Organisations Nonetheless Detect Unauthorised Shadow AI Regardless of Visibility Optimism

    March 12, 2026

    Nvidia's new open weights Nemotron 3 tremendous combines three totally different architectures to beat gpt-oss and Qwen in throughput

    March 12, 2026

    How To Change A Company Tradition With Kate Johnson, CEO of Lumen Applied sciences

    March 12, 2026
    Stay In Touch
    • Facebook
    • Twitter
    • Pinterest
    • Instagram
    • YouTube
    • Vimeo

    Subscribe to Updates

    Get the latest creative news from SmartMag about art & design.

    UK Tech Insider
    Facebook X (Twitter) Instagram
    • About Us
    • Contact Us
    • Privacy Policy
    • Terms Of Service
    • Our Authors
    © 2026 UK Tech Insider. All rights reserved by UK Tech Insider.

    Type above and press Enter to search. Press Esc to cancel.