Skip to content
The AI Agent Factory

25.11 How today's tools realize it

Approved by
Panaversity ·
14 min read

Reference. How today's products realize the chapter's ideas. Skim it now, and come back when you choose a runtime or port the extraction step.

In everyday life. You carry one phone charger to three countries. Each wall socket has a different shape, and one of them gives no sign of whether it has power. So you carry an adapter for each socket. You also look at the phone's screen every time, because a plug that fits tells you nothing about whether the phone is charging. In this concept, the sockets are three APIs, and the look at the screen is the check in your own code.

What you will learn. You practice this in Lab 25, Task 5.

  • How sure is each claim?
  • What does each product do with a schema, and with an answer that is no answer?
  • Which of the seven jobs does each one do?
  • What must stay true on any runtime?

Why it matters. The three look alike in a request: each takes a schema and returns JSON. They differ in what happens when the schema cannot be met, and one kind can drop the schema without an error.

At work. Lab 25 ends with a port. The builder moves Brightline's extraction step to a second API, and runs the same suite and the same three saved responses against it. The three are a decline, a cut answer, and valid JSON with a wrong total. What the builder writes down is the list of what changed.

How sure is each claim?

Every fact here is documented, and none has been tried in a lab run yet.

LabelMeans
DocumentedRead on the product owner's own pages on November 29, 2026. A fact with no label is documented
Not yet testedDocumented, but no lab run has tried it yet

No vendor-neutral standard defines structured output, so this section compares each product with the seven jobs.

What does each product do with a schema, and with an answer that is no answer?

Each takes a schema and returns JSON, and each reports a decline and a cut answer in its own place.

Anthropic: the Messages API. The application writes the system prompt, and it outranks the user turn. A schema goes in output_config.format on any model, and the JSON comes back in a text block. Managed Agents has no structured outputs, which is why Brightline's extraction is a Messages API call.1 A decline is a 200 with the stop reason refusal, and a cut answer has max_tokens.2 Server-side fallback, in beta, passes a declined request to another model and names it in model.3 Two of Anthropic's other tools hold a schema in a different way. Claude Code's --json-schema option leaves the structured_output field out when a run ends without valid output. So a script checks that the field is present.4 The Agent SDK checks the answer against the schema after it is written, and asks the model again on a mismatch.5

OpenAI: the Responses API. The application writes developer messages, which are prioritized ahead of user messages.6 A strict schema goes in text.format. Every field must be required. A field that may be empty is written as a union with null, which means its type is written as the value or null.7 Strict schemas here accept number ranges such as minimum and maximum, which Claude's API rejects.7 A decline arrives as a refusal item in the content. A cut answer has the status incomplete, with the reason max_output_tokens.7 OpenAI's own page says the application "still needs to handle refusals, incomplete responses, and API errors, and validate any business rules that the schema does not express."7 Its prompts now live in your code too (25.1).

Open source: an open-weight model behind a compatible endpoint. An open-weight model is one whose trained file you can download and run on your own server. A compatible endpoint is a server that accepts the same requests as OpenAI's API. Servers such as Ollama, llama.cpp and LM Studio accept a JSON schema, and each can hold the answer to it while the model writes.8910 The risk is silence. The guide for llama.cpp says that schema features it does not support "are skipped silently". It also says that the model never sees the schema, so the prompt must describe it too.9 Ollama's cloud service does not support structured outputs at all.8 LM Studio warns that not every model can do it, and small models least of all.10 Running it safely. Treat every answer from such an endpoint as free text until your own schema has passed it. Run the three saved responses against the endpoint before you trust it with live invoices.

Which of the seven jobs does each one do?

The two AI vendors' APIs rank who is speaking, hold a schema and report why they stopped. An open-weight endpoint may. None does jobs 3, 6 or 7.

The job a person didClaude Messages APIOpenAI Responses APIAn open-weight endpointYour code, on all three
1. Knew the form they wantedReads your promptReads your promptReads your prompt, which must also describe the schemaThe prompt's words and examples
2. Knew who was speakingsystem outranks userdeveloper outranks userDepends on the modelWhich text goes where, and marking the invoice as data
3. Re-read after a changeNoNoNoThe versioned prompt file and the suite
4. Coped with any layoutHolds the schema. Rejects ranges with a 400Holds a strict schema. Every field requiredMay hold it, or drop it with no errorIts own schema, run on every answer
5. Saw a non-answer, and who answeredThe stop reason, and modelA refusal item, a status of incompleteVaries by serverReading it first, before any parse
6. Knew a wrong valueNoNoNoThe value checks against the record
7. Asked someone when unsureNoNoNoneeds_review, and the count by gate

Three rows should change a decision. Row 4 decides how much your own schema check must do. It does a little on the two AI vendors' APIs, and everything on a server that may drop the schema. Row 5 decides what your first gate reads, because each API reports why it stopped in a different place. Row 2 decides which role your application writes its rules in.

What must stay true on any runtime?

The validator and the regression case live in the reader's code. No API on this page checks a value against Brightline's tables, re-runs the suite after a prompt change, or sends an answer to Ana. Jobs 3, 6 and 7 are yours on every runtime, and so is the prompt file. An API can hold the shape and report why it stopped. Whether the answer is true, and what happens when it is not, stay with you.

The operating rule: on any runtime, the validator and the regression case live in your own code.

Exam note. Version 1.1 of the guide for the Claude developer foundations exam (CCDV-F), effective December 7, 2026, tests prompt revision, and structured output and defensive parsing. The exam examines Claude, not OpenAI or open-weight models.

Do this now. In the table above, find the column for the runtime you use. For each of jobs 4 and 5, copy this line:

Show me the line in this project that does this job, or tell me that no line does. Change nothing.

Mark each job your code does not yet do.

Check yourself

Question 1 / 7

0 answered

On OpenAI's Responses API, which role does the application write its rules in?

  1. Structured outputs, Anthropic.↑
  2. Stop reasons and fallback, Anthropic.↑
  3. Refusals and fallback, Anthropic.↑
Owner
Panaversity