Skip to content

v0.3.2 (beta)

Pre-release
Pre-release

Choose a tag to compare

@github-actions github-actions released this 10 Oct 10:51
d84b65f

thunc 0.3.2 makes agent runs on the Claude API steadier, and a trace that can't be written no longer costs the answer. Two fixes from a stability review of 0.3.1; nothing else is new.

pip install --upgrade "thunc[watch]"

Fixed

  • An error the Claude API sends mid-reply is retried when asking again may fix it. An overloaded, rate-limit, timeout or server error that arrives while a reply streams comes with the stream's HTTP status, 200, so thunc took it for a permanent error and the agent run failed. It's now retried like the same error arriving before the reply: twice, with a pause, as the docs say. A bad request, a bad key or a billing error still fails at once (#68).
  • A trace file that can't be written warns instead of failing the call. With trace= or THUNC_TRACE naming a folder that doesn't exist or a read-only file, every call and agent run raised the file's error: a successful call lost its answer, already paid for, and a failed one hid its own error. Now thunc warns once per path, and the call returns its value or raises its own error (#68).

Measured (the same harness on 0.3.1 and 0.3.2, with only the API client or backend scripted)

0.3.1 0.3.2
10-step agent runs that finish, 5% of requests failing mid-reply 58.9% 99.9%
The same, 10% failing 33.4% 98.8%
Calls and runs with an unwritable trace that end as with tracing off 0/20 20/20
Time per call with a working trace 42.5–43.4 µs 40.9–44.5 µs (no change)

Tested

  • Offline tests run on Python 3.10–3.14 on Ubuntu, and on Windows, with 12 new tests for these fixes: errors sent mid-reply, in the shape the SDK raises them, retried or not by their type, and calls and agent runs with a trace path that can't be written.

Behavior changes

  • An agent run on the Claude API that met an overloaded, rate-limit, timeout or server error mid-reply now retries the step, so it can take a little longer instead of failing.
  • A trace file that can't be written is a RuntimeWarning, once per path, instead of an OSError from the call. To make it an error again, turn the warning into one with warnings.filterwarnings("error", "thunc could not write the trace").
  • thunc-watch stays at 0.1.0.

Full changelog: v0.3.1...v0.3.2