Skip to main content

The problem

By default, an agent’s action payload is free-form — the AI decides what fields to include:
This is fine for prototyping, but in production you need predictable, typed payloads your backend can parse without guessing. Is amount a string or a number? Is order_id always present?

The solution

Structured fields (payload_schema) let you declare the exact fields the AI must extract, with types and required constraints. The schema is injected into the LLM’s function calling definition — the model is natively constrained to produce these fields.
Now every run produces a predictable payload:

Field types

Required vs optional

  • Required fields (required: true) — the AI will always include them. If the information isn’t in the message, the AI will use its best judgment (e.g. "unknown" for text).
  • Optional fields (required: false, default) — the AI includes them only when the information is clearly present.

Limits

  • Maximum 10 fields per agent
  • Field names must be snake_case (lowercase letters, digits, underscores, starting with a letter)

Combining with allowed actions

Structured fields work best with allowed action types. Together, they give you fully predictable agent output:
  • allowed_actions → constrains the action type
  • payload_schema → constrains the action payload
Your backend can now safely parse every agent run without any guesswork.

API

Set payload_schema when creating or updating an agent:
Start without payload_schema to see what the AI naturally extracts, then lock it down once you know which fields matter to your workflow.