ag2-structured-output
Installation
SKILL.md
Structured output
When to use
- The user wants a Pydantic model, dataclass, dict, primitive, or union back — not a string.
- They're doing classification, extraction, scoring, normalisation, or anything where downstream code parses the reply.
- They want automatic retry on validation failure.
60-second recipe
from pydantic import BaseModel, Field
from typing import Annotated
from autogen.beta import Agent
from autogen.beta.config import OpenAIConfig