A Structured Output call does not automatically pause the run or end the agent’s turn. If your application needs the call to be the final action of the turn, state that in the tool and agent instructions. Use Human Input when the agent must wait for a person’s answer.
Configure the tool
In Agent Build:- Add Structured Output from the advanced tools section.
- Give it a short title that describes the event, such as
Render recommendations. - Describe exactly when the agent should call it and what the receiving application will do with the payload.
- Add at least one output field and mark every field your application requires.
- Connect the tool to the agent that should emit it, save, and test the run.
data.name deterministically from the title and node ID. When building template JSON programmatically, use the current SketricGen template builder instead of inventing this value.
Use Structured Output for application UI events
An application UI event is a use case of Structured Output, not a separate platform tool. Define fields that tell the receiving frontend what to render or do, then detect the normal Structured Output tool-call event in your application. For example, a recommendation workflow can emit component data for cards, while another workflow can emit an event name and the state required to open a form. Keep the schema specific to the agent and application you are building; onboarding-specific forms or events are not global SketricGen tools. Structured Output does not collect the user’s response. After the frontend renders an interactive component, send the submitted values as the user’s next message on the same conversation. Use Human Input instead if the agent run must pause and wait for that response.Schema rules
- The root must be a non-empty object schema.
- Field names must start with a letter and contain only letters, numbers, and underscores.
- Supported field types are string, integer, number, boolean, object, and array.
- Arrays can contain supported primitives or objects.
- Every name in
requiredmust exist inpropertiesat that level. - Nesting cannot exceed eight levels.
- The current contract version is
1.
Detect the event
The public streaming API exposes ordinary tool-call events. Match the generated tool name or maintain a node-name mapping in your application.TOOL_CALL_START.tool_call_arguments contains model-supplied data that has not yet completed runtime validation. Use the start event for progress UI, not application rendering or writes. TOOL_CALL_END.tool_call_result contains the validated compact JSON result; depending on the client transport, it may arrive as a JSON string or an object, so parse and runtime-check it before use. Treat the end event as confirmation that this tool call completed, not as proof that the entire agent turn has ended.
Instruction pattern
Tell the agent what must happen before the call and what it must do afterward:Security and reliability
- Validate identifiers such as template slugs against server-trusted data before navigation or writes.
- Do not put API keys or private credentials in the output schema, description, or tool arguments.
- Make write actions idempotent and require confirmation separately; Structured Output itself only returns data.
- Version your frontend component contract inside the payload when UI compatibility matters.
- Test missing context, invalid values, duplicate tool calls, interrupted streams, and model retries.
toolType: "custom_tool" with config.kind: "structured_output" is not supported. Use toolType: "structured_output" and omit config.kind.
