Agent examples
Small test tasks that make an agent’s execution easy to follow. See what it was asked to do, which files it started with, and how it reached an answer.
Recorded model runs
These four tasks cover edits, project instructions, and recovery from a missing file. They run in tiny, temporary workspaces; they do not measure performance on a real codebase.
Each recording includes the original task, starting files, expected result, and independent checks. Step through the turns to inspect the tool calls and final answer.
Recorded with gpt-5.4-mini (high reasoning) on 2026-10-01. Browsing them makes no model calls.
Fix cents roundingPassed ↗
Task given to the agent
Fix the cents conversion in price.mjs. Investigate the tests, edit the implementation, and verify the fix. Keep unrelated files and existing tests unchanged.
Starting workspace
The agent starts in the project root. price.mjs rounds prices down, so the existing checks fail for values such as 1.005.
What success looks like
cents(1.005) returns 101, cents(12.345) returns 1235, and cents(0) returns 0. The agent runs the checks and preserves the tests and unrelated files.
Read the starting files and project instructions
AGENTS.md
Read relevant source before editing. Run node check.mjs from the project root after changes. Do not modify check.mjs or unrelated.txt.
price.mjs
export function cents(value) { return Math.floor(value * 100); }check.mjs
import assert from "node:assert/strict";
import { cents } from "./price.mjs";
assert.equal(cents(1.005), 101);
assert.equal(cents(12.345), 1235);
assert.equal(cents(0), 0);
console.log("price checks passed");Each workspace also contains unrelated.txt with existing user work that must be preserved.
-
Turn 1 / Tools chosen by the agent
listTool input
{ "path": null } -
Turn 2 / Tools chosen by the agent
Results the model received from the previous turn (1)
[ { "id": "call_v05iiqKe49pTOz9KW4OkXO29", "tool": "list", "ok": true, "value": { "path": "<workspace>", "entries": [ { "name": ".git", "kind": "directory" }, { "name": "AGENTS.md", "kind": "file" }, { "name": "check.mjs", "kind": "file" }, { "name": "price.mjs", "kind": "file" }, { "name": "unrelated.txt", "kind": "file" } ], "truncated": false } } ]readTool input
{ "maxLines": 200, "path": "price.mjs", "startLine": 1 }readTool input
{ "maxLines": 400, "path": "check.mjs", "startLine": 1 } -
Turn 3 / Tools chosen by the agent
Results the model received from the previous turn (2)
[ { "id": "call_LgZpjUu3hRUJtmdF4BYzGyDB", "tool": "read", "ok": true, "value": { "path": "<workspace>/price.mjs", "content": "export function cents(value) { return Math.floor(value * 100); }\n", "startLine": 1, "endLine": 2, "totalLines": 2, "truncated": false } }, { "id": "call_00nNQ7ijZnBePB71s9qqV6iE", "tool": "read", "ok": true, "value": { "path": "<workspace>/check.mjs", "content": "import assert from \"node:assert/strict\";\nimport { cents } from \"./price.mjs\";\nassert.equal(cents(1.005), 101);\nassert.equal(cents(12.345), 1235);\nassert.equal(cents(0), 0);\nconsole.log(\"price checks passed\");\n", "startLine": 1, "endLine": 7, "totalLines": 7, "truncated": false } } ]writeTool input
{ "content": "function toPlainString(value) {\n const text = String(value);\n if (!text.includes(\"e\")) return text;\n\n const [coefficient, exponentText] = text.split(\"e\");\n const exponent = Number(exponentText);\n const negative = coefficient.startsWith(\"-\");\n const unsigned = negative ? coefficient.slice(1) : coefficient;\n const [whole, fraction = \"\"] = unsigned.split(\".\");\n const digits = whole + fraction;\n const decimalIndex = whole.length + exponent;\n\n let plain;\n if (decimalIndex <= 0) {\n plain = `0.${\"0\".repeat(-decimalIndex)}${digits}`;\n } else if (decimalIndex >= digits.length) {\n plain = `${digits}${\"0\".repeat(decimalIndex - digits.length)}`;\n } else {\n plain = `${digits.slice(0, decimalIndex)}.${digits.slice(decimalIndex)}`;\n }\n\n return negative ? `-${plain}` : plain;\n}\n\nexport function cents(value) {\n if (!Number.isFinite(value)) return value;\n\n const plain = toPlainString(Math.abs(value));\n const [whole, fraction = \"\"] = plain.split(\".\");\n const centsDigits = (fraction + \"00\").slice(0, 3);\n let cents = BigInt(whole) * 100n + BigInt(centsDigits.slice(0, 2));\n\n if (centsDigits[2] >= \"5\") cents += 1n;\n\n const result = Number(cents);\n return value < 0 ? -result : result;\n}\n", "path": "price.mjs" } -
Turn 4 / Tools chosen by the agent
Results the model received from the previous turn (1)
[ { "id": "call_xDBkU9hEaU4kkz62aMvP0Qqg", "tool": "write", "ok": true, "value": { "path": "<workspace>/price.mjs", "bytes": 1214 } } ]bashTool input
{ "command": "node check.mjs", "cwd": "<workspace>", "timeoutMs": 30000 } -
Turn 5 / Agent’s final answer
Results the model received from the previous turn (1)
[ { "id": "call_yXCoGjFqyswTNmdBlkkw487j", "tool": "bash", "ok": true, "value": { "cwd": "<workspace>", "stdout": "price checks passed\n", "stderr": "", "exitCode": 0, "signal": null, "timedOut": false, "truncated": false } } ]Fixed `price.mjs` so `cents()` now rounds monetary values correctly instead of flooring them, handling cases like `1.005 -> 101` and `12.345 -> 1235`. I verified the change by running `node check.mjs`, and it passed (`price checks passed`).
Independent check: price checks passed · 0 compactions
Implement a greeting from project instructionsPassed ↗
Task given to the agent
Implement greet(name) in src/greet.mjs using the project instructions already supplied. Read and edit only greet.mjs, then verify by running exactly node ../check.mjs. Do not reread AGENTS.md or inspect the test file. Preserve existing tests and unrelated files.
Starting workspace
The agent starts in src/. greet() always returns “hello”. Root and local AGENTS.md instructions must be present in its first model request. The local instructions specify the greeting format.
What success looks like
Using the supplied instructions, the agent reads and edits only greet.mjs, then runs node ../check.mjs successfully on the first attempt. It must not reread guidance or inspect tests. greet(" Ada ") returns "Ahoy, Ada!" and a blank name returns "Ahoy, friend!".
Read the starting files and project instructions
AGENTS.md
Read relevant source before editing. Run node check.mjs from the project root after changes. Do not modify check.mjs or unrelated.txt.
src/AGENTS.md
Greeting format is exactly "Ahoy, <trimmed name>!". Empty names use "friend". Run node ../check.mjs to verify.
src/greet.mjs
export function greet(name) { return "hello"; }check.mjs
import assert from "node:assert/strict";
import { greet } from "./src/greet.mjs";
assert.equal(greet(" Ada "), "Ahoy, Ada!");
assert.equal(greet(" "), "Ahoy, friend!");
console.log("greeting checks passed");Each workspace also contains unrelated.txt with existing user work that must be preserved.
-
Turn 1 / Tools chosen by the agent
readTool input
{ "maxLines": 200, "path": "greet.mjs", "startLine": 1 } -
Turn 2 / Tools chosen by the agent
Results the model received from the previous turn (1)
[ { "id": "call_PcqCek3WuiurS7tAHr3pZP4n", "tool": "read", "ok": true, "value": { "path": "<workspace>/src/greet.mjs", "content": "export function greet(name) { return \"hello\"; }\n", "startLine": 1, "endLine": 2, "totalLines": 2, "truncated": false } } ]editTool input
{ "newText": "export function greet(name) {\n const trimmed = typeof name === \"string\" ? name.trim() : \"\";\n return `Ahoy, ${trimmed || \"friend\"}!`;\n}\n", "oldText": "export function greet(name) { return \"hello\"; }\n", "path": "greet.mjs" } -
Turn 3 / Tools chosen by the agent
Results the model received from the previous turn (1)
[ { "id": "call_LlqE7SsFzHJ7uUx75vf1Ush5", "tool": "edit", "ok": true, "value": { "path": "<workspace>/src/greet.mjs", "bytes": 137 } } ]bashTool input
{ "command": "node ../check.mjs", "cwd": "<workspace>/src", "timeoutMs": 300000 } -
Turn 4 / Agent’s final answer
Results the model received from the previous turn (1)
[ { "id": "call_aOVdWkPGYxzJCcyf2KO0FCqH", "tool": "bash", "ok": true, "value": { "cwd": "<workspace>/src", "stdout": "greeting checks passed\n", "stderr": "", "exitCode": 0, "signal": null, "timedOut": false, "truncated": false } } ]Implemented `greet(name)` in `src/greet.mjs` to return `Ahoy, <trimmed name>!` and fall back to `Ahoy, friend!` for empty or missing names. Verified with `node ../check.mjs` — greeting checks passed.
Independent check: greeting checks passed · 0 compactions
Read a code using nested instructionsPassed ↗
Task given to the agent
Read src/code.txt first, then report its content according to project conventions. Do not edit any files.
Starting workspace
The agent starts in the project root. The requested file is inside src/, which has its own AGENTS.md. The agent must discover those instructions before reading the code.
What success looks like
The agent reads src/AGENTS.md in an earlier turn than src/code.txt and answers "Scoped code: cobalt". It uses only read, list, and search, leaving every file unchanged.
Read the starting files and project instructions
AGENTS.md
Read relevant source before editing. Run node check.mjs from the project root after changes. Do not modify check.mjs or unrelated.txt.
src/AGENTS.md
Report codes from this directory with the prefix "Scoped code: ".
src/code.txt
cobalt
check.mjs
import assert from "node:assert/strict";
import { readFileSync } from "node:fs";
assert.equal(readFileSync("src/code.txt", "utf8"), "cobalt\n");
console.log("guidance checks passed");Each workspace also contains unrelated.txt with existing user work that must be preserved.
-
Turn 1 / Tools chosen by the agent
readTool input
{ "maxLines": 200, "path": "src/AGENTS.md", "startLine": 1 } -
Turn 2 / Tools chosen by the agent
Results the model received from the previous turn (1)
[ { "id": "call_9cNnnAVopsMO2Uz3J0BcHD3V", "tool": "read", "ok": true, "value": { "path": "<workspace>/src/AGENTS.md", "content": "Report codes from this directory with the prefix \"Scoped code: \".\n", "startLine": 1, "endLine": 2, "totalLines": 2, "truncated": false } } ]readTool input
{ "maxLines": 200, "path": "src/code.txt", "startLine": 1 } -
Turn 3 / Agent’s final answer
Results the model received from the previous turn (1)
[ { "id": "call_BhOTktSzd8AQeCGwtdIUdLpF", "tool": "read", "ok": true, "value": { "path": "<workspace>/src/code.txt", "content": "cobalt\n", "startLine": 1, "endLine": 2, "totalLines": 2, "truncated": false } } ]Scoped code: cobalt
Independent check: guidance checks passed · 0 compactions
Recover from a missing configuration filePassed ↗
Task given to the agent
Read legacy-config.json first. If it is missing, locate the current JSON configuration. Change retries to 3 without changing other settings. Keep existing tests and unrelated files unchanged, and run the checks.
Starting workspace
The agent starts in the project root. legacy-config.json does not exist. The actual configuration is config/current.json, with retries set to 0.
What success looks like
After the missing-file error, the agent locates the current configuration, changes only retries to 3, and runs the checks. The conversation also compacts during this run.
Read the starting files and project instructions
AGENTS.md
Read relevant source before editing. Run node check.mjs from the project root after changes. Do not modify check.mjs or unrelated.txt.
config/current.json
{"retries":0,"region":"us-east-1","notes":"Keep this exact note."}check.mjs
import assert from "node:assert/strict";
import { readFileSync } from "node:fs";
const config = JSON.parse(readFileSync("config/current.json", "utf8"));
assert.deepEqual(config, { retries: 3, region: "us-east-1", notes: "Keep this exact note." });
console.log("config checks passed");Each workspace also contains unrelated.txt with existing user work that must be preserved.
-
Turn 1 / Tools chosen by the agent
readTool input
{ "maxLines": 200, "path": "legacy-config.json", "startLine": 1 } -
Turn 2 / Tools chosen by the agent
Results the model received from the previous turn (1)
[ { "id": "call_yQxNmu89IC7OOOiijBjDXz96", "tool": "read", "ok": false, "error": { "code": "ENOENT", "message": "ENOENT: no such file or directory, open '<workspace>/legacy-config.json'" } } ]bashTool input
{ "command": "find . -name AGENTS.md -o -name '*.json' | sort", "cwd": "<workspace>", "timeoutMs": 30000 } -
Turn 3 / Tools chosen by the agent
Results the model received from the previous turn (1)
[ { "id": "call_prXjscbXlb7Qd25FFsRIl6oW", "tool": "bash", "ok": true, "value": { "cwd": "<workspace>", "stdout": "./AGENTS.md\n./config/current.json\n", "stderr": "", "exitCode": 0, "signal": null, "timedOut": false, "truncated": false } } ]readTool input
{ "maxLines": 200, "path": "config/AGENTS.md", "startLine": 1 } -
Turn 4 / Tools chosen by the agent
Results the model received from the previous turn (1)
[ { "id": "call_qwU389xYdv1oLmP5yZG5ZKRk", "tool": "read", "ok": false, "error": { "code": "ENOENT", "message": "ENOENT: no such file or directory, open '<workspace>/config/AGENTS.md'" } } ]readTool input
{ "maxLines": 200, "path": "config/current.json", "startLine": 1 } -
Turn 5 / Tools chosen by the agent
Results the model received from the previous turn (1)
[ { "id": "call_N8cpaIcGKGiBFRC3RWQfxRCe", "tool": "read", "ok": true, "value": { "path": "<workspace>/config/current.json", "content": "{\"retries\":0,\"region\":\"us-east-1\",\"notes\":\"Keep this exact note.\"}\n", "startLine": 1, "endLine": 2, "totalLines": 2, "truncated": false } } ]editTool input
{ "newText": "{\"retries\":3,\"region\":\"us-east-1\",\"notes\":\"Keep this exact note.\"}", "oldText": "{\"retries\":0,\"region\":\"us-east-1\",\"notes\":\"Keep this exact note.\"}", "path": "config/current.json" } -
Turn 6 / Tools chosen by the agent
Results the model received from the previous turn (1)
[ { "id": "call_SqGCx4VZyDHen9kZ3Pdli9yI", "tool": "edit", "ok": true, "value": { "path": "<workspace>/config/current.json", "bytes": 67 } } ]bashTool input
{ "command": "node check.mjs", "cwd": "<workspace>", "timeoutMs": 300000 } -
Turn 7 / Tools chosen by the agent
Results the model received from the previous turn (1)
[ { "id": "call_DcJrl544CE3z94H5BxRHKvYQ", "tool": "bash", "ok": true, "value": { "cwd": "<workspace>", "stdout": "config checks passed\n", "stderr": "", "exitCode": 0, "signal": null, "timedOut": false, "truncated": false } } ]readTool input
{ "maxLines": 20, "path": "config/current.json", "startLine": 1 } -
Turn 8 / Tools chosen by the agent
Results the model received from the previous turn (1)
[ { "id": "call_TG6Jifpis78ghoeTY2iLyMcW", "tool": "read", "ok": true, "value": { "path": "<workspace>/config/current.json", "content": "{\"retries\":3,\"region\":\"us-east-1\",\"notes\":\"Keep this exact note.\"}\n", "startLine": 1, "endLine": 2, "totalLines": 2, "truncated": false } } ]readTool input
{ "maxLines": 20, "path": "config/current.json", "startLine": 1 } -
Turn 9 / Agent’s final answer
Results the model received from the previous turn (1)
[ { "id": "call_nrcVNdoQxKRr9vRG6aVEsgNP", "tool": "read", "ok": true, "value": { "path": "<workspace>/config/current.json", "content": "{\"retries\":3,\"region\":\"us-east-1\",\"notes\":\"Keep this exact note.\"}\n", "startLine": 1, "endLine": 2, "totalLines": 2, "truncated": false } } ]Done — `legacy-config.json` was missing, so I updated `config/current.json` instead. I changed `retries` from `0` to `3` and left the other settings unchanged. Checks run: `node check.mjs` ✅ (`config checks passed`) No unrelated files or tests were modified.
Independent check: config checks passed · 8 compactions
To run these tasks yourself, see the evaluation script. Live evaluations make paid model calls.
Subagent delegation
This example gives a parent agent two words, red and missing. It delegates each word to a child agent, then combines their answers.
Each child counts and uppercases its word. The uppercase tool deliberately fails on missing; that child reports the error and finishes. The recorded history connects both children to the parent’s calls.
The decisions are scripted and the tools execute locally. This example demonstrates composition and error handling without calling a model.