Skip to main content

What is Structured Output?

Structured Output allows DronaHQ AI Agents to return responses in a predefined JSON schema. By enforcing a structured format, developers can validate agent responses, ensure type safety, and reliably send outputs to workflows, APIs, databases, automations, and business applications.

Common use cases include:

  • Sentiment analysis
  • Appointment booking
  • Lead qualification
  • Conversation summarization
  • Customer support automation
  • Extracting structured data from natural language conversations

Overview

FieldDescription
NameThe unique identifier for the structured output schema.
Linked AgentsThe AI agents assigned to utilize this specific schema for their responses.
Evaluation TypeDictates how the schema is evaluated against the agent's raw output.
UpdatedTimestamp indicating when the schema configuration was last modified.

Add structured output to your agent

You can define your schema using one of two methods:

1. Create from Scratch

Build a completely custom structured output by defining your own schema from the ground up using the supported data types.

Configuration Section

SectionFieldsDescription
SchemaName, Description, Schema Type, InstructionsDefines the JSON structure, data types (Boolean, String, Number, Integer, Array, Object), and extraction rules for the AI response.
Advanced SettingsModel, Temperature, Max TokensConfigures the LLM parameters. Lower temperature values help produce more consistent and predictable structured outputs.
TestTracing Run IDTests the schema against a live or historical execution to preview the generated JSON output.

Schema Fields

When building your custom schema, you must define the following foundational fields:

  1. Name: The unique, system-level identifier for the Structured Output attribute. This name will be used as the JSON key in the final payload object.

  2. Description: A clear text explanation detailing what data this specific field is expected to extract or evaluate. This acts as metadata context for both developers and the AI engine.

  3. Schema Type: The explicit data type that the agent's output must conform to.

    Supported Types:

  • Boolean: Enforces a true/false binary value. Ideal for flags like Success Evaluation or Appointment Booked.
  • String: Enforces text-based outputs. Ideal for Sentiment Detection or text Summarization.
  • Number / Integer: Enforces numerical data values. Ideal for User Ratings or counts.
  • Object: Allows you to nest multiple sub-fields together. Ideal for multi-layered data like Insurance Renewal details.
  • Array: Enforces a structured list of items. Ideal for sequence tracking like an E-Commerce Cart.

2. Use Templates

Accelerate development by selecting from pre-configured industry templates.

Available Templates

TemplateData TypeDescription
User RatingNumber / IntegerRepresents the user's satisfaction level based on conversation tone, sentiment, resolution quality, and overall experience.
Success EvaluationBooleanMeasures interaction success based on expected outcomes (Pass/Fail).
Appointment BookedBooleanTracks successful appointment bookings from customer chat.
Sentiment DetectionStringDetermines the emotional tone (frustration, satisfaction, urgency, politeness). Strictly classified as: Positive, Neutral, or Negative.
SummarizationStringGenerates a concise and clear summary capturing the user's main intent, key details, and final outcome. Must be human-readable.
Insurance RenewalObjectExtracts and structures nested policy details, renewal intent, payment status, and next actions.
E-Commerce CartArrayA structured list tracking product actions inside an e-commerce flow.

Production JSON Output Examples

Below are production-ready JSON output samples generated by the parsing engine following successful schema extraction.

1. Appointment Booked (Boolean Example)

Structure: A simple root-level flag showing a true or false confirmation state.

{
"name": "Appointment Booked",
"result": true
}

2. Insurance Renewal (Complex Object Example)

Structure: A nested dictionary grouping distinct customer, event, and operational priority fields together.

{
"policyholder": {
"name": "Robert Thompson",
"policyNumber": "POL-2026-789456",
"dateOfBirth": "1975-08-22",
"email": "rthompson@example.com"
},
"incident": {
"type": "auto",
"date": "2026-01-10",
"location": {
"street": "Highway 101 North",
"city": "San Jose",
"state": "CA",
"zip": "95110"
},
"description": "Rear-ended at traffic light, other driver at fault"
},
"urgency": "standard"
}

3. E-Commerce Cart (Array Example)

Structure: A JSON array holding standardized object items alongside an isolated shipping metadata block.

{
"items": [
{
"productName": "Wireless Headphones XL",
"quantity": 1,
"size": null,
"color": "Black",
"price": 149.99
},
{
"productName": "USB-C Cable 6ft",
"quantity": 2,
"size": null,
"color": "White",
"price": 19.99
}
],
"shipping": {
"method": "express",
"giftWrap": false
}
}

Frequently Asked Questions(FAQs)

What is Structured Output?

Structured Output lets you define JSON schemas to ensure AI agent responses are predictable, validated, and type-safe.

How can I create a Structured Output schema?

You can either create a custom schema from scratch or use a pre-built template.

What data types are supported in Structured Output?

Supported types are Boolean, String, Number/Integer, Object, and Array.

What is the purpose of the Evaluation Type field?

It determines how the schema is validated against the agent's raw output.

What are templates used for?

Templates provide pre-configured schemas for common use cases like sentiment detection, summarization, user ratings, and appointment booking.