# Structured outputs with Pydantic AI

DevFeed: [Structured outputs with Pydantic AI](<https://devfeed.tech/articles/structured-outputs-with-pydantic-ai-30003.md>)

Original publisher: [Read original article](<https://engineering.freeagent.com/2026/03/24/structured-outputs-with-pydantic-ai/>)

Author: Ed Berry

Published: 2026-03-24T10:34:08Z

Content type: tutorial

Language: en

Sources: [FreeAgent](<https://devfeed.tech/sources/freeagent.md>)

Topics: [Large Language Model](<https://devfeed.tech/topics/llm.md>), [JSON Schema](<https://devfeed.tech/topics/json-schema.md>), [Prompt Engineering](<https://devfeed.tech/topics/prompt-engineering.md>), [Pydantic](<https://devfeed.tech/topics/pydantic.md>), [Python](<https://devfeed.tech/topics/python.md>), [Structured-data](<https://devfeed.tech/topics/structured-data.md>)

Tags: [ai](<https://devfeed.tech/tags/ai.md>), [data](<https://devfeed.tech/tags/data.md>), [data-ml](<https://devfeed.tech/tags/data-ml.md>), [data-science](<https://devfeed.tech/tags/data-science.md>), [data-validation](<https://devfeed.tech/tags/data-validation.md>), [genai](<https://devfeed.tech/tags/genai.md>), [json-schema](<https://devfeed.tech/tags/json-schema.md>), [llms](<https://devfeed.tech/tags/llms.md>), [prompt-engineering](<https://devfeed.tech/tags/prompt-engineering.md>), [python](<https://devfeed.tech/tags/python.md>), [schema](<https://devfeed.tech/tags/schema.md>), [structured-output](<https://devfeed.tech/tags/structured-output.md>)

## AI overview

This article explains structured outputs for LLMs using Pydantic AI. It introduces the relationship between Python type hints, static analysis, Pydantic, and runtime data validation, while noting that Pydantic AI is model-agnostic.

## Source excerpt

One of the challenges of working with LLMs is getting them to respond with a consistent format, such as a given JSON schema. Anyone who has tried to solve this issue with prompt engineering knows how frustrating it can be. You add a 'MUST' here and an 'always return JSON' there, but still the output [...]