Topic 4 of 5 · 4 min read
Final reports and output contracts
Goal: Write an output contract that makes an agent's final report state what it did, how it verified it and what is left.
An output contract tells the agent exactly what its last message must contain, so that "done" always comes with evidence and with what was left undone. Without one, final reports are cheerful summaries that read the same whether the work succeeded or not.
Check yourself · 1 of 3
Which line in a final report is the most useful for a reviewer?
Why it matters
The final report is often the only thing a person reads. Models tend to describe the plan they followed as if it were the result: "I updated the config and fixed the tests" when the tests were never run. A contract turns the report into a checkable record. It also lets a script parse the status, so a pipeline can stop on "blocked" instead of trusting the tone.
What a good contract asks for
- A status from a fixed list.
done,partialorblocked, on the first line. No "mostly done". - What changed. Files or records touched, in a short list.
- How it was checked. The command run and what it printed: "
npm test: 212 passed, 0 failed". If something was not run, say so. - What was not done. Skipped steps, assumptions and anything the agent could not access.
- What the human must decide. Open questions, with the agent's default.
- Format. Plain text or JSON, with the length you want. If a program reads it, give the schema.
Add a rule against fake evidence: "Report only checks you actually ran in this session. If you did not run the tests, write not run."
Before and after
Before, the agent ends with: "I fixed the login bug and everything works now."
After, with a contract in the prompt:
End with a report in this format:
Status: done | partial | blocked
Changed: one line per file
Checked: each command you ran and its result; write `not run` for any
check you skipped
Not done: skipped steps and assumptions
Decide: questions for the user, each with your default
The report now reads: "Status: partial. Changed: auth/session.ts. Checked: npm test auth: 14 passed; full suite not run. Not done: expired-token path has no test. Decide: keep sessions at 30 minutes (my default)?" A reviewer sees what to look at.
What goes wrong
- Evidence the agent never gathered. If the contract asks for test results and the agent has no way to run tests, it may invent them. Give it the tool, and allow
not run. - Too long. A report that restates the whole transcript is skipped. Ask for lines, not paragraphs.
- Status without meaning. Define
partialandblockedin one sentence each, or the agent uses them loosely.
Examples
A report a pipeline can use
The prompt asks for JSON: {"status": "done|partial|blocked", "changed": [], "checks": [{"cmd": "", "result": ""}], "not_done": [], "decisions": []}. A CI step fails the job when status is blocked or when checks is empty. The agent cannot say "done" with no checks listed.
An honest partial
A migration agent reports: "Status: partial. Migrated 8 of 9 tables. Checked: row counts match for 8 tables. Not done: audit_log has a column type with no equivalent. Decide: store as text, or skip the table?" Compare that with "Migration complete!" The first is useful even though it is not a success.
Key points
- An output contract fixes the structure of the final message: status, changes, checks, what was not done and open decisions.
- Ask for the command that was run and its result, and allow the phrase
not runfor skipped checks. - Use a fixed status vocabulary and define each value, so people and scripts can read it the same way.
- Keep the report short; the goal is a record a reviewer can check, not a retelling of the transcript.
- Do not demand evidence the agent has no tool to produce.
Common mistakes
- Asking for a summary of what the agent did rather than what it verified.
- Leaving out an explicit way to say a check was skipped, which nudges the agent to imply it ran.
- Using a status like "mostly done" that no human or script can act on.
- Requesting a long narrative report that reviewers stop reading.
Check yourself · 2 of 3
Why add "write not run for any check you skipped" to an output contract?
Check yourself · 3 of 3
A pipeline reads the agent's final message to decide whether to merge. Which output contract is best?
Practice items, not counted towards your mastery.
Start here
- Effective context engineering for AI agents (Anthropic) (opens in a new tab)ArticleFree
Explains system prompts at the right altitude and why heuristics beat brittle if-else logic.
- Prompting best practices (Claude docs) (opens in a new tab)DocsFree
Concrete guidance on agentic instructions, tool use, parallel calls and how eager a model should be.
- GPT-5 prompting guide (OpenAI Cookbook) (opens in a new tab)DocsFree
Shows how to tune agentic eagerness and tool preambles, and why contradictory instructions hurt.
More for this topic
- Best practices for Claude Code (Claude Code docs) (opens in a new tab)DocsFree
A vendor's advice on instruction files, verification and keeping agent guidance short.
- A practical guide to building agents (OpenAI) (opens in a new tab)DocsFree
Covers instruction design, guardrails and when an agent should hand off to a human.