tuieval 0.2.0.dev164__tar.gz → 0.3.0__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (85) hide show
  1. {tuieval-0.2.0.dev164 → tuieval-0.3.0}/CHANGELOG.md +7 -1
  2. {tuieval-0.2.0.dev164 → tuieval-0.3.0}/PKG-INFO +1 -1
  3. {tuieval-0.2.0.dev164 → tuieval-0.3.0}/docs/agent-packs.md +30 -2
  4. {tuieval-0.2.0.dev164 → tuieval-0.3.0}/docs/writing-packs.md +5 -2
  5. {tuieval-0.2.0.dev164 → tuieval-0.3.0}/src/tuieval/_version.py +2 -2
  6. tuieval-0.3.0/src/tuieval/adapters/__init__.py +1 -0
  7. tuieval-0.3.0/src/tuieval/adapters/pi.py +352 -0
  8. {tuieval-0.2.0.dev164 → tuieval-0.3.0}/src/tuieval/agents.py +14 -4
  9. {tuieval-0.2.0.dev164 → tuieval-0.3.0}/src/tuieval/builtin.toml +12 -2
  10. {tuieval-0.2.0.dev164 → tuieval-0.3.0}/src/tuieval/compare.py +10 -1
  11. {tuieval-0.2.0.dev164 → tuieval-0.3.0}/src/tuieval/engine.py +6 -3
  12. {tuieval-0.2.0.dev164 → tuieval-0.3.0}/src/tuieval/insights.py +20 -11
  13. {tuieval-0.2.0.dev164 → tuieval-0.3.0}/src/tuieval/packs.py +9 -2
  14. {tuieval-0.2.0.dev164 → tuieval-0.3.0}/src/tuieval/tui.py +52 -13
  15. {tuieval-0.2.0.dev164 → tuieval-0.3.0}/src/tuieval/verdict.py +20 -2
  16. {tuieval-0.2.0.dev164 → tuieval-0.3.0}/tests/test_tuieval.py +207 -0
  17. {tuieval-0.2.0.dev164 → tuieval-0.3.0}/.gitignore +0 -0
  18. {tuieval-0.2.0.dev164 → tuieval-0.3.0}/LICENSE +0 -0
  19. {tuieval-0.2.0.dev164 → tuieval-0.3.0}/README.md +0 -0
  20. {tuieval-0.2.0.dev164 → tuieval-0.3.0}/RELEASING.md +0 -0
  21. {tuieval-0.2.0.dev164 → tuieval-0.3.0}/docs/images/brand/README.md +0 -0
  22. {tuieval-0.2.0.dev164 → tuieval-0.3.0}/docs/images/brand/favicon.ico +0 -0
  23. {tuieval-0.2.0.dev164 → tuieval-0.3.0}/docs/images/brand/readme-header.png +0 -0
  24. {tuieval-0.2.0.dev164 → tuieval-0.3.0}/docs/images/brand/social-preview.png +0 -0
  25. {tuieval-0.2.0.dev164 → tuieval-0.3.0}/docs/images/brand/tuieval-icon-1024.png +0 -0
  26. {tuieval-0.2.0.dev164 → tuieval-0.3.0}/docs/images/brand/tuieval-icon-128.png +0 -0
  27. {tuieval-0.2.0.dev164 → tuieval-0.3.0}/docs/images/brand/tuieval-icon-16.png +0 -0
  28. {tuieval-0.2.0.dev164 → tuieval-0.3.0}/docs/images/brand/tuieval-icon-16.svg +0 -0
  29. {tuieval-0.2.0.dev164 → tuieval-0.3.0}/docs/images/brand/tuieval-icon-256.png +0 -0
  30. {tuieval-0.2.0.dev164 → tuieval-0.3.0}/docs/images/brand/tuieval-icon-32.png +0 -0
  31. {tuieval-0.2.0.dev164 → tuieval-0.3.0}/docs/images/brand/tuieval-icon-48.png +0 -0
  32. {tuieval-0.2.0.dev164 → tuieval-0.3.0}/docs/images/brand/tuieval-icon-512.png +0 -0
  33. {tuieval-0.2.0.dev164 → tuieval-0.3.0}/docs/images/brand/tuieval-icon-64.png +0 -0
  34. {tuieval-0.2.0.dev164 → tuieval-0.3.0}/docs/images/brand/tuieval-icon-animated.svg +0 -0
  35. {tuieval-0.2.0.dev164 → tuieval-0.3.0}/docs/images/brand/tuieval-icon.svg +0 -0
  36. {tuieval-0.2.0.dev164 → tuieval-0.3.0}/docs/images/tui-answer-reasoning.png +0 -0
  37. {tuieval-0.2.0.dev164 → tuieval-0.3.0}/docs/images/tui-run-reasoning.png +0 -0
  38. {tuieval-0.2.0.dev164 → tuieval-0.3.0}/docs/images/tui-setup.png +0 -0
  39. {tuieval-0.2.0.dev164 → tuieval-0.3.0}/docs/models.md +0 -0
  40. {tuieval-0.2.0.dev164 → tuieval-0.3.0}/pyproject.toml +0 -0
  41. {tuieval-0.2.0.dev164 → tuieval-0.3.0}/src/tuieval/__init__.py +0 -0
  42. {tuieval-0.2.0.dev164 → tuieval-0.3.0}/src/tuieval/__main__.py +0 -0
  43. {tuieval-0.2.0.dev164 → tuieval-0.3.0}/src/tuieval/cli.py +0 -0
  44. {tuieval-0.2.0.dev164 → tuieval-0.3.0}/src/tuieval/client.py +0 -0
  45. {tuieval-0.2.0.dev164 → tuieval-0.3.0}/src/tuieval/ctxbench.py +0 -0
  46. {tuieval-0.2.0.dev164 → tuieval-0.3.0}/src/tuieval/dates.py +0 -0
  47. {tuieval-0.2.0.dev164 → tuieval-0.3.0}/src/tuieval/doctor.py +0 -0
  48. {tuieval-0.2.0.dev164 → tuieval-0.3.0}/src/tuieval/export.py +0 -0
  49. {tuieval-0.2.0.dev164 → tuieval-0.3.0}/src/tuieval/graders/__init__.py +0 -0
  50. {tuieval-0.2.0.dev164 → tuieval-0.3.0}/src/tuieval/graders/answer.py +0 -0
  51. {tuieval-0.2.0.dev164 → tuieval-0.3.0}/src/tuieval/graders/code.py +0 -0
  52. {tuieval-0.2.0.dev164 → tuieval-0.3.0}/src/tuieval/graders/rag.py +0 -0
  53. {tuieval-0.2.0.dev164 → tuieval-0.3.0}/src/tuieval/graders/reply.py +0 -0
  54. {tuieval-0.2.0.dev164 → tuieval-0.3.0}/src/tuieval/graders/tool_call.py +0 -0
  55. {tuieval-0.2.0.dev164 → tuieval-0.3.0}/src/tuieval/logs.py +0 -0
  56. {tuieval-0.2.0.dev164 → tuieval-0.3.0}/src/tuieval/machines.py +0 -0
  57. {tuieval-0.2.0.dev164 → tuieval-0.3.0}/src/tuieval/onboard.py +0 -0
  58. {tuieval-0.2.0.dev164 → tuieval-0.3.0}/src/tuieval/profiles.py +0 -0
  59. {tuieval-0.2.0.dev164 → tuieval-0.3.0}/src/tuieval/pta.py +0 -0
  60. {tuieval-0.2.0.dev164 → tuieval-0.3.0}/src/tuieval/remove.py +0 -0
  61. {tuieval-0.2.0.dev164 → tuieval-0.3.0}/src/tuieval/run_evals.py +0 -0
  62. {tuieval-0.2.0.dev164 → tuieval-0.3.0}/src/tuieval/scaffold.py +0 -0
  63. {tuieval-0.2.0.dev164 → tuieval-0.3.0}/src/tuieval/selftest.py +0 -0
  64. {tuieval-0.2.0.dev164 → tuieval-0.3.0}/src/tuieval/templates/models.toml +0 -0
  65. {tuieval-0.2.0.dev164 → tuieval-0.3.0}/src/tuieval/templates/packs/answer/pack.toml +0 -0
  66. {tuieval-0.2.0.dev164 → tuieval-0.3.0}/src/tuieval/templates/packs/answer/system.txt +0 -0
  67. {tuieval-0.2.0.dev164 → tuieval-0.3.0}/src/tuieval/templates/packs/answer/tests.yaml +0 -0
  68. {tuieval-0.2.0.dev164 → tuieval-0.3.0}/src/tuieval/templates/packs/code/pack.toml +0 -0
  69. {tuieval-0.2.0.dev164 → tuieval-0.3.0}/src/tuieval/templates/packs/code/system.txt +0 -0
  70. {tuieval-0.2.0.dev164 → tuieval-0.3.0}/src/tuieval/templates/packs/code/tests.yaml +0 -0
  71. {tuieval-0.2.0.dev164 → tuieval-0.3.0}/src/tuieval/templates/packs/rag/pack.toml +0 -0
  72. {tuieval-0.2.0.dev164 → tuieval-0.3.0}/src/tuieval/templates/packs/rag/system.txt +0 -0
  73. {tuieval-0.2.0.dev164 → tuieval-0.3.0}/src/tuieval/templates/packs/rag/tests.yaml +0 -0
  74. {tuieval-0.2.0.dev164 → tuieval-0.3.0}/src/tuieval/templates/packs/reply/pack.toml +0 -0
  75. {tuieval-0.2.0.dev164 → tuieval-0.3.0}/src/tuieval/templates/packs/reply/system.txt +0 -0
  76. {tuieval-0.2.0.dev164 → tuieval-0.3.0}/src/tuieval/templates/packs/reply/tests.yaml +0 -0
  77. {tuieval-0.2.0.dev164 → tuieval-0.3.0}/src/tuieval/templates/packs/tool_call/pack.toml +0 -0
  78. {tuieval-0.2.0.dev164 → tuieval-0.3.0}/src/tuieval/templates/packs/tool_call/system.txt +0 -0
  79. {tuieval-0.2.0.dev164 → tuieval-0.3.0}/src/tuieval/templates/packs/tool_call/tests.yaml +0 -0
  80. {tuieval-0.2.0.dev164 → tuieval-0.3.0}/src/tuieval/templates/packs/tool_call/tools.yaml +0 -0
  81. {tuieval-0.2.0.dev164 → tuieval-0.3.0}/src/tuieval/tune.py +0 -0
  82. {tuieval-0.2.0.dev164 → tuieval-0.3.0}/src/tuieval/watch_proxy.py +0 -0
  83. {tuieval-0.2.0.dev164 → tuieval-0.3.0}/src/tuieval/workspace.py +0 -0
  84. {tuieval-0.2.0.dev164 → tuieval-0.3.0}/src/tuieval/yamlout.py +0 -0
  85. {tuieval-0.2.0.dev164 → tuieval-0.3.0}/tests/mock_server.py +0 -0
@@ -2,8 +2,14 @@
2
2
 
3
3
  ## Unreleased
4
4
 
5
- - `tuieval tune --ctx` starts where the model file says the limit is, instead of climbing from a small context: for a GGUF on a llama.cpp-style server it estimates the largest context that fits (weights, buffers, and the KV cache per token with sliding-window layers counted as llama.cpp keeps them), tries that first, and lets the first reading predict whether more fits. Typically 1 or 2 server starts, down from 3 to 6 (Gemma 4 31B: one, at its 262,144 limit, where it took five). The estimate is dropped when a try's memory is more than 25% off it; MLA models, models larger than memory and servers that size their own memory keep the doubling search. The saved measurement records where it started (`started_from`, `estimated_ctx`).
5
+ ## 0.3.0
6
+
7
+ - Built-in pi agents for agent packs: `agent = "pi"` runs bare pi on the served model (sandboxed on macOS, with none of your pi setup), and `agent = "pi-scouts"` adds pi's subagent tool and a read-only `scout` agent on the same model, which the lead may send in parallel. Agent commands can use `{tuieval_python}`, the Python tuieval runs with. Agents can report `subagent_*` stats, and `tuieval compare` shows a **subagent tasks** column when they do. See docs/agent-packs.md.
6
8
 
9
+ ## 0.2.0
10
+
11
+ - `tuieval tune --ctx` starts where the model file says the limit is, instead of climbing from a small context: for a GGUF on a llama.cpp-style server it estimates the largest context that fits (weights, buffers, and the KV cache per token with sliding-window layers counted as llama.cpp keeps them), tries that first, and lets the first reading predict whether more fits. Typically 1 or 2 server starts, down from 3 to 6 (Gemma 4 31B: one, at its 262,144 limit, where it took five). The estimate is dropped when a try's memory is more than 25% off it; MLA models, models larger than memory and servers that size their own memory keep the doubling search. The saved measurement records where it started (`started_from`, `estimated_ctx`).
12
+ - Sections: pack.toml `use_case` (default: the pack's `group`) is what a pack's verdict counts toward, so a section (`group`) can hold several use cases. The model list's verdict codes, the Readiness tab and Insights' best model per use case show use cases section by section in pack order, with a divider or heading per section (the Readiness tab was alphabetical).
7
13
  - Drafter files: a model can name a separate drafter file (`draft = "…gguf"`), and tune options that use `{draft}` are offered only to models that have one. A server's `[servers.<name>.drafts]` table names kinds of drafter by GGUF metadata, for options that use `{draft_<kind>}`. See docs/models.md.
8
14
  - Fix: `tuieval tune --ctx` stopped early ("predicted to need more memory") on servers that fill memory to their own budget whatever the context. When the smallest context that passed already took more than the memory set aside, the prediction no longer caps the search.
9
15
  - Fix: `tuieval tune --ctx` found no working context for servers that fill memory to their own budget and run with macOS memory pressure at the warning level. When the first try reaches that level with nothing swapped, tries are judged by swapping, memory running out and critical pressure instead.
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.5
2
2
  Name: tuieval
3
- Version: 0.2.0.dev164
3
+ Version: 0.3.0
4
4
  Summary: Evaluate local and frontier LLMs on your own questions: accuracy, speed, tokens and PASS/FAIL verdicts, in the terminal.
5
5
  Project-URL: Homepage, https://github.com/ashe-wb/tuieval
6
6
  Project-URL: Issues, https://github.com/ashe-wb/tuieval/issues
@@ -76,6 +76,33 @@ agent = "my-agent"
76
76
 
77
77
  The agent's name and command are part of an agent pack's settings, so changing the command reruns the pack. The agent's version isn't: each answer records it, and `tuieval compare` marks a pack that ran on more than one version as MIXED.
78
78
 
79
+ ### Built in: pi
80
+
81
+ Two agents come built in, for [pi](https://github.com/earendil-works/pi). Name one in a pack (`agent = "pi"`) or in `[defaults]`; pi must be on your PATH. An `[agents.pi]` or `[agents.pi-scouts]` of your own replaces the built-in one.
82
+
83
+ | Agent | What it runs |
84
+ |---|---|
85
+ | `pi` | bare pi on the model tuieval serves |
86
+ | `pi-scouts` | the same, plus pi's subagent tool and a read-only `scout` agent on the same model |
87
+
88
+ ```toml
89
+ # what they are (builtin.toml); {tuieval_python} is the Python tuieval runs with
90
+ [agents.pi]
91
+ cmd = ["{tuieval_python}", "-m", "tuieval.adapters.pi"]
92
+
93
+ [agents.pi-scouts]
94
+ cmd = ["{tuieval_python}", "-m", "tuieval.adapters.pi", "--scouts"]
95
+ ```
96
+
97
+ - **Bare:** pi gets a scratch config folder with one provider, the model tuieval serves, using its context size and sampling. It runs with no extensions, skills, context files, prompt templates, themes, MCP or saved session, so your own pi setup never changes a result. The model's `reasoning_effort` becomes pi's thinking level.
98
+ - **Sandboxed on macOS:** pi and everything it runs can't read your home folder or the temp folders, apart from the task's work folder, the adapter's scratch folder and the pack's Python. They can write only the work folder and the scratch folder. So the model can't look up hidden tests or reference fixes, or leave notes for the next model. `TUIEVAL_NO_SANDBOX=1` turns this off, and the run line then says `sandbox OFF`. Other systems have no sandbox.
99
+ - **Scouts:** `pi-scouts` adds pi's example subagent extension, found next to the pi on your PATH, and one agent, `scout`, with read-only tools (`read`, `grep`, `find`, `ls`) on the same model at thinking `low`.
100
+ - The lead gets one line saying the tool exists; the task text is unchanged, and whether to delegate is the lead's own choice.
101
+ - Scouts run inside the same sandbox.
102
+ - Their turns and tokens are counted in the task's totals and reported as `subagent_*` stats.
103
+ - The turn limit counts the lead's turns only.
104
+ - **Comparing:** a pack whose `tasks/` is a link to another pack's tasks runs the same tasks with another agent. So `agentic-coding` with `agent = "pi"` beside `agentic-coding-scouts` with `agent = "pi-scouts"` shows each model with and without scouts.
105
+
79
106
  Most agents need a small **adapter**: a script that reads what tuieval provides, starts the agent with it, and writes the stats file. pi, Aider, Codex CLI, OpenCode and similar agents can all be wrapped this way. The adapter gets everything from its environment:
80
107
 
81
108
  | Variable | Contents |
@@ -105,6 +132,7 @@ Most agents need a small **adapter**: a script that reads what tuieval provides,
105
132
  - **`tool_errors`:** count failed edits and malformed tool calls, not commands that exit nonzero.
106
133
  - **`stop`:** `done`, `turn limit` or `error`.
107
134
  - **`server_error`:** if the model's server failed rather than the model, write this key with the error text. The task isn't counted and is asked again.
135
+ - **`subagent_calls`, `subagent_tasks`, `subagent_failed`, `subagent_turns`, `subagent_input_tokens`, `subagent_output_tokens`:** work the agent handed to subagents. Count those tokens in `input_tokens` and `output_tokens` too.
108
136
 
109
137
  A minimal adapter:
110
138
 
@@ -133,10 +161,10 @@ Agent tasks appear wherever other answers do: Per question, Failures, the scorec
133
161
  - its final message and its changes as a diff;
134
162
  - the full transcript, with the test output;
135
163
  - under **What's checked**, the visible and hidden tests.
136
- - **`tuieval compare`:** adds an **Agent tasks** table per model and pack. It shows tasks passed, median minutes and turns, output tokens, tool errors, how often the tests were run, limits hit, tests edited, and the agent version.
164
+ - **`tuieval compare`:** adds an **Agent tasks** table per model and pack. It shows tasks passed, median minutes and turns, output tokens, tool errors, how often the tests were run, limits hit, tests edited, and the agent version. When an agent reports subagent stats, a **subagent tasks** column shows how many tasks it handed out, in how many calls.
137
165
 
138
166
  `tuieval regrade` leaves agent results alone: they're graded when they run, so retest the pack instead.
139
167
 
140
168
  ## Safety
141
169
 
142
- ⚠️ The agent runs commands as you, with your permissions. It works in a scratch folder, but nothing stops it from reaching outside that folder. Run agent packs in a container or VM with no credentials in the environment. The hidden tests and reference fixes live in your pack folder, so an agent that searched your disk could find them. The transcript would show it.
170
+ ⚠️ The agent runs commands as you, with your permissions. It works in a scratch folder, but apart from the built-in pi agents' macOS sandbox, nothing stops it from reaching outside that folder. Run agent packs in a container or VM with no credentials in the environment. The hidden tests and reference fixes live in your pack folder, so an agent that searched your disk could find them. The transcript would show it.
@@ -27,7 +27,8 @@ Every pack has a fingerprint of what the model sees and what decides pass/fail (
27
27
 
28
28
  ```toml
29
29
  label = "Support bot" # shown in the TUI
30
- group = "Customer support" # the use case it counts toward (see below)
30
+ group = "Customer support" # the section it's listed under, and its use case unless use_case says otherwise
31
+ use_case = "Refunds" # optional: the use case its verdict counts toward (default: its group)
31
32
  description = "…"
32
33
  grader = "reply" # default grader for its tests (see Graders)
33
34
  system = "system.txt" # system prompt file (optional)
@@ -50,7 +51,9 @@ max_truncation = 0.01 # share of answers cut off by max_tokens
50
51
  min_consistency = 0.95 # share of variant groups where every variant passes
51
52
  ```
52
53
 
53
- `group` doubles as the **use case** in the readiness verdicts: all packs in a group must PASS for the use case to PASS. For example, a "Coding" use case could be a `coding` pack plus a `coding-sql` pack.
54
+ `group` is the **section** a pack is listed under, and its **use case** in the readiness verdicts unless `use_case` names another: all packs in a use case must PASS for the use case to PASS. For example, a "Coding" use case could be a `coding` pack plus a `coding-sql` pack.
55
+
56
+ Give packs a `use_case` when a section should hold several separately judged use cases. With `group = "Coding"` on all of them, `coding` and `coding-sql` (use case Coding) and `agentic-coding` (`use_case = "Agentic coding"`) are listed together, but a model that has never run the agentic pack still gets a Coding verdict. The model list, the Readiness tab and the Insights panel show use cases section by section, in pack order.
54
57
 
55
58
  `stop_early` suits packs a weak model fails quickly, like a regression set of routine cases: a run stops the pack at the first critical failure, or once the accuracy or truncation bar is out of reach even if every remaining answer passes, saves what it has (the verdict is FAIL) and moves on. It asks first the questions models have failed most often. `tuieval run --stop-early` (or **Stop a pack once it fails** in Setup) does this for every pack in the run. A later Certify fills in the rest.
56
59
 
@@ -18,7 +18,7 @@ version_tuple: tuple[int | str, ...]
18
18
  commit_id: str | None
19
19
  __commit_id__: str | None
20
20
 
21
- __version__ = version = '0.2.0.dev164'
22
- __version_tuple__ = version_tuple = (0, 2, 0, 'dev164')
21
+ __version__ = version = '0.3.0'
22
+ __version_tuple__ = version_tuple = (0, 3, 0)
23
23
 
24
24
  __commit_id__ = commit_id = None
@@ -0,0 +1 @@
1
+ """Adapters that run command-line agents for agent packs (docs/agent-packs.md)."""
@@ -0,0 +1,352 @@
1
+ """The built-in adapter for pi (https://github.com/earendil-works/pi), for agent packs: runs bare pi on the
2
+ model tuieval serves.
3
+
4
+ [agents.pi] cmd = ["{tuieval_python}", "-m", "tuieval.adapters.pi"] (built in)
5
+ [agents.pi-scouts] cmd = ["{tuieval_python}", "-m", "tuieval.adapters.pi", "--scouts"] (built in)
6
+
7
+ pi gets a scratch config folder with one provider, "tuieval", pointing at TUIEVAL_BASE_URL (context size and
8
+ sampling from tuieval), and runs with no extensions, skills, context files, prompt templates, themes, MCP or saved
9
+ session, so your own pi setup never changes a result. One line per turn and tool call is printed for the live
10
+ view; the stats go to TUIEVAL_STATS_FILE.
11
+
12
+ On macOS pi runs inside a sandbox (sandbox-exec, see sandbox_profile): it can't read your home folder or the temp
13
+ folders, apart from the task's work folder, the adapter's own scratch folder and the pack's Python, and it can
14
+ write only those two folders. So a model can't look up hidden tests or reference fixes, or leave notes for the
15
+ next model. HOME and TMPDIR point into the scratch folder. TUIEVAL_NO_SANDBOX=1 turns the sandbox off (the run
16
+ line then says "sandbox OFF"); without sandbox-exec (other systems) there is none.
17
+
18
+ --scouts adds pi's example subagent extension (the one explicit -e; everything else stays off) and one agent,
19
+ "scout": read-only tools (read, grep, find, ls), the model tuieval serves at thinking "low", and SCOUT_PROMPT.
20
+ The lead gets one appended system line saying the tool exists (SCOUT_HINT); the task text is unchanged, and
21
+ whether to delegate is the lead's own choice. Scouts are child pi processes of the sandboxed pi, so the sandbox
22
+ covers them too, and they use the same scratch config. Their turns and tokens are added to the run's totals and
23
+ also written as subagent_* stats; the turn limit counts the lead's turns only.
24
+
25
+ Standard library only: it runs with tuieval's own Python, whatever the pack's Python is.
26
+ """
27
+ import json
28
+ import os
29
+ import shutil
30
+ import signal
31
+ import subprocess
32
+ import sys
33
+ import tempfile
34
+
35
+ PI_LEVELS = ("off", "minimal", "low", "medium", "high", "xhigh", "max")
36
+ SAMPLING_KEYS = ("temperature", "top_p", "top_k", "min_p", "presence_penalty", "repeat_penalty")
37
+ # provider errors that are the server's fault, not the model's (tuieval asks the task again)
38
+ SERVER_ERRORS = ("ECONNREFUSED", "ECONNRESET", "socket hang up", "fetch failed", "502", "503",
39
+ "Internal Server Error", "Service Unavailable", "Bad Gateway")
40
+ SUBAGENT_STATS = ("subagent_calls", "subagent_tasks", "subagent_failed", "subagent_turns", "subagent_input_tokens",
41
+ "subagent_output_tokens")
42
+
43
+ SCOUT_HINT = ("You have a `subagent` tool with a read-only `scout` agent (read, grep, find, ls). When a task needs "
44
+ "context from several independent parts of the code, you can send scouts in parallel to gather it "
45
+ "first; edits, commands and tests stay with you.")
46
+ SCOUT_PROMPT = """You are a scout. Quickly investigate a codebase and return structured findings that another agent can use without re-reading everything.
47
+
48
+ Your output will be passed to an agent who has NOT seen the files you explored.
49
+
50
+ Thoroughness (infer from task, default medium):
51
+ - Quick: Targeted lookups, key files only
52
+ - Medium: Follow imports, read critical sections
53
+ - Thorough: Trace all dependencies, check tests/types
54
+
55
+ Strategy:
56
+ 1. grep/find to locate relevant code
57
+ 2. Read key sections (not entire files)
58
+ 3. Identify types, interfaces, key functions
59
+ 4. Note dependencies between files
60
+
61
+ Output format:
62
+
63
+ ## Files Retrieved
64
+ List with exact line ranges:
65
+ 1. `path/to/file.ts` (lines 10-50) - Description of what's here
66
+ 2. `path/to/other.ts` (lines 100-150) - Description
67
+ 3. ...
68
+
69
+ ## Key Code
70
+ Critical types, interfaces, or functions:
71
+
72
+ ```typescript
73
+ interface Example {
74
+ // actual code from the files
75
+ }
76
+ ```
77
+
78
+ ```typescript
79
+ function keyFunction() {
80
+ // actual implementation
81
+ }
82
+ ```
83
+
84
+ ## Architecture
85
+ Brief explanation of how the pieces connect.
86
+
87
+ ## Start Here
88
+ Which file to look at first and why.
89
+ """
90
+
91
+
92
+ def pi_version():
93
+ try:
94
+ out = subprocess.run(["pi", "--version"], capture_output=True, text=True, timeout=30).stdout.strip()
95
+ return f"pi {out}" if out else "pi"
96
+ except (OSError, subprocess.TimeoutExpired):
97
+ return "pi"
98
+
99
+
100
+ def subagent_extension():
101
+ """pi's example subagent extension, found from the pi on PATH (its package root holds examples/)."""
102
+ d = os.path.dirname(os.path.realpath(shutil.which("pi") or "pi"))
103
+ while d != os.path.dirname(d):
104
+ pkg = os.path.join(d, "package.json")
105
+ if os.path.isfile(pkg):
106
+ try:
107
+ name = json.load(open(pkg)).get("name", "")
108
+ except ValueError:
109
+ name = ""
110
+ if name.endswith("/pi-coding-agent"):
111
+ ext = os.path.join(d, "examples", "extensions", "subagent", "index.ts")
112
+ if os.path.isfile(ext):
113
+ return ext
114
+ break
115
+ d = os.path.dirname(d)
116
+ return None
117
+
118
+
119
+ def config(dest, sampling, model_id, scouts=False):
120
+ """A pi config folder with one provider, "tuieval", serving model_id (and, for scouts, the scout agent)."""
121
+ ctx = int(os.environ.get("TUIEVAL_CONTEXT") or 32768)
122
+ params = {k: sampling[k] for k in SAMPLING_KEYS if k in sampling}
123
+ if "enable_thinking" in sampling:
124
+ params["chat_template_kwargs"] = {"enable_thinking": bool(sampling["enable_thinking"])}
125
+ model = {"id": model_id, "name": model_id, "reasoning": True, "input": ["text"], "contextWindow": ctx,
126
+ "maxTokens": min(int(sampling.get("max_tokens") or 16384), ctx), "samplingParams": params,
127
+ # requests like tuieval's own: max_tokens (not max_completion_tokens), and reasoning_effort only
128
+ # when the model sets one (pi would otherwise send its default level)
129
+ "compat": {"maxTokensField": "max_tokens",
130
+ **({} if sampling.get("reasoning_effort") else {"supportsReasoningEffort": False})}}
131
+ providers = {"tuieval": {"baseUrl": os.environ["TUIEVAL_BASE_URL"], "api": "openai-completions",
132
+ "apiKey": os.environ.get("TUIEVAL_API_KEY") or "none", "models": [model]}}
133
+ os.makedirs(dest, mode=0o700, exist_ok=True)
134
+ with open(os.path.join(dest, "models.json"), "w") as f:
135
+ json.dump({"providers": providers}, f, indent=1)
136
+ with open(os.path.join(dest, "settings.json"), "w") as f:
137
+ json.dump({"quietStartup": True}, f)
138
+ if scouts:
139
+ os.makedirs(os.path.join(dest, "agents"), exist_ok=True)
140
+ with open(os.path.join(dest, "agents", "scout.md"), "w") as f:
141
+ f.write("---\nname: scout\ndescription: Fast codebase recon that returns compressed context for handoff "
142
+ f"to other agents\ntools: read, grep, find, ls\nmodel: tuieval/{model_id}:low\n---\n\n"
143
+ + SCOUT_PROMPT)
144
+
145
+
146
+ def sandbox_profile(work, scratch, python_dirs):
147
+ """A macOS sandbox (sandbox-exec) profile for pi and everything it runs, so a model can't look up answers
148
+ or leave notes for the next model:
149
+ reads nothing in your home folder, the temp folders or /Volumes, except the task's work folder, the
150
+ adapter's own scratch folder (pi config, HOME, TMPDIR) and the pack's Python
151
+ writes only the work folder, the scratch folder and /dev
152
+ escapes no Apple Events (Office, Terminal, System Events…), no LaunchServices (`open -a …`), no
153
+ launchctl/at/crontab, no ssh to this Mac: each would run code outside the sandbox
154
+ Everything else (the pi install, system libraries, the network to the model server) is allowed."""
155
+ q = lambda p: json.dumps(os.path.realpath(p)) # SBPL strings use the same escapes as JSON
156
+ home = os.path.realpath(os.path.expanduser("~"))
157
+ hidden = [home, "/private/tmp", "/private/var/tmp", "/private/var/folders"]
158
+ hidden += [p for p in ("/Volumes",) if os.path.isdir(p)]
159
+ ok_rw = [work, scratch]
160
+ rules = ["(version 1)", "(allow default)",
161
+ "(deny file-read* " + " ".join(f"(subpath {q(p)})" for p in hidden) + ")",
162
+ "(allow file-read* " + " ".join(f"(subpath {q(p)})" for p in ok_rw + python_dirs) + ")",
163
+ "(allow file-read-metadata)", # stat() on parent folders, which path lookups need; no contents
164
+ "(deny file-write* (require-not (require-any "
165
+ + " ".join(f"(subpath {q(p)})" for p in ok_rw) + ' (subpath "/dev"))))',
166
+ "(deny appleevent-send)",
167
+ '(deny mach-lookup (global-name "com.apple.coreservices.launchservicesd")'
168
+ ' (global-name "com.apple.coreservices.quarantine-resolver"))',
169
+ '(deny process-exec (literal "/bin/launchctl") (literal "/usr/bin/at") (literal "/usr/bin/crontab")'
170
+ ' (literal "/usr/bin/open") (literal "/usr/bin/ssh") (literal "/usr/bin/osascript")'
171
+ ' (literal "/usr/bin/shortcuts") (literal "/usr/bin/automator"))',
172
+ '(deny network-outbound (remote tcp "localhost:22"))']
173
+ return "\n".join(rules)
174
+
175
+
176
+ def python_dirs():
177
+ """Folders the pack's Python needs to read: its venv (first on PATH, put there by tuieval) and the base
178
+ install the venv points at."""
179
+ dirs = []
180
+ first = (os.environ.get("PATH") or "").split(os.pathsep)[0]
181
+ venv = os.path.dirname(first)
182
+ cfg = os.path.join(venv, "pyvenv.cfg")
183
+ if os.path.isfile(cfg):
184
+ dirs.append(venv)
185
+ for line in open(cfg):
186
+ k, _, v = line.partition("=")
187
+ if k.strip() == "home" and v.strip():
188
+ dirs.append(os.path.dirname(os.path.realpath(v.strip()))) # …/bin -> the install
189
+ return dirs
190
+
191
+
192
+ def thinking(sampling):
193
+ if sampling.get("enable_thinking") is False:
194
+ return "off"
195
+ effort = sampling.get("reasoning_effort")
196
+ return effort if effort in PI_LEVELS else None
197
+
198
+
199
+ def short(v, n=140):
200
+ v = " ".join(str(v).split())
201
+ return v if len(v) <= n else v[:n - 1] + "…"
202
+
203
+
204
+ def add_subagents(stats, ev):
205
+ """Count a finished subagent tool call (pi's example extension) into stats; returns its summary line."""
206
+ rs = ((ev.get("result") or {}).get("details") or {}).get("results") or []
207
+ stats["subagent_calls"] += 1
208
+ turns = out = 0
209
+ for r in rs:
210
+ u = r.get("usage") or {}
211
+ stats["subagent_tasks"] += 1
212
+ stats["subagent_failed"] += int(r.get("exitCode") not in (0, None) or r.get("status") == "failed")
213
+ tokens_in = (u.get("input") or 0) + (u.get("cacheRead") or 0)
214
+ stats["subagent_turns"] += u.get("turns") or 0
215
+ stats["subagent_input_tokens"] += tokens_in
216
+ stats["subagent_output_tokens"] += u.get("output") or 0
217
+ stats["input_tokens"] += tokens_in
218
+ stats["output_tokens"] += u.get("output") or 0
219
+ turns += u.get("turns") or 0
220
+ out += u.get("output") or 0
221
+ if ev.get("isError"):
222
+ stats["tool_errors"] += 1
223
+ return f" subagents: {len(rs)} task(s), {turns} turns, {out} output tokens" + (" [error]" if ev.get("isError") else "")
224
+
225
+
226
+ def build_command(model_id, sampling, prompt, scouts, extension):
227
+ cmd = ["pi", "--mode", "json", "--no-session", "--no-extensions", "--no-skills", "--no-context-files",
228
+ "--no-prompt-templates", "--no-themes", "--no-mcp", "--no-approve", "--offline",
229
+ "--model", "tuieval/" + model_id]
230
+ if scouts:
231
+ cmd += ["-e", extension, "--append-system-prompt", SCOUT_HINT]
232
+ level = thinking(sampling)
233
+ if level:
234
+ cmd += ["--thinking", level]
235
+ return cmd + ["--", prompt], level
236
+
237
+
238
+ def main(argv=None):
239
+ argv = sys.argv[1:] if argv is None else argv
240
+ scouts = "--scouts" in argv
241
+ sampling = json.loads(os.environ.get("TUIEVAL_SAMPLING") or "{}")
242
+ max_turns = int(os.environ.get("TUIEVAL_MAX_TURNS") or 40)
243
+ prompt = open(os.environ["TUIEVAL_PROMPT_FILE"]).read()
244
+ model_id = os.environ["TUIEVAL_MODEL_ID"]
245
+ stats = {"agent": pi_version() + (" + scouts" if scouts else ""), "turns": 0, "input_tokens": 0,
246
+ "output_tokens": 0, "tool_calls": 0, "tool_errors": 0, "ran_tests": False, "stop": "", "final_message": ""}
247
+ extension = None
248
+ if scouts:
249
+ stats.update(dict.fromkeys(SUBAGENT_STATS, 0))
250
+ extension = subagent_extension()
251
+ if not extension:
252
+ print("pi's examples/extensions/subagent/index.ts wasn't found next to the pi on PATH", flush=True)
253
+ stats.update(stop="error", final_message="no subagent extension")
254
+ save(stats)
255
+ return 1
256
+ tmp = tempfile.mkdtemp(prefix="pi-adapter-")
257
+ cfg_dir = os.path.join(tmp, "pi-config")
258
+ config(cfg_dir, sampling, model_id, scouts)
259
+ cmd, level = build_command(model_id, sampling, prompt, scouts, extension)
260
+ env = dict(os.environ, PI_CODING_AGENT_DIR=cfg_dir, PI_OFFLINE="1", PI_TELEMETRY="0")
261
+ shown = " ".join(cmd[:-1])
262
+ sandbox = os.environ.get("TUIEVAL_NO_SANDBOX") != "1" and shutil.which("sandbox-exec")
263
+ if sandbox:
264
+ fake_home, fake_tmp = os.path.join(tmp, "home"), os.path.join(tmp, "tmp")
265
+ os.makedirs(fake_home)
266
+ os.makedirs(fake_tmp)
267
+ env.update(HOME=fake_home, TMPDIR=fake_tmp + "/", ZDOTDIR=fake_home)
268
+ pi = shutil.which("pi") or "pi"
269
+ cmd = ["sandbox-exec", "-p", sandbox_profile(os.getcwd(), tmp, python_dirs()), pi] + cmd[1:]
270
+ print(f"$ {shown} <task> (thinking {level or 'default'}, max {max_turns} turns, "
271
+ f"sandbox {'on' if sandbox else 'OFF'})", flush=True)
272
+ try:
273
+ proc = subprocess.Popen(cmd, env=env, stdin=subprocess.DEVNULL, stdout=subprocess.PIPE,
274
+ stderr=subprocess.PIPE, start_new_session=True)
275
+ except OSError as e:
276
+ shutil.rmtree(tmp, ignore_errors=True)
277
+ stats.update(stop="error", final_message=f"can't start pi: {e}")
278
+ save(stats)
279
+ return 1
280
+
281
+ def stop_pi(*_):
282
+ try:
283
+ os.killpg(proc.pid, signal.SIGKILL)
284
+ except ProcessLookupError:
285
+ pass
286
+ signal.signal(signal.SIGTERM, lambda *a: (stop_pi(), save(stats), sys.exit(1)))
287
+ error = ""
288
+ try:
289
+ for raw in iter(proc.stdout.readline, b""):
290
+ try:
291
+ ev = json.loads(raw)
292
+ except ValueError:
293
+ continue
294
+ kind = ev.get("type")
295
+ if kind == "message_end" and ev.get("message", {}).get("role") == "assistant":
296
+ m = ev["message"]
297
+ u = m.get("usage") or {}
298
+ stats["turns"] += 1
299
+ stats["output_tokens"] += u.get("output") or 0
300
+ stats["input_tokens"] += (u.get("input") or 0) + (u.get("cacheRead") or 0)
301
+ text = "".join(c.get("text", "") for c in m.get("content", []) if c.get("type") == "text").strip()
302
+ if text:
303
+ stats["final_message"] = text
304
+ if m.get("errorMessage"):
305
+ error = str(m["errorMessage"])
306
+ print(f"turn {stats['turns']}: {u.get('output') or 0} tokens, {m.get('stopReason')}"
307
+ + (f": {short(text)}" if text else "") + (f" [error: {short(error)}]" if error else ""),
308
+ flush=True)
309
+ if stats["turns"] >= max_turns and m.get("stopReason") == "toolUse":
310
+ stats["stop"] = "turn limit"
311
+ print(f"turn limit ({max_turns}) reached", flush=True)
312
+ break
313
+ elif kind == "tool_execution_start":
314
+ stats["tool_calls"] += 1
315
+ args = ev.get("args") or {}
316
+ what = args.get("command") or args.get("path") or json.dumps(args)
317
+ if "pytest" in json.dumps(args) or "unittest" in json.dumps(args):
318
+ stats["ran_tests"] = True
319
+ print(f" {ev.get('toolName')}: {short(what)}", flush=True)
320
+ elif kind == "tool_execution_end" and ev.get("toolName") == "subagent" and scouts:
321
+ print(add_subagents(stats, ev), flush=True)
322
+ elif kind == "tool_execution_end" and ev.get("isError"):
323
+ if ev.get("toolName") != "bash": # a failed edit or a bad call, not a failing command
324
+ stats["tool_errors"] += 1
325
+ out = " ".join(c.get("text", "") for c in (ev.get("result") or {}).get("content", []))
326
+ print(f" ! {ev.get('toolName')} failed: {short(out)}", flush=True)
327
+ elif kind == "agent_settled":
328
+ stats["stop"] = stats["stop"] or ("error" if ev.get("aborted") or error else "done")
329
+ break
330
+ finally:
331
+ stop_pi()
332
+ proc.wait()
333
+ err = proc.stderr.read().decode("utf-8", "replace").strip()
334
+ if err:
335
+ print("pi stderr: " + short(err, 600), flush=True)
336
+ shutil.rmtree(tmp, ignore_errors=True)
337
+ if not stats["stop"]:
338
+ stats["stop"] = "error"
339
+ error = error or f"pi exited ({proc.returncode})"
340
+ if error and any(s in error for s in SERVER_ERRORS):
341
+ stats["server_error"] = error # the server failed, not the model: tuieval asks the task again
342
+ save(stats)
343
+ return 0
344
+
345
+
346
+ def save(stats):
347
+ with open(os.environ["TUIEVAL_STATS_FILE"], "w") as f:
348
+ json.dump(stats, f)
349
+
350
+
351
+ if __name__ == "__main__":
352
+ sys.exit(main())
@@ -1,10 +1,14 @@
1
1
  """Agent packs: coding tasks a command-line agent works on, graded by tests.
2
2
 
3
- models.toml says how to start each agent (any program; {root} is the workspace):
3
+ models.toml says how to start each agent (any program; {root} is the workspace, {tuieval_python} the Python
4
+ tuieval runs with):
4
5
 
5
6
  [agents.my-agent]
6
7
  cmd = ["python3", "{root}/agents/my_agent.py"]
7
8
 
9
+ Built in (builtin.toml, replaced by an [agents.<name>] of the same name): "pi" and "pi-scouts", pi through
10
+ tuieval/adapters/pi.py.
11
+
8
12
  [defaults]
9
13
  agent = "my-agent" # for agent packs that don't name one (pack.toml agent = "...")
10
14
 
@@ -28,9 +32,11 @@ The agent learns the rest from its environment:
28
32
  TUIEVAL_STATS_FILE where it may write its stats as JSON when it finishes (all optional):
29
33
  agent ("name version"), turns, input_tokens, output_tokens, tool_calls,
30
34
  tool_errors (failed edits, bad tool calls; not commands that exit nonzero),
31
- ran_tests, stop ("done", "turn limit" or "error"), final_message, and
35
+ ran_tests, stop ("done", "turn limit" or "error"), final_message,
32
36
  server_error: the model's server failed, not the model (the task isn't counted
33
- and is asked again)
37
+ and is asked again), and subagent_calls, subagent_tasks, subagent_failed,
38
+ subagent_turns, subagent_input_tokens, subagent_output_tokens for work handed to
39
+ subagents (also counted in input_tokens and output_tokens)
34
40
 
35
41
  PATH starts with the pack's Python (pack.toml python, else tuieval's), so `python` runs the tasks'
36
42
  code and tests. The agent's exit code decides nothing; the tests do.
@@ -55,8 +61,12 @@ PROMPT_TAIL = "\n\nYou're working in a project in the current directory. Run Pyt
55
61
  GRADE_TIMEOUT_S = 300
56
62
  DIFF_KEEP = 20_000 # characters of the diff kept in the result (the whole diff is in the log)
57
63
  HIDDEN_RE = re.compile(r"\.?_hidden\b") # junit names of the hidden tests (a collection error starts with ".")
64
+ # subagent_*: work the agent handed to subagents (counted in its own input/output tokens too), e.g. the
65
+ # built-in pi-scouts agent's scouts
66
+ SUBAGENT_KEYS = ("subagent_calls", "subagent_tasks", "subagent_failed", "subagent_turns", "subagent_input_tokens",
67
+ "subagent_output_tokens")
58
68
  STATS_KEYS = ("agent", "turns", "input_tokens", "output_tokens", "tool_calls", "tool_errors", "ran_tests", "stop",
59
- "final_message", "server_error")
69
+ "final_message", "server_error", *SUBAGENT_KEYS)
60
70
 
61
71
 
62
72
  class AgentError(Exception):
@@ -1,6 +1,6 @@
1
- # Built-in defaults and servers, used when a workspace's models.toml doesn't define them.
1
+ # Built-in defaults, servers and agents, used when a workspace's models.toml doesn't define them.
2
2
  # [defaults] fill in key by key; [sampling] only when models.toml has no [sampling] at all (it's part of
3
- # every result's fingerprint); a server here is replaced whole by one of the same name in models.toml.
3
+ # every result's fingerprint); a server or agent here is replaced whole by one of the same name in models.toml.
4
4
 
5
5
  [defaults]
6
6
  repeat = 3
@@ -85,3 +85,13 @@ pin_endpoint = true
85
85
  api_key_env = "OPENROUTER_API_KEY"
86
86
  thinking_param = "reasoning" # [sampling] enable_thinking -> OpenRouter's reasoning.enabled
87
87
  headers = { "X-Title" = "tuieval" }
88
+
89
+ # pi (https://github.com/earendil-works/pi) for agent packs, through the built-in adapter (tuieval/adapters/pi.py):
90
+ # bare pi on the served model, sandboxed on macOS. pi-scouts adds pi's subagent extension and a read-only "scout"
91
+ # agent on the same model, which the lead may send in parallel. pi must be on PATH. {tuieval_python} is the
92
+ # Python tuieval runs with. Use one in a pack with agent = "pi" (pack.toml) or [defaults] agent = "pi".
93
+ [agents.pi]
94
+ cmd = ["{tuieval_python}", "-m", "tuieval.adapters.pi"]
95
+
96
+ [agents.pi-scouts]
97
+ cmd = ["{tuieval_python}", "-m", "tuieval.adapters.pi", "--scouts"]
@@ -639,7 +639,9 @@ def items(rows):
639
639
 
640
640
  def agent_table(rows):
641
641
  """(header, table) summing up agent-pack tasks per model and pack, or None without any. A pack run
642
- by more than one agent version is marked, since a new version can change how models do."""
642
+ by more than one agent version is marked, since a new version can change how models do. A
643
+ "subagent tasks" column (tasks handed to subagents, out of the agent's calls) appears only when
644
+ some agent reported subagent stats."""
643
645
  groups = collections.defaultdict(list)
644
646
  for r in rows:
645
647
  if r.get("agent"):
@@ -648,6 +650,9 @@ def agent_table(rows):
648
650
  return None
649
651
  header = ["model", "pack", "passed", "med min", "med turns", "out tokens", "tool errors", "ran tests",
650
652
  "limits hit", "tests edited", "agent"]
653
+ subagents = any("subagent_tasks" in r["agent"] for rs in groups.values() for r in rs)
654
+ if subagents:
655
+ header.insert(-1, "subagent tasks")
651
656
  table = []
652
657
  for (model, suite), rs in sorted(groups.items()):
653
658
  a = [r["agent"] for r in rs]
@@ -662,6 +667,10 @@ def agent_table(rows):
662
667
  str(sum(x.get("stop") in ("time limit", "turn limit") for x in a)),
663
668
  str(sum(bool(x.get("tests_edited")) for x in a)),
664
669
  " + ".join(versions) + (" (MIXED)" if len(versions) > 1 else "")])
670
+ if subagents:
671
+ sub = [x for x in a if "subagent_tasks" in x]
672
+ table[-1].insert(-1, f"{sum(x['subagent_tasks'] for x in sub)} in "
673
+ f"{sum(x.get('subagent_calls') or 0 for x in sub)} calls" if sub else "-")
665
674
  return header, table
666
675
 
667
676
 
@@ -45,6 +45,7 @@ import socket
45
45
  import statistics
46
46
  import string
47
47
  import subprocess
48
+ import sys
48
49
  import tempfile
49
50
  import threading
50
51
  import time
@@ -105,7 +106,7 @@ def hosted(cfg, m):
105
106
  def load_config(path):
106
107
  """Read models.toml, fill in the built-ins it leaves out (builtin.toml) and each model's defaults.
107
108
  [defaults] are filled key by key; [sampling] only when models.toml has none (sampling is part of
108
- every result's fingerprint, so a workspace's own keys are never added to); servers by name."""
109
+ every result's fingerprint, so a workspace's own keys are never added to); servers and agents by name."""
109
110
  with open(path, "rb") as f:
110
111
  cfg = tomllib.load(f)
111
112
  builtin = builtin_config()
@@ -117,6 +118,7 @@ def load_config(path):
117
118
  own = cfg.get("servers", {})
118
119
  cfg["servers"] = {**builtin["servers"], **own}
119
120
  cfg["builtin_servers"] = sorted(set(builtin["servers"]) - set(own)) # not defined in models.toml
121
+ cfg["agents"] = {**builtin.get("agents", {}), **cfg.get("agents", {})}
120
122
  cfg.setdefault("models", [])
121
123
  seen = set()
122
124
  for m in cfg["models"]:
@@ -2310,7 +2312,7 @@ class Engine:
2310
2312
  python = agents.python_for(job.pack, self.root)
2311
2313
  m, s = job.model, job.sampling
2312
2314
  key_env = self.cfg["servers"][m["server"]].get("api_key_env")
2313
- cmd = [expand(str(a), root=self.root) for a in agent["cmd"]]
2315
+ cmd = [expand(str(a), root=self.root, tuieval_python=sys.executable) for a in agent["cmd"]]
2314
2316
  live = os.path.join(self.log_dir, "live")
2315
2317
  os.makedirs(live, exist_ok=True)
2316
2318
  waits = list(self.SERVER_RETRY_WAITS_S)
@@ -2377,7 +2379,7 @@ class Engine:
2377
2379
  "agent": {"name": name, "version": stats.get("agent"), "stop": stop if stop != "exited" else
2378
2380
  stats.get("stop") or "exited",
2379
2381
  **{k: stats[k] for k in ("turns", "input_tokens", "output_tokens", "tool_calls",
2380
- "tool_errors", "ran_tests") if k in stats},
2382
+ "tool_errors", "ran_tests", *agents.SUBAGENT_KEYS) if k in stats},
2381
2383
  "exit_code": code, "tests_edited": edited, "visible": g["visible"],
2382
2384
  "hidden": g["hidden"], "failed": g["failed"], "diff": patch[:agents.DIFF_KEEP],
2383
2385
  "diff_cut": len(patch) > agents.DIFF_KEEP}}
@@ -2716,6 +2718,7 @@ class Engine:
2716
2718
  "model": {**{k: m.get(k) for k in ("label", "served_name", "server", "model", "tags", "vision", "mmproj")},
2717
2719
  **{k: m[k] for k in ("tools", "max_context", "thinking") if k in m}},
2718
2720
  "pack": {"name": job.pack.name, "label": job.pack.label, "group": job.pack.group,
2721
+ "use_case": job.pack.use_case,
2719
2722
  "fingerprint": job.pack.fingerprint, "tests": len(job.pack.tests),
2720
2723
  **({"max_tokens": job.pack.max_tokens} if job.pack.max_tokens else {})},
2721
2724
  "settings": job.sampling,