Skip to main content
Structured outputs give agents predictable, validated data — ideal for APIs, dashboards, and downstream automation.
The user asks for structured data; the agent returns validated Pydantic output for downstream code.

Quick Start

1

Simple Usage

Define a Pydantic model and pass it to output_pydantic:
2

Multi-Agent Task

Use Task with output_pydantic inside an AgentTeam:

How It Works


Native Structured Output

PraisonAI auto-detects models that support native response_format with JSON schema (GPT-4o, Claude 3.5, Gemini 2.0). Unsupported models fall back to prompt injection.

YAML Configuration

Run with praisonai agents.yaml.

Best Practices

Define only the fields you need. Smaller schemas validate faster and reduce model confusion.
Use output_pydantic when you want a typed object; use output_json when you only need serialisable dicts.
Leave native_structured_output unset unless you know your model needs forcing — the SDK picks the cleanest path.
Enable verbose output while tuning schemas so validation errors show which field failed.

Structured LLM Errors

Handle validation and LLM failures gracefully

Output & Display

Format and present agent responses

Agent Teams

Multi-agent workflows with structured tasks

Tasks

Task configuration and output options