Structured Outputs for Superintelligent Agents: Schemas Before Writes
Require typed, schema-checked outputs from an AI agent before any tool writes to a system, and reject malformed actions at the validation step.

Structured output for an AI agent means the model returns its proposed action as a typed object with named fields, fixed value types and required values, instead of a sentence. Your systems check that object against a schema before any tool writes a record, sends a message or changes a balance. Anything that fails the check is rejected, logged and kept away from the system of record.
Key takeaways
- Make the agent emit a typed action object before any write tool can be called.
- Define one schema per write action, with required fields, allowed values and units.
- Validate every object in code outside the model, and reject anything that does not pass.
- Return specific, machine-readable errors so the agent can correct a proposal within clear limits.
- Combine schema checks with approval rules and idempotency keys, because a valid action can still be sent twice.
Why free text is the wrong input for a write
When an agent writes to a system, the write tool receives arguments. If those arguments come from a sentence the model composed, the tool is guessing what the sentence meant. A date written as next Tuesday, or an amount written as about two thousand, is not something a scheduling system or ledger should accept without a check. The mistakes that matter are rarely dramatic. They look plausible: a customer identifier that belongs to a different customer, a missing currency, a quantity entered in cases when the system expects units, or a field copied from the wrong row of a spreadsheet.
A typed output moves those questions to a place where they can be answered. The model still decides what to propose, but the proposal arrives as a structure with explicit names, so a program can ask whether each field is present, whether it has the right type, and whether it refers to a record that exists. For a broader explanation of why business agents need this shape, see Structured Outputs for AI Agents: Schemas Your Systems Accept.
Define a schema for each write action, not for the agent
The most common mistake is to write one large schema called agent output and reuse it everywhere. A better unit is the action. Each write the agent may perform gets its own schema: create a draft invoice, change a contact's phone number, book a technician visit, add a line to a tracking sheet. Each schema lists only the fields that action needs, so a booking cannot carry a payment field by accident.
For each field, decide five things before the first test: its name, its type, whether it is required, the values it may take, and where its value came from. The last point is easy to skip and important. A field such as customerId should carry a reference to a record the agent looked up in a read tool, not a name typed from memory. Clear names and descriptions also help the model fill the schema correctly, a point covered in detail in Tool Schema Design for AI Agents: Names, Descriptions and Errors.
A practical schema for a single write usually includes:
- An action name taken from a closed list, so unknown actions fail immediately.
- Identifiers that must match an existing record in the system, not free text.
- Typed values for dates, times, money and quantities, with the unit stated.
- A source field that points to the document, message or read result that supports the proposal.
- A short reason field in plain language, kept for review and never used as a substitute for the other checks.
Validate before the tool runs, and reject what fails
Validation belongs in ordinary code between the model and the tool. The model should never be the only judge of whether its own output is acceptable. A validator checks the object against the schema, then against business rules that the schema cannot express, such as whether a technician is on the active roster or whether a visit falls inside opening hours. Only an object that passes every check becomes a call to the write tool.
Rejection is part of the design, not a failure of it. A rejected proposal should say which field failed and which rule it broke, in terms the agent can act on. Vague messages such as invalid input cause repeated attempts that waste time and can drift toward a wrong answer.
Illustrative scenario: a regional maintenance company lets an agent propose changes to scheduled visits. The schema requires an existing visit identifier, a start time with a timezone, a technician identifier from the active roster, and a duration from a fixed set of options. The agent proposes moving a visit to a technician who is on leave that day. The validator rejects the proposal and names the technician field and the availability rule. Nothing is written, the rejection is logged, and the change appears in the approval queue for a person to decide.
Treat the source text as untrusted too. A document or message can contain instructions aimed at the model, a risk described in the [OWASP guidance on prompt injection prevention](https://cheatsheetseries.owasp.org/cheatsheets/LLM_Prompt_Injection_Prevention_Cheat_Sheet.html). A schema limits what a manipulated proposal can do, because an injected instruction still has to fit a typed action that passes the same checks as any other.
A step-by-step plan for the first schema gate
Start with one write action that is useful, bounded and easy to reverse. Then build the gate in this order:
- Step one: write the action in plain language, with the business owner who will approve it named.
- Step two: list the fields the action needs and remove every field it does not need.
- Step three: set the type, requirement and allowed values for each field, and identify the read tool that supplies each identifier.
- Step four: write the business rules the schema cannot express, and assign each one to code, not to the prompt.
- Step five: define the rejection message format, including the field name, the rule and the record involved.
- Step six: run a fixed set of proposals through the validator, including valid ones, malformed ones and plausible wrong ones, and record which were accepted.
- Step seven: connect accepted proposals to the approval step, then to the write tool, with an idempotency key so a retry cannot repeat the action. The reasoning is in Idempotent AI Agent Actions: Stop Duplicate Invoices and Bookings.
Keep the test set. It becomes the regression suite you run every time a schema, a prompt or a model changes.
How Be Human handles schema gates in managed operations
In a first engagement, Be Human defines the agent's role, the write actions it may propose, and the schema for each one. Each action has a named approval boundary and an observable success criterion agreed with the business before any write is enabled. In managed operations, we keep validators under version control, review rejected proposals during recurring evaluations, and update schemas when a connected system changes its API. The scope of a given integration is set with the client, and the operating record shows which actions were proposed, accepted, rejected and approved.
Keeping schemas current without loosening them
Schemas drift. A vendor adds a field, a team renames a status, or a new product line needs its own units. The temptation is to loosen a check whenever it blocks useful work. Resist that. When a rule fails repeatedly, find out whether the proposal was wrong, the read tool returned incomplete data, or the rule is out of date. Only the last case justifies a change to the schema, and that change should be versioned and tested against the saved set of proposals.
Log every proposal with its input source, the schema version, the validation result and the approver, if any. Observability practices from the [OpenTelemetry documentation](https://opentelemetry.io/docs/concepts/observability-primer/) apply well here: traces that connect a proposal to the tool call it produced let you answer what happened and why, without reconstructing it from memory. If you are not sure which of your tools should accept an agent's writes first, the free Be Human AI diagnostic can help you find the first task worth handing to an agent.
Frequently asked questions
What is structured output for an AI agent? It is a response format in which the model returns its proposed action as an object with named, typed fields instead of free text. The object can be checked by ordinary code against a schema before any tool uses it. This makes the proposal inspectable, reviewable and easier to reject when it is wrong.
Does a schema stop an agent from writing wrong values? A schema stops malformed, missing, out-of-range and unknown values, but it cannot confirm that a correctly formatted value is the right one. Correct-looking mistakes need business rules, read-back checks and, for consequential actions, a named human approver. The schema is one layer among several.
Should validation happen inside the prompt? No. A prompt can ask the model to follow rules, but the model is not a reliable enforcer of its own output. Validation belongs in code outside the model, where it runs the same way every time and cannot be talked out of its checks.
Where should a team start with schemas for agent writes? Start with one write action that is low risk, easy to reverse and clearly valuable, and give it a schema, a validator and a rejection log before adding others. Expand only after the first gate has run on real proposals and its failures are understood. The first test set should include plausible wrong proposals, not only obvious errors.
Your next step
See where an AI agent fits in your company first.
Take the free Be Human AI diagnostic. A few questions about your work show which task to hand to an agent first, what it needs to know and where a person approves.
Be Human editorial guidance. Examples are illustrative unless explicitly attributed. Sources provide background; implementation choices depend on your workflow.


