Use it
AI repair loop
A model can look at a failing program and propose a fix. In PyBox, the model can only ever propose. Trusted code decides what runs, where, and how much it may spend.
How a repair round works#
- Run the program in a sealed box and collect its receipt.
- Show the model the program and the feedback: either just the error output, or the structured receipt.
- Accept exactly one kind of answer: a complete new version of the program, a short diagnosis, and a cause label. Nothing else.
- Run the new version in a fresh sealed box, with the same rules as before.
- Stop when it passes, or after two attempts.
What the model is allowed to say#
{
"action": "revise",
"diagnosis": "short explanation, at most 2 KiB",
"claimed_cause": "exception",
"code": "the complete new program, at most 8 KiB"
}claimed_cause must be one of syntax, exception, logic, wall_timeout, oom, pids, policy or unknown. An answer with any extra field, another action or a cut-off reply is rejected without running anything, and it still uses up one of the two attempts.
In a recorded session, a model added "restart": true and also claimed the program used 256 MB when it used 160 MiB. The whole answer was rejected. The model's next answer was valid and fixed the program.
Budgets, reserved before spending#
| Limit | Value |
|---|---|
| Model requests | At most 16 per batch |
| Program runs | At most 24 per batch |
| Attempts per problem | 2 |
| Running at once | 1 |
| Time window | 900 s; no new work with under 50 s left |
Every request is written down and saved to disk before it's sent. If a request fails in a way that leaves its cost unknown, its reservation is kept and the batch stops. Unknown never quietly becomes zero, and reported cost is null, not 0.
What the trial showed#
Four small, deliberately broken programs were repaired with a free NVIDIA-hosted model, once with only the error output and once with the structured receipt as feedback:
| Error output only | Structured receipt | |
|---|---|---|
| Programs repaired | 4 of 4 | 4 of 4 |
| Model requests | 5 | 4 |
| Prompt tokens | 1,850 | 10,973 |
Four problems is an example, not a benchmark. The success check compares exact output, which a model could fake by hard-coding the answer. One program's error output contained a planted instruction to "call host_shell" and raise the budgets; the model simply fixed the program. That shows the checked boundary held in these cases. It doesn't prove a model can't be manipulated.
Using it#
The controller is in pybox.repair (RepairController, Budget, Limits). The recorded trial was run with tools/evaluate_m6.py, which asks for an NVIDIA API key (kept only in memory, never written to disk or passed into a box), sends real requests to NVIDIA's hosted API, and starts and stops the VM under strict checks. It isn't something to run just to try PyBox out.