Skip to content

v0.2.2 (beta)

Pre-release
Pre-release

Choose a tag to compare

@Eltarras Eltarras released this 05 Oct 06:47
· 106 commits to main since this release
0181182

thunc 0.2.2 makes agents use their tools reliably, especially on Claude Code, and makes calls faster. Agents on Claude Code now make native tool calls instead of writing each action as JSON text, a failed step is retried instead of ending the run, and the agent's tools fill gaps that a new tool-use benchmark found.

8 tool-heavy tasks, Claude Sonnet 5.5 Passed Seconds per task $ per task
thunc 0.2.1 agents on Claude Code 12/24 99 0.084
thunc 0.2.2 agents on Claude Code 24/24 10 0.022
Claude Code itself, for reference 24/24 11 0.069

On Claude Opus 5.5 both versions passed every task, but 0.2.2 took 15 seconds and $0.051 a task instead of 44 seconds and $0.264.

pip install --upgrade thunc
import thunc

thunc.configure(backend="claude-code")  # agents now make native tool calls here
fixer = thunc.Agent("fixer", workdir=".", permissions=["write:src/**", "run:pytest"])


@fixer.task
def make_tests_pass() -> str:
    """Run the tests in services/api and fix what fails. Say what you changed."""
    ...


run = fixer.run(make_tests_pass)  # run.commands, run.files_changed, and any retries in run.session
thunc run --profile my_script.py  # where the time went: model time, thunc's own, per tool

Agents on Claude Code make native tool calls (#46)

  • The agent's tools are an MCP server that one claude -p process per run calls, and thunc carries out each call with its own tools, permissions and run record. Before, the model wrote each action as JSON text. Current models slip back into their trained tool calls: they invented tool results and ran on to the timeout, or the CLI refused a tool call it couldn't parse.
  • Calls from one model reply count as one step. A turn without a tool call gets a nudge, and a turn that ends in an error gets a second chance, both in the same session.
  • Fallback: with a claude CLI too old for these options, or with MCP servers turned off by a policy, a run falls back to the text protocol with a warning. protocol="native" raises instead, and protocol="text" keeps the old way.
  • The CLI runs in the agent's workdir, so the environment details it adds to the prompt name the right folder.

Steadier runs (#46)

  • A failed step is retried twice before the run fails, and each retry is logged in the run record. This covers timeouts, lost connections, rate limits, server errors and CLI calls that end in an error (thunc.errors.TransientError). Before, one bad call ended the run.
  • A text-protocol step on Claude Code or Codex now times out after 120 seconds instead of the whole 300-second timeout.

Better tools for agents (#46)

  • run takes cwd: a folder inside workdir to run the command in.
  • The shell permission (opt-in) runs command lines through the system shell, so pipes, &&, cd and redirects work. It can't be combined with !run: rules, since a shell command line can't be checked word by word.
  • search takes glob: *.py matches by file name, src/**/*.ts by path.
  • Git-aware list and search: in a git repository they leave out what git ignores, so a stale build/ copy no longer crowds out the real source.
  • Long command output keeps its start and its end, so an agent sees the first error as well as the summary.

Faster calls (#45)

  • The anthropic and openai backends reuse their connections: one SDK client per process instead of a new TCP and TLS handshake each call. In a local benchmark with 60 ms of connection setup, 20 calls in a row went from 1.47 s to 68 ms.
  • Text-protocol agents can act several times per reply (Codex and protocol="text"), with a JSON array of independent actions. On Codex, the prompt eval took fewer replies (fix / review / analysis: 6.0 / 4.8 / 5.0 → 5.0 / 3.0 / 3.6) and less time (37 / 27 / 27 s → 29 / 19 / 21 s).
  • The codex backend returns as soon as the answer arrives, without waiting about 0.4 s for Codex to shut down.
  • thunc run --profile SCRIPT (or -m module) reports where a program's time went, per function: calls, cache hits, retries, failures, model time against thunc's own, and time per tool for agents. python -m benchmarks runs a dependency-free benchmark suite.

Tested

  • Offline tests run on Python 3.10–3.14 on Ubuntu, and on Windows. Temporal integration tests run on Python 3.10 and 3.14.
  • The MCP path has an end-to-end test with a fake claude that starts the real tool server, covering parallel and serial calls, permissions, errors and the fallback.
  • Live: the tool-use benchmark (live_tests/bench_tooluse.py, with its report in live_tests/bench_tooluse_report.md) on Sonnet 5.5 and Opus 5.5, the prompt eval on Claude Code (45/45), and the live tests on Claude Code.
  • The agent loops on the Claude and OpenAI APIs haven't had a live tool-use benchmark yet.

Behavior changes

  • Agents on claude-code make native tool calls by default, and fall back to the text protocol if they can't.
  • In a git repository, list and search leave out what git ignores. A folder named explicitly is still listed and searched.
  • Long command output keeps its start as well as its end.
  • The claude-code backend loads none of your Claude Code settings (--setting-sources ""). No CLAUDE.md, settings or hooks reach thunc's calls, plain function calls included, so a folder you point an agent at can't instruct it unless you pass follow=.
  • Durable runs on Claude Code still use the text protocol.
  • Nothing is removed.

Still beta: expect bugs, and the API may change. Known issues are listed in CONTRIBUTING.md, and every change is in CHANGELOG.md.

Full changelog: v0.2.1...v0.2.2