# Live runs

gvn has driven real models from three vendors in five recorded sessions of small tasks,
through its three model adapters (the modules that connect gvn to a vendor's service). The
table gives each session's result; it needs no prior reading. Every check looked at
structure or at the world after the run (files, commits, the journal, usage figures), never
at the model's wording.

## Summary

| Session | Model, and the adapter it ran through | What was exercised | Result | Cost |
|---|---|---|---|---|
| [2026-11-17: a coding agent](#2026-11-17-a-coding-agent-with-claude-haiku) | `claude-haiku-5-5`, `AnthropicModel` | Fixing a one-line bug with real file, shell and git tools, waiting for a person's approval, committing; a crash after the commit, recovered from a SQLite journal; no secrets visible to programs | 9 of 9 (three tests, run three times) | about $0.0014 per fix-and-commit run, about $0.0018 for the crash run |
| [2026-11-17, later: caching, carried thinking, per-call approval](#2026-11-17-later-caching-carried-thinking-and-per-call-approval) | `claude-haiku-5-5`, `AnthropicModel` | The same task with prompt caching, thinking carried between tool rounds, approval per call and every effort level | 18 of 18 (six tests, run three times) | about $0.00036 for a fix-and-commit run with a warm cache, about a quarter of its uncached price |
| [2026-11-17: the first OpenAI run](#2026-11-17-the-first-openai-run) | `gpt-5.4-nano`, `OpenAIModel` | Thirteen checks: replies, streaming, tool rounds through an agent, effort levels, carried reasoning, failures, caching | 39 of 39 (thirteen checks, run three times), after the adapter moved to the Responses API | about $0.002 to $0.003 per run of all thirteen |
| [2026-11-17: structured answers, images, PDFs and choices](#2026-11-17-structured-answers-images-pdfs-and-choices) | `claude-haiku-5-5` and `gpt-5.4-nano` | A nested structured answer, an answer after a tool round, a model-backed choice about an image, a PDF, and page citations on Anthropic | 15 of 15 on Anthropic and 12 of 12 on OpenAI, each module run three times | about $0.0007 for the first Anthropic run and $0.0002 for each later one; about $0.00045 per OpenAI run |
| [2026-11-19: the first DeepSeek run](#2026-11-19-the-first-deepseek-run-through-chat-completions) | `deepseek-flash`, `ChatCompletionsModel` | Seven checks: a streamed reply, tool rounds with reasoning carried back, cached input, a structured answer, a bad key | 7 of 7 on the first attempt; the service refused the structured-answer request, and gvn reported that as a failure that is not retryable | not recorded on this page |

The sessions also changed the framework: a reply's tool calls now run in order, token usage
is recorded with every model reply, and the OpenAI adapter speaks the Responses API. Each
session below gives its setup, its results and cost, and its findings.

**For the sessions below, read first:** the [reference agent](../concepts/reference-agent.md),
the [Governor](../concepts/governor.md) and the [tools](../tools/index.md) it used.

**Time:** about 2 minutes for the summary, about 5 for the page.

## Where this sits

Everything else on this site runs on scripted fakes. This page records runs in which the
fakes at the edge of the [loop](../concepts/index.md#picture-1-the-loop-that-runs) were
replaced by real things: a vendor's model through its adapter (the outermost ring of the
[layers picture](../concepts/index.md#picture-2-the-layers-of-code)), real tools from
[gvn-tools](../tools/index.md), a journal in SQLite, and the system clock. The machine, the
Governor and the fulfillers were the same code the offline tests use.

## The shape of it

```mermaid
flowchart LR
    governor["Governor<br/>(unchanged)"]
    agent["reference agent<br/>(unchanged)"]
    model["AnthropicModel or OpenAIModel<br/>→ the vendor's live service"]
    tools["real file, shell and git tools<br/>on a temporary repository"]
    journal[("SQLite journal")]
    tester(["the test, as the person<br/>who approves"])
    governor <--> agent
    governor --> model
    governor --> tools
    governor --> journal
    tester -- "approved or denied" --> governor
```

The first four sessions took place on 2026-11-17. The fifth added DeepSeek on 2026-11-19:

1. **A coding agent with Claude Haiku:** a real model fixed a one-line bug, waited for a
   person's approval, committed, and survived a crash. It changed two things in the
   framework.
2. **Caching, carried thinking and per-call approval:** the same runs after the changes the
   first session led to.
3. **The first OpenAI run:** the OpenAI adapter's first contact with the live service, what
   it found and how the adapter changed.
4. **Structured answers, images, PDFs and choices:** on both vendors.
5. **DeepSeek through Chat Completions:** tool rounds, carried reasoning, cache usage, and
   a structured-output request the service rejected.

Each session gives its setup, its results and cost, and its findings, in that order.

## How to read this page

- Each run has a **setup** (model, runtime, tools, task), **results** (what passed, how many
  model replies and tokens it took, and the cost at the stated prices) and **findings** (what
  it changed or taught).
- The tests checked the *world* after the run (files, commits, the journal), not what the
  model said about its work.
- Each **Running it yourself** command runs tests that are part of gvn's repository, so it
  needs a clone of the repository and your own API key.

## 2026-11-17: a coding agent with Claude Haiku

This is the first session, before the changes it led to. The
[second session](#2026-11-17-later-caching-carried-thinking-and-per-call-approval), later the
same day, reran it after those changes.

### Setup

- **Model:** `claude-haiku-5-5`, through `AnthropicModel` and the Governor.
- **Runtime:** a SQLite journal and the real system clock.
- **Tools:** the real [file](../tools/files.md), [shell](../tools/shell.md) and
  [git](../tools/git.md) tools on a temporary repository with its own HOME and no global or
  system git configuration. `run_command` allowed only `python3`; git allowed status, diff and
  commit, no push. The policy was the three families' `rules()` merged.
- **The task:** a one-line bug (`average` dividing by `len + 1`) and a failing unittest.
- **Approvals:** `python3` was deliberately **not** listed as `quiet` (the shell rules'
  list of programs that run without asking; see [Shell](../tools/shell.md)), because an
  interpreter runs
  arbitrary code, so every `run_command` waited for a person. The test was that person: it
  approved running a module and would have denied inline code (`-c`).

### Results

Three tests, run three times: **9 of 9 passed**, about 13 seconds per run of all three.

**(a) Fix and commit.** 4 model replies, about 11,470 input and 455 output tokens: about
$0.0014 per run at $0.10 and $0.50 per million input and output tokens. The path was the same
every time:

1. read both files, in one reply;
2. `edit_file` and `run_command`, in one reply, which waited for approval as one batch;
3. `git_commit`;
4. the answer.

The test checked the world, not the model's words:

- the unittest passes when the test runs it itself;
- exactly one new commit, by the configured identity, touching only `calc.py`;
- `.git/config` is byte-identical, and nothing outside the workspace changed;
- the final state is `completed`, and the journal replays to the same state and outcome;
- the evaluation `Finishes("completed")`, `Gated([run_command])` (the shell tool),
  `Visits("awaiting_approval")` passes: the run finished in `completed`, no `run_command`
  ran without a person's approval, and the agent did wait for approval (these checks are
  explained in [Replay and evaluation](../guides/replay-and-evaluation.md)).

**(b) A crash after the commit.** The process died after the commit happened but before the
journal recorded it, and the run was recovered from SQLite with a new Governor. The re-issued
`git_commit` returned the same commit id with `created: false`, and there was exactly one
commit. 5 model replies, about 15,000 input and 630 to 780 output tokens: about $0.0018.

**(c) No secrets in programs.** A program run by `run_command` saw no `ANTHROPIC*` variable.

### Findings

- **The Anthropic adapter needed no change** on its first live call: streaming, tool-use turns
  and usage all worked.
- **The model puts dependent calls in one reply.** In every run it put the edit and the test
  run that depends on it in the same reply, even when instructed not to. That is why the calls
  of a reply now [run in order](../concepts/governor.md#the-order-of-a-replys-tool-calls);
  before the change, the run passed only by timing.
- **A retried call looks suspicious to the model.** After recovery the model treated
  `created: false` with suspicion and spent one or two extra read calls checking. A model
  cannot know its call was retried; the tool's description now explains it.
- **Usage was not recorded anywhere before this run.** It now is, in every `model_replied`
  event (see [What the runs cost](../guides/replay-and-evaluation.md#step-3-what-the-runs-cost)).
- **Input tokens are dominated by tool descriptions,** which are sent again on every call.

### Running it yourself

It needs `ANTHROPIC_API_KEY` and costs well under a cent per test:

```bash
uv run --env-file .env pytest packages/gvn-tools/tests/live -m live -o addopts="" -s
```

The test is `packages/gvn-tools/tests/live/test_live_coding_agent.py`; it is marked `live` and
left out of the default run.

## 2026-11-17, later: caching, carried thinking and per-call approval

Three changes followed the first session the same day: prompt caching (the vendor reuses an
unchanged prompt prefix at a lower price), thinking (the model's own reasoning blocks)
carried between tool rounds, and verdicts and approvals per call. All
three are explained in [Using a vendor model](../guides/vendors.md) and
[the reference agent](../concepts/reference-agent.md#one-verdict-per-call).
Effort (how much the model reasons before it answers) became a setting of the adapter. The live tests were then extended and run again.

### Setup

The same model, runtime, tools, task and policy as the first session, with the adapter's
defaults: caching on and no effort level set. Three tests were added to the three before:

- **Carried thinking:** a reply that thinks and calls a tool, sent back with its thinking
  across a tool round.
- **A cache check:** a run on the full toolbox, three model calls, checking that the later
  calls read the prompt's prefix from the cache.
- **Effort:** one small call at every effort level.

### Results

Six live tests, run three times: **18 of 18 passed**, about 23 seconds per run of all six.

Costs use the same Haiku list prices as before, with the cache's own prices for the tokens
read from and written to it. "Warm" means the cache already held the prompt from an earlier
run; "cold" means it did not.

| Test | Model replies | Input tokens | Read from the cache | Output tokens | Cost | Uncached price |
|---|---|---|---|---|---|---|
| fix and commit, warm | 4 | about 11,470 | about 11,330 | about 455 | about $0.00036 | $0.00138 |
| fix and commit, cold | 4 | about 11,470 | 8,223 read, 3,239 written | about 455 | about $0.00072 | $0.00138 |
| crash and recover | 5 | about 15,000 | about 14,570 | – | about $0.00055 | $0.00185 |
| cache check, full toolbox, warm | 3 | 10,806 | 10,798 | – | $0.00015 | $0.00112 |

A dash marks a figure not recorded here. "Input tokens" counts every input token, cached or
not (see
[usage](../guides/vendors.md#what-a-call-cost-usage)). A warm fix-and-commit run cost about a
quarter of its uncached price.

The other checks:

- **Per-call approval.** The model still put the edit and the test run in one reply. The
  approver is now asked only about `run_command`; the `edit_file` beside it is cleared and is
  no longer part of the question.
- **Carried thinking.** Thinking sent back across a tool round was accepted by the API.
- **Effort.** Haiku accepted every effort level: `low`, `medium`, `high`, `xhigh` and `max`.
- **Thinking in the coding runs.** At its default effort, Haiku did not think in the coding
  runs, so those runs carried no thinking.

## 2026-11-17: the first OpenAI run

The OpenAI adapter's first contact with the live service. A first run found a defect that
made the adapter unusable for the normal agent shape; the adapter was moved to another
OpenAI API, and the tests were run again.

### Setup

- **Model:** `gpt-5.4-nano`, the smallest current OpenAI chat model with tool calling, through
  `OpenAIModel`, mostly with `effort="low"` and `max_tokens=600`.
- **The tests:** `packages/gvn/tests/live/test_live_openai.py`, thirteen small checks with
  tiny prompts: a plain reply, streaming, a tool round trip through an agent under a
  Governor, two tool calls in one reply, every effort level, tools together with an effort,
  reasoning carried between tool rounds, the token limit, a bad model id, an invalid request,
  a bad key, a conversation that closes itself, and caching on a repeated 3,300-token prompt.
- **What is checked:** structure, never wording: usage figures, call ids, counts, the agent's
  final state, and how each failure is reported.

### The first run, and what it found

The adapter then spoke OpenAI's **Chat Completions** API. Twelve checks passed, and four
findings came out of them:

1. **Tools and effort together were refused.** Any request with function tools and an effort
   other than `none` failed with HTTP 400. The service's message said why: function tools
   with a reasoning effort are not supported on that model in Chat Completions, and to use
   the Responses API instead. An agent with tools and `effort="low"` could not make a single
   call.
2. **The service's message was dropped.** Every 400 was reported as "the model service
   rejected the request as invalid (400)", without the message above, which was the only
   diagnostic.
3. **The listed effort levels were not all accepted.** `minimal` and `max` were rejected;
   `none`, `low`, `medium`, `high` and `xhigh` were accepted.
4. **Caching worked on its own.** Cached input tokens were reported on repeated prompts, and
   the cache-write figure was always 0.

### What was fixed

- **The adapter now speaks the Responses API** (`POST /responses`), the API the service named.
  Its constructor is unchanged: `OpenAIModel(client=..., model=..., max_tokens=None,
  effort=None)`.
- **Requests are stateless.** Each sends `store: false` and the whole conversation, so gvn's
  journal stays the only record of a run, and a run still replays from it.
- **Reasoning is carried between tool rounds.** OpenAI returns its reasoning encrypted; the
  adapter keeps it as sealed content (kept and returned as is, never read by gvn) and sends it back with the tool results, as it does
  Anthropic's thinking (see
  [Reasoning on OpenAI](../guides/vendors.md#reasoning-on-openai)).
- **Failures quote the service.** A failure's reason now ends with the service's own message,
  on one line, at most 160 characters, with any key redacted.
- **Effort is honest.** The adapter still accepts every level OpenAI documents; the guide
  now says that which levels a model accepts is the service's decision, and a rejection
  names the levels it does accept.

### Results

After the change, the thirteen checks ran three times: **39 of 39 passed**, about 35 seconds
per run of all thirteen. The model replies of one run cost between about $0.002 and $0.003
together at deliberately pessimistic list prices ($0.25 per million input tokens, $0.025
cached, $2.00 output), so under a cent for the three runs.

| Check | What happened |
|---|---|
| tools with an effort | `low` and `medium`, with one tool: each reply made the call. Fixed. |
| tool round trip, agent under a Governor | 2 model replies, the tool called once, the agent `completed` |
| two calls in one reply | 2 calls with distinct ids; both results went back |
| effort levels | `none`, `low`, `medium`, `high`, `xhigh` accepted; `minimal`, `max` rejected, and the reason quoted the service: "Unsupported value: 'max' is not supported with the 'gpt-5.4-nano' model. Supported values are: 'none', 'low', 'medium', 'high', and 'xhigh'." |
| carried reasoning | at `effort="high"`, one reasoning item before the call, kept through a journal round trip and sent back: accepted, about 250 to 340 input tokens with it against about 125 to 165 without. The same item with altered content was rejected (400, "could not be verified"), so the service does read what is carried. |
| token limit | a reply cut off at 40 output tokens is a failure, not retryable |
| invalid request, bad model, bad key | each a failure, not retryable; the reason quoted the service ("No tool call found for function call output with call_id call_orphan."; "The model ... does not exist"); the masked key the service echoes was redacted |
| caching | 3,319 input tokens per call; 2,816 read from the cache on every call after the first; cache writes 0 |

Two observations:

- **One rejection arrived inside the stream.** In one run the invalid request was refused as
  an error event inside an accepted stream rather than as an HTTP 400. Both are reported as
  failures that are not retryable, with the service's message.
- **The model reasoned only when asked to.** At `low` effort the model rarely produced a
  reasoning item, so the carried-reasoning check uses `high`, with a small arithmetic task
  and a `multiply` tool.

### Running it yourself

It needs `OPENAI_API_KEY`, and `GVN_OPENAI_TEST_MODEL` picks another model:

```bash
uv run --env-file .env pytest packages/gvn/tests/live/test_live_openai.py -m live -o addopts="" -s
```

## 2026-11-17: structured answers, images, PDFs and choices

The first live runs of [structured answers](../guides/structured-answers.md),
[model-backed choices](../guides/model-backed-choices.md), attachments and citations, on both
vendors.

### Setup

- **Models:** `claude-haiku-5-5` through `AnthropicModel` (`effort="low"`, `max_tokens=600`)
  and `gpt-5.4-nano` through `OpenAIModel` (`effort="low"`, `max_tokens=1500`).
- **The tests:** `packages/gvn/tests/live/test_live_structured_anthropic.py` (five checks) and
  `test_live_structured_openai.py` (four), sharing their cases in `live_structured_cases.py`:
    - a nested answer: an order with a list of lines (each with an enum colour) and a nested
      shipping record, asked of the model directly through an `Exchange` (what a model is asked:
      instructions, messages, tools) with an answer schema;
    - an agent with `answer=` that must look an order up with a tool first, under a Governor;
    - a [`Choice`](../guides/model-backed-choices.md) (an actor that has a model pick one
      of a fixed set of options) between `red`, `green` and `blue` about a 32-pixel solid red PNG made in code;
    - a one-page PDF made in code ("The secret word is PELICAN."), answered as `{"word": ...}`;
    - Anthropic only: the same PDF with `cited=True` and no answer schema (the two cannot be
      combined), checking that the reply carries page citations.
- **What is checked:** that every answer validates against its schema, that runs end on the
  declared route (`completed`, `chosen`), that the tool ran once, and that citation spans lie
  within the text. The image and PDF checks also assert the obvious answer (`red`,
  `PELICAN`).

### Results

Each module ran three times: **15 of 15** Anthropic checks and **12 of 12** OpenAI checks
passed, all on the first attempt, with no change to the code between runs.

| Check | Anthropic (Haiku 5.5) | OpenAI (gpt-5.4-nano) |
|---|---|---|
| nested answer | valid; 518 input, 79 output tokens | valid; 122 input, 52 output tokens |
| answer after a tool round | `completed`, tool `ok`, `{"status": "shipped", "total": 40.0}` | the same (`"total": 40`) |
| choice about an image | `chosen`, `red`; 294 input tokens | `chosen`, `red`; 75 input tokens |
| PDF answer | `{"word": "PELICAN"}`; 1,817 input tokens | `{"word": "PELICAN"}`; 72 input tokens |
| citations | one `page_location` citation quoting "The secret word is PELICAN." | not run |

Cost at list prices ($0.10/$0.01/$0.50 per million input/cached/output tokens for Haiku 5.5;
a pessimistic $0.25/$0.025/$2.00 for gpt-5.4-nano): about $0.0007 for the first Anthropic run
and $0.0002 for each later one (most input was then read from the cache), and about
$0.00045 per OpenAI run: well under one cent for all six runs together.

Observations:

- **The PDF costs very differently.** Anthropic counted 1,817 input tokens for one page (each
  page is also read as an image); OpenAI counted 72 for the same file with this model.
- **Anthropic's cache took effect on the second run** of the same prompts, including the PDF
  and the schema; OpenAI reported no cached tokens on these short prompts.
- **No refusal, truncation or invalid answer occurred** in these runs.

### Running it yourself

It needs `ANTHROPIC_API_KEY` and `OPENAI_API_KEY` (`GVN_OPENAI_TEST_MODEL` picks another
OpenAI model):

```bash
uv run --env-file .env pytest packages/gvn/tests/live/test_live_structured_anthropic.py -m live -o addopts="" -s
uv run --env-file .env pytest packages/gvn/tests/live/test_live_structured_openai.py -m live -o addopts="" -s
```

## 2026-11-19: the first DeepSeek run, through Chat Completions

The first contact of `ChatCompletionsModel` with a live service. The adapter was written
from the format's documentation and tested against a mock transport; this run checked it
against DeepSeek.

### Setup

- **Model:** `deepseek-flash` at `https://api.deepseek.com`, through
  `ChatCompletionsModel(client, "deepseek-flash", vendor="deepseek")` with `max_tokens=800`.
- **The tests:** `packages/gvn/tests/live/test_live_chat_completions_deepseek.py`, seven
  small checks with tiny prompts: a plain streamed reply, a tool round trip through an agent
  under a Governor with the service's thinking at its default, the same with
  `extra={"thinking": {"type": "disabled"}}`, a second user question after a tool loop, a
  repeated 1,134-token prompt, a structured answer, and a bad key.
- **What is checked:** structure, never wording: usage figures, call ids, counts, the agent's
  final state, and how each failure is reported.

### Results

**7 of 7** checks passed on the first attempt, with no change to the adapter.

| Check | Result |
|---|---|
| plain reply | text streamed; 46 input, 34 output tokens; one sealed reasoning record |
| tool round trip, thinking at its default | `completed`, one tool call; reasoning sealed on the first reply and carried back; 327 then 400 input tokens, 256 of them cached |
| tool round trip, thinking disabled | `completed`, one tool call; no reasoning records |
| a second user question after the tool loop | accepted with every earlier turn's reasoning sent back |
| repeated prompt | cached tokens 0, then 896 and 896 of 1,134 |
| structured answer | refused by the service (HTTP 400, "This response_format type is unavailable now"): a failure that is not retryable, with no second attempt |
| bad key | a failure that is not retryable; the reason quotes the service with the key masked |

Observations:

- **Reasoning is carried as the service needs it.** With thinking on, the reply that calls
  the tool comes with reasoning; the adapter seals it under `"deepseek"` and sends it back
  with that turn, in the tool loop and after a new user question.
- **The cache works without being asked for.** The second call of a repeated prefix already
  read most of its input from the cache, and so did the second round of each tool loop.
- **The strict JSON Schema request was the service's to refuse.** The adapter asked for it,
  the service declined, and the call failed as one that another attempt would not help.

### Running it yourself

It needs `DEEPSEEK_API_KEY` (`GVN_DEEPSEEK_TEST_MODEL` picks another model):

```bash
uv run --env-file .env pytest packages/gvn/tests/live/test_live_chat_completions_deepseek.py -m live -o addopts="" -s
```

## Recap

- One live task (Claude Haiku fixing a one-line bug, with one approval and a commit) passed
  9 of 9 times, for well under a cent per run.
- It changed the framework: a reply's tool calls now run in order, and token usage is
  recorded. Three changes followed: thinking is carried, the prompt is cached, and approvals
  are per call.
- After those changes, six live tests passed 18 of 18 times; a warm fix-and-commit run cost
  about a quarter of its uncached price, and the approver was asked only about `run_command`.
- The OpenAI adapter's first live run found that Chat Completions refuses tools with an
  effort on its small model; the adapter moved to the Responses API, carries encrypted
  reasoning between tool rounds, quotes the service in its failures, and then passed 39 of
  39 checks for under a cent.
- Structured answers, an image, a PDF and a model-backed choice passed on both vendors, 27
  of 27 checks over three runs each, and Anthropic returned page citations, for well under a
  cent in all.
- `ChatCompletionsModel` passed 7 of 7 checks on its first live run, against DeepSeek: tool
  loops with the service's reasoning carried back, cached input reported, and a strict
  schema request the service refused reported as a failure.

**Next:** [Stability](stability.md), how gvn versions its stored data and its public API. To build this run yourself, see the [coding agent guide](../guides/coding-agent.md).
