Direct answer
Use structured outputs when a supported integration must hand a machine-readable brief to another component. In the Messages API, client tools have an input_schema, and returned tool_use blocks contain arguments. That contract can remove prose parsing from a tool handoff. It does not establish a universal structured-output switch for interactive Claude Code.
For an interactive session, write the required fields explicitly, ask for missing values instead of guesses, and inspect the proposed edit against the brief. Treat schema validity as a shape check, not proof that the selected file, decision, or change is correct. The practical boundary is simple: use documented schema features on the surface that exposes them, and use explicit review everywhere else.
Why a machine-readable brief still needs judgment
A downstream component may need to route a brief, queue work, or reject an incomplete request. Free-form prose can carry all the right meaning while leaving the consumer to guess which paragraph contains the target. A defined field list makes that handoff easier to inspect. It also makes omissions visible before execution starts.
The cost appears when structure is mistaken for correctness. A response can contain every required key and still name the wrong module. An array can be present and empty when the task needed a protected interface. An enum can accept a value that the product owner never intended. Those are semantic failures, not formatting failures.
Official (F019): the tool-use overview says client tools require an input_schema and return tool_use blocks containing arguments. Its caveat matters: this is the Messages API tool contract, not a description of every Claude Code interaction.
Official (F020): the prompting best practices recommends specifying exact output formats. Format instructions can organize a response, but they do not prove that a particular API feature is available on the current surface.
A useful brief therefore needs two reviews. The first asks whether the required fields exist and have allowed types. The second asks whether their values match the repository evidence and the agreed outcome. The verification evidence guide is relevant to that second review because a polished result still needs supporting evidence.
Define when a response must be machine-readable
Start with the consumer rather than the schema. Ask what component will read the response and what decision it will make without a human rewriting the text. A person reviewing a plan may benefit from prose. A dispatcher that must choose a queue may need a stable status and a target identifier.
A response is worth structuring when several conditions apply: a program consumes a field, the allowed values are known, and missing information must block the handoff. If none of those conditions applies, a compact human-readable brief may be enough. Adding a schema to every answer creates maintenance work without closing a real integration gap.
| Need | Prefer | Reason |
|---|---|---|
| Human review of direction | Short prose plus a field summary | The reviewer needs reasoning and boundaries together |
| Programmatic routing | A documented structured response on a supported surface | The consumer needs stable fields and values |
| Tool invocation | The documented tool input contract | Arguments must match the tool definition |
| Early clarification | An explicit open-question field | Missing policy should stay visible |
| Final edit review | Diff and acceptance evidence | A structured plan is not evidence that files changed correctly |
The acceptance criteria definition supports treating acceptance as predefined conditions. That is independent vendor guidance, available here only through a search excerpt, not a universal standard. Its useful lesson is narrow: decide what acceptable means before a machine reports completion.
A structured brief should carry the minimum information needed for that decision. More fields do not automatically produce better grounding. Each additional field needs an owner, a validation rule, and a reason to exist. If the team cannot explain who consumes a field, remove it or keep it in the human-facing explanation.
Separate content shape from edit behavior
A brief format answers how information is represented. Edit behavior answers what the agent may change and when. Those questions can share a workflow, but they are not the same control.
For example, a schema may require files, constraints, and success_criteria. That structure says which values must be returned. It does not say Claude Code will read those files, preserve those constraints, or wait for approval. Official (F020): exact output formats are prompting guidance, not an enforcement mechanism.
Official (F021): the Agent SDK todo-tracking page describes a written todo list whose item statuses are updated as work proceeds. The source concerns Agent SDK behavior and should not be treated as a guarantee about every interactive session. A status field can report progress without proving the underlying work is complete.
| Surface | Supported evidence in this packet | Safe use | Do not assume |
|---|---|---|---|
| Messages API tool use | input_schema and argument-bearing tool_use blocks, F019 |
Define the documented tool input contract | That interactive Claude Code exposes the same controls |
| Messages API prompting | Exact output-format guidance, F020 | Request a clear response format | That prose formatting enables an API feature |
| Agent SDK todo tracking | Written items with updated statuses, F021 | Inspect progress where the SDK exposes it | That status equals acceptance |
| Interactive Claude Code | Precise prompts and review of proposed changes | State fields, exclusions, and evidence in the brief | A universal schema switch or automatic validation |
The Anthropic Messages format guide provides related format context. Keep that context separate from claims about interactive behavior. A compatible message shape and a product feature are different things.
The OpenAI and Anthropic API comparison is useful when a team maintains more than one integration. It should lead to a surface inventory, not to copying controls from one API into another product.
Choose a schema that matches the workflow
A good schema describes the decision the consumer must make. Begin with one required outcome, then add only the evidence needed to evaluate it. For a code-change brief, useful fields may include the goal, candidate targets, protected behavior, acceptance conditions, and unresolved questions.
The field types should reflect the real workflow. A single target may be a string. Several candidate files may be an array. A policy decision may need an enum with an explicit unknown option. An open question should not disappear because the schema lacks a place to record it.
| Brief field | Purpose | Allowed shape in this editorial example |
|---|---|---|
goal |
State the requested observable outcome | Non-empty text |
targets |
Name candidate files or symbols for inspection | Array of text pointers |
constraints |
Record behavior and scope that must remain intact | Array of text rules |
success_criteria |
Describe evidence that would satisfy the request | Array of observable conditions |
open_questions |
Preserve decisions that block implementation | Array of questions, empty only when none remain |
Derived editorial example: the example has five top-level fields because it defines one goal, one targets list, one constraints list, one success_criteria list, and one open_questions list. Formula: 1 + 1 + 1 + 1 + 1 = 5 fields. This is a count of the example design, not a Claude Code limit or benchmark.
The schema should also distinguish an empty collection from a missing collection. An empty open_questions list can mean that discovery found no blocker. A missing field can mean the producer failed to answer. Treating both as the same state hides a handoff defect.
The tool schema guide for unambiguous inputs covers a neighboring problem: names and descriptions should make a tool call understandable. Apply the same discipline to brief fields without claiming that clear names guarantee correct selection.
Avoid putting implementation instructions into every field. A field can identify the intended outcome while leaving the method open. The prompt specificity guide for files and exceptions helps make pointers concrete without turning the brief into a full implementation script.
Keep human-facing explanation outside the schema
Machines need stable fields. Reviewers also need reasons. A compact schema can carry the decision data while a short explanation describes why that decision was made. Combining both into one overloaded text field makes parsing harder and review slower.
For example, constraints can list the protected behavior. The explanation can cite the relevant code and describe an ambiguity that remains. The downstream component consumes the list; the human reads the reason. Neither representation has to imitate the other.
| Structured output | Free-form explanation | Review question |
|---|---|---|
| Target identifier | Why that target appears relevant | Does repository evidence support the choice? |
| Allowed status | Why the status changed | Did the state change actually occur? |
| Acceptance list | How each condition will be inspected | Is the evidence independent of the summary? |
| Open-question list | Who can answer and what is blocked | Should execution pause? |
| Dependency list | Why one step consumes another’s result | Is the ordering necessary? |
Official (F020): exact formats can organize the response. The guidance does not say that explanations are useless or that every response must be schema-only. Keep reasoning available for review while giving programs a predictable contract.
This separation also helps when a field fails validation. The parser can reject the structured portion with a precise error. A reviewer can still inspect the explanation to understand the mismatch. The tool result evidence contracts apply the same broader principle: a result should close the evidence gap that caused the request.
Handle missing or invalid fields explicitly
A schema is most useful when failure is visible. Define what the consumer does with a missing required field, a disallowed value, an empty list, or contradictory fields. Silent defaults are dangerous because they turn an unanswered question into an invented decision.
Use an explicit unknown state when the workflow permits one. For a blocking product decision, unknown should stop the handoff. For an optional note, unknown may be acceptable. The response policy belongs beside the schema, not in a later cleanup script that nobody reads.
A practical validation pass checks presence, type, allowed values, and cross-field meaning. Presence asks whether the field exists. Type asks whether it has the expected shape. Allowed values ask whether an enum or list rule is satisfied. Cross-field meaning asks whether the values make sense together.
For instance, a completed status beside an empty acceptance list may be structurally valid and semantically incomplete. A target list beside an open question about the target may also be contradictory. These checks require workflow rules beyond a basic shape validator.
The false-success explanation is a useful adjacent warning. A mechanical signal can be real while still failing to prove the desired outcome. Do not let a validator inherit more authority than its checks actually carry.
Check the actual execution surface
Before promising structured behavior, name the surface in the brief: interactive Claude Code, an Agent SDK integration, or a direct Messages API request. Then identify which documented contract applies. If the packet does not prove support, record the gap instead of filling it with an assumption.
The structured outputs documentation is an official source supplied for further reading. In this packet it is a canonical link only, not a fully fetched page. It does not authorize a claim that every interactive Claude Code session exposes structured outputs.
Use a small compatibility checklist:
- Name the consumer and the exact field it needs.
- Identify whether the producer is interactive Claude Code, Agent SDK, or a Messages API integration.
- Cite the documented feature for that surface.
- Keep API-only controls out of interactive instructions.
- Validate types and allowed values before dispatch.
- Review the semantic content against repository evidence.
- Record unresolved support as unknown.
The custom API base URL resource may matter to a gateway setup, but it does not settle feature compatibility. Likewise, the agent harness security boundary is a separate control question. A transport route does not prove schema support.
Use structured briefs in supported integrations
The following editorial example models a Messages API client-tool handoff. It uses the input_schema and argument-bearing tool_use concepts from F019. It is not an interactive Claude Code command and does not claim a structured-output feature on that surface.
{
"name": "prepare_change_brief",
"input_schema": {
"type": "object",
"properties": {
"goal": { "type": "string" },
"targets": { "type": "array", "items": { "type": "string" } },
"constraints": { "type": "array", "items": { "type": "string" } },
"success_criteria": { "type": "array", "items": { "type": "string" } },
"open_questions": { "type": "array", "items": { "type": "string" } }
},
"required": ["goal", "targets", "constraints", "success_criteria", "open_questions"]
}
}Suppose the requested change is to clarify an expired-account message. A valid argument object names the message module, preserves the existing redirect behavior, and asks for visible wording that distinguishes an expired account from a network failure. Those values are editorial inputs, not claims about a real repository.
A shape check confirms that all required fields exist. A semantic review then reads the named module, checks whether the redirect is really part of its contract, and compares the proposed wording with the requested distinction. If the module does not own the redirect, the brief must change before an edit is approved.
Derived editorial example: the validator has four checks for each required field: presence, type, allowed shape, and workflow meaning. With five required fields, the design defines 5 fields × 4 check categories = 20 check instances. This arithmetic describes the example only. It is not a measured error rate, product limit, or quality score.
The edit target guide for exact blocks becomes relevant after the brief survives review. A machine-readable target still needs a unique anchor and current text before replacement.
Concrete win, loss, and practical implication
Win: a supported tool handoff can receive named arguments instead of forcing a dispatcher to infer intent from prose. Required fields make an omitted boundary visible before execution.
Loss: a schema can accept a well-formed brief that points to the wrong file or protects the wrong behavior. Schema maintenance also creates work when the workflow changes. Neither cost disappears because parsing became easier.
Implication: keep two gates. Validate the structured contract at the integration boundary, then review the meaning at the edit boundary. The plan dependency guide helps place the second gate after the evidence it needs.
State the compatibility boundary
Structured output support belongs to a specific product surface, model, and integration. The supplied evidence proves the Messages API tool contract and prompting guidance. It also documents Agent SDK todo tracking. It does not prove a universal interactive Claude Code schema switch.
Avoid phrases such as “turn on structured outputs in Claude Code” unless a current Claude Code source supports that exact instruction. Prefer language such as “require these fields in the brief, then validate them in the supported integration.” That wording keeps the requirement visible without inventing a feature.
The tool choice boundary guide addresses a similar category error with API controls. Use it as a reminder to check the surface before borrowing a mechanism.
A reviewer should be able to answer three questions from the final brief: who consumes each field, which documented surface validates it, and what evidence checks its meaning. If one answer is missing, the handoff is not ready.
Data gaps and future updates
Unknown: the supplied research does not prove that interactive Claude Code exposes every Messages API control associated with structured responses. No benchmark compares schema-based briefs with free-form briefs for edit quality, time, or cost.
Community evidence: no GitHub issue or reproducible community run was verified in this packet, so this article uses no community report and claims no issue outcome.
The structured-output page was available as a canonical link only. Track-todos and the independent acceptance-criteria overview were available through search evidence rather than full retrieval. A future update should recheck those pages before adding feature details or quantitative claims. Official documentation is live, so any new support statement needs a fresh source and a named surface.
One AI API Key option for OpenAI-format agents
Building an OpenAI-format agent that consumes these briefs? One AI API Key uses https://api.oneaiapikey.com/v1, one key, and the packet’s 46 live free IDs for that OpenAI-format path. Review the free model list and the API quickstart. Those IDs are not Claude Code model sources; Claude Code uses an Anthropic-format route, and its Claude IDs were unavailable on 2026-11-27.
FAQ
Can I require JSON from interactive Claude Code?
You can state an exact output format and ask for named fields, which follows F020. The packet does not establish a universal interactive structured-output switch. Validate the returned values and review their meaning instead of assuming schema enforcement.
Does a valid tool_use argument object prove the edit is correct?
No. F019 establishes a tool-call contract: client tools require an input_schema, and returned blocks contain arguments. Correct targets, preserved behavior, and acceptable results still need repository evidence and review.
Where should explanations live if the machine needs structured fields?
Keep stable decision data in the supported structured contract and put concise reasoning in a separate human-facing section. That separation lets the program parse fields while preserving the context a reviewer needs.
Should every agent response use a schema?
No. Use structure when a program consumes stable fields or when omissions must block a handoff. A small human-reviewed task may need only a clear brief, explicit boundaries, and inspectable evidence.
Sources
- Official, fetched: Tool use with Claude, F019. Messages API tool contract, not every Claude Code interaction.
- Official, fetched: Claude prompting best practices, F020. Format guidance does not establish feature availability.
- Official, search-index only: Track todos, F021. Agent SDK status updates are progress signals, not completion proof.
- Official, canonical link only: Structured outputs. Further reading only in this packet; no interactive support claim is drawn from it.
- Independent, search excerpt only: Acceptance criteria overview. Supporting definition, not a universal standard.
- Official, fetched: Claude Code best practices, F002 and F078. Precise prompts and evidence of completion, not guaranteed correctness.