# 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.

[Back to the agent overview](https://tubeless.io/agent-harness.md).

## 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. Recorded 2026-10-01T14:47:49.831Z, model gpt-5.4-mini, reasoning high. Browsing them makes no model calls.

### Fix cents rounding

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.

Starting file: AGENTS.md

```text
Read relevant source before editing. Run node check.mjs from the project root after changes. Do not modify check.mjs or unrelated.txt.
```

Starting file: price.mjs

```text
export function cents(value) { return Math.floor(value * 100); }
```

Starting file: check.mjs

```text
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");
```

Result: passed; 5 turns. Independent check: price checks passed.

### Implement a greeting from project instructions

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!".

Starting file: AGENTS.md

```text
Read relevant source before editing. Run node check.mjs from the project root after changes. Do not modify check.mjs or unrelated.txt.
```

Starting file: src/AGENTS.md

```text
Greeting format is exactly "Ahoy, <trimmed name>!". Empty names use "friend". Run node ../check.mjs to verify.
```

Starting file: src/greet.mjs

```text
export function greet(name) { return "hello"; }
```

Starting file: check.mjs

```text
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");
```

Result: passed; 4 turns. Independent check: greeting checks passed.

### Read a code using nested instructions

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.

Starting file: AGENTS.md

```text
Read relevant source before editing. Run node check.mjs from the project root after changes. Do not modify check.mjs or unrelated.txt.
```

Starting file: src/AGENTS.md

```text
Report codes from this directory with the prefix "Scoped code: ".
```

Starting file: src/code.txt

```text
cobalt
```

Starting file: check.mjs

```text
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");
```

Result: passed; 3 turns. Independent check: guidance checks passed.

### Recover from a missing configuration file

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.

Starting file: AGENTS.md

```text
Read relevant source before editing. Run node check.mjs from the project root after changes. Do not modify check.mjs or unrelated.txt.
```

Starting file: config/current.json

```text
{"retries":0,"region":"us-east-1","notes":"Keep this exact note."}
```

Starting file: check.mjs

```text
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");
```

Result: passed; 9 turns. Independent check: config checks passed.

[Step through the recorded turns](https://tubeless.io/agent-examples#recorded-run) or [download the recordings](https://tubeless.io/agent-evaluation.json). To run these tasks yourself, see the [evaluation script](https://github.com/chetmancini/tubeless/blob/main/scripts/eval-agent.mjs). 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.

- [Read the example](https://github.com/chetmancini/tubeless/blob/main/examples/agent-delegation.ts)
- [Download the history](https://tubeless.io/agent-delegation.json)
