> ## Documentation Index
> Fetch the complete documentation index at: https://docs.sketricgen.ai/llms.txt
> Use this file to discover all available pages before exploring further.

# Structured Inputs & Outputs

> Define typed JSON schemas for agent inputs and outputs in SketricGen — ensure predictable data flow, strict validation, and reliable multi-agent handoffs.

## Why Structure?

Structured data makes multi-agent workflows predictable, renderable, and testable.

In SketricGen, you can define schemas directly in a **form-based UI**—no coding required.

Each agent’s Structured Input and Structured Output are automatically converted into a **backend schema** (Pydantic/JSON Schema style).

These schemas are used during **handoffs**, **agent calls**, and **validations**, ensuring that every agent in your workflow exchanges data in a consistent, typed format.

Configure Input Schema and Output Schema in the agent node inspector: open the agent, expand **Advanced Mode**, and use the **Structured Data** section.

<img src="https://mintcdn.com/sketricgen/ctpt8wcI3kfPhZOQ/images/core-concepts/core_structured_data_ui.png?fit=max&auto=format&n=ctpt8wcI3kfPhZOQ&q=85&s=c11ffa43907a09e128047ff9675805f0" alt="Edit Agent modal showing Advanced Mode with Structured Data — Input Schema and Output Schema Configure buttons" width="1282" height="1558" data-path="images/core-concepts/core_structured_data_ui.png" />

## Structured Input

A **Structured Input** defines what data an agent expects before it starts reasoning.

**When it applies:** Structured input is used when the **calling agent** needs to follow a specific schema when it provides input to this agent. That schema is what you define as this agent’s Input Schema. The calling agent is only required to follow this schema when it is **calling this agent** (e.g. as a tool or via handoff). It is not required when some other agent is called, or when the agent decides to return a response directly to the user.

It acts as a contract for parent/calling agents: when they invoke this agent, they must supply all required fields defined in this agent’s Input Schema.

### Creating a Structured Input

1. Open the agent node in the AgentSpace (Edit Agent).
2. Expand **Advanced Mode** and find **Structured Data**.
3. Next to **Input Schema**, click **Configure**.
4. (Optional) Add a **Schema Name** to help identify this structure.
5. Click **+ Add Field** and configure the following:
   * **Field Name** — e.g., `customer_name`, `intent`, `priority`.
   * **Type** — choose from *String*, *Integer*, *Float*, or *Boolean*.
   * **Description** — acts as both a UI tooltip and a guidance note for the agent (e.g., “The name of the customer requesting support”).
   * **Default Value** — optional, used if no value is supplied by the caller.
   * **Required** — check if the field must be supplied.
6. Click **Update** (or **Save Changes**) to confirm.

**Guideline:**

Structured Inputs are most useful on *child agents*, where they communicate clearly what information the parent agent or trigger node must provide before a handoff occurs.

## Structured Output

A **Structured Output** defines the exact JSON format an agent produces once its reasoning is complete.

**When it applies:** Structured output is used so the agent **always returns the defined schema**, no matter whether a handoff agent or a human receives the response. Once you configure an Output Schema, the agent’s response is forced into that structure for every exit path (handoff to another agent or final reply to the user).

This ensures predictable data handling between connected agents and external integrations, especially when publishing results to APIs or widgets.

### Creating a Structured Output

1. Open the same agent node (Edit Agent).
2. Under **Advanced Mode** → **Structured Data**, next to **Output Schema**, click **Configure**.
3. In the **Configure Structured Output (JSON)** modal, add fields (Schema Name, then **+ Add Field**) as for Structured Input:
   * Name
   * Type (String, Integer, Float, Boolean)
   * Description (e.g., “Summarized report text returned by this agent.”)
   * Default Value (optional), **Required** checkbox.
4. Click **Update** to save the schema.

**What happens behind the scenes**

* SketricGen generates a **typed schema** for the agent in JSON Schema format.
* On **handoff**, the parent agent must provide all Structured Input fields required by the child.
* Validation is **strict**: if the schema is not satisfied, the backend throws an error and the agent retries until it produces schema-valid output. Failed validations are also visible in the **Trace Explorer** for debugging.
* Descriptions are surfaced both in the UI and model prompt context, improving model interpretability.

## Best Practices

* Use defined **Structured Inputs** for downstream agents—this prevents data mismatch during orchestration.
* Use **Structured Outputs** primarily on **final responder** agents that return data to users or APIs.
* **Be careful when using Structured outputs** in intermediate agents as the model will always respond in JSON, so its not very human/customer facing friendly. Use this for final agents or agents-as-tools.
* Keep field names simple and lowercase, separated by underscores.
* Use short, human-readable descriptions; they also serve as hints for model behavior.
* When modifying a schema, re-test the workflow to ensure all upstream connections still match.
* Avoid unnecessary fields; smaller, well-defined schemas improve agent performance and clarity.

## Example

**Structured Output (Lina Triage Agent):**

```json theme={null}
{
	"topic": "Pricing",
	"question": "What are the pricing options for Resumes Ranker?"
}
```

**Structured Output (Alex Agent):**

```json theme={null}
{
	"query": "What are the pricing options for Resumes Ranker?",
	"resolved": true
}
```

<img src="https://mintcdn.com/sketricgen/ctpt8wcI3kfPhZOQ/images/core-concepts/core_structure_data_setup.png?fit=max&auto=format&n=ctpt8wcI3kfPhZOQ&q=85&s=ec796e5207d358024977f8c0d79a9737" alt="Configure Structured Output (JSON) modal with schema name, fields, types, and Add Field button" width="2244" height="1558" data-path="images/core-concepts/core_structure_data_setup.png" />
