StudyVisuallyStart studying
Part 02 · OpenAI API · Card 6 of 9

Who reads the answer?

If a human reads the reply, plain text is fine. If code reads it, use structured output so parsing never breaks.

Last updated

Analogy

HTML for people, JSON for machines. You wouldn't make your frontend regex-parse a paragraph to find the order total.

In an agent

Inside an agent most outputs feed other steps, so structured output is the default and free text is the exception.

Practice

Flashcards

  • What is structured output?A model reply forced to match a JSON schema, so code can parse it safely.

Questions people ask

How do I decide between free text and JSON output?

Ask who reads it. If a person reads it, free text is fine and often nicer. If code reads it, use structured output with a schema, so parsing never breaks. You would not make a frontend search a paragraph for an order total; do not make your agent's next step do it either.

Why do agents mostly use structured output?

Inside an agent, most outputs are not shown to anyone. They choose a route, fill a tool's arguments or feed a report to another system. A schema guarantees the shape those steps expect. Free text is usually only the very last message, the answer the person actually reads.