laravel/ai

Structured output validation

Open

#189 opened on Feb 19, 2026

View on GitHub
 (4 comments) (2 reactions) (0 assignees)PHP (261 forks)github user discovery
help wantedneeds more info

Repository metrics

Stars
 (978 stars)
PR merge metrics
 (PR metrics pending)

Description

Hi

I am a bit new to laravel/ai but I have a question regarding agents that implements HasStructuredOutput

If the structured format of the StructuredAgentResponse doesn't follow the format defined in the schema - shouldn't an exception be thrown? Should this happen on the Prism level, the Laravel/Ai level - or am I supposed to do this myself?

I don't really see any point in structured output if I have no guarantee that the result will conform to my schema.

Contributor guide