Ai Suite
4. Prompting
Structured Output
Structured Output
When an Agent implements Laravel\Ai\Contracts\HasStructuredOutput in PHP (such as Jev or JudgeAgent) or has Structured Output (JSON) enabled in the Agent Editor, the AI Suite automatically extracts the structured array response and makes its keys available for downstream routing.
Enabling Structured Output
- In the UI (
/ai-suite#/agent/{id}/edit):- Open the agent in the Edit Agent screen.
- Check the Structured Output (JSON) checkbox above the CRAFT Prompt Engine section and click Save Changes.
- On the Agent Detail page (
/ai-suite#/agent/{id}), an amber Structured Output (JSON) badge is displayed.
- In PHP (
app/Ai/Agents/*.php):- Implement
Laravel\Ai\Contracts\HasStructuredOutputon your Agent class and define theschema(JsonSchema $schema): arraymethod.
- Implement
Using Structured Output in Workflows
- In
EnumNodes: Only agents with Structured Output (JSON) enabled appear in the Agent Class dropdown of anEnummodule in the Visual Workflow Editor. - In
If / Else&StatementNodes: When a structured agent outputs a JSON object (e.g.,{"decision": "APPROVE", "score": 92}), a connectedStatementnode can inspect specific properties using the Match Key (Dot-notation) field (e.g.,decisionorscore).