Validation Rules
The API validates request payloads before routing them to an agent. If the request body is malformed, incomplete, or contains an unsupported response_schema, the API returns 422 Unprocessable Entity.
Message Validation Rules
The messages field must follow these rules:
messagesmust be a non-empty array.- Each message must be an object containing
roleandcontent. rolemust be a supported role:userorassistant.contentmust be a non-empty string.- The last message in the array must have the role
user.
Invalid Messages Example
{
"detail": "Invalid messages: messages must be a non-empty list of {role, content} objects"
}
Response Schema Validation
If a response_schema is provided, it must follow the supported schema rules. Invalid schemas are rejected before the agent runs.
For example, an object schema must define a valid properties field.
Invalid Schema Example
{
"detail": "Invalid response_schema: Object schema must define 'properties'"
}
Notes
- Validation errors use HTTP status code
422. - The request is not routed to an agent when validation fails.
- Error messages are returned in the
detailfield. - Fix the request body and retry the request.