Ag2 Structured Output

Get a typed Python value back from an AG2 `Agent` instead of free text. Pass `response_schema=` (a Pydantic model, dataclass, primitive, union, `ResponseSchema`, or `@response_schema` validator) and read the parsed result via `await reply.content()`. Use when the user wants validated structured output, classification, extraction, or scoring. Covers `ResponseSchema`, `@response_schema`, `PromptedSchema` (for providers without native structured output), per-turn override, validation retries, and primitive embedding.

ag2ai 16266e5 2 files · 9.3 KB Updated

File contents

ag2ai/ag2-skills/tree/main/skills/ag2-structured-output commit 16266e5544

Frequently asked questions

npx skillmds@latest add ag2ai/ag2-structured-output