What this thread does
Do first: register the alternative solver with @solver.
When you need it
An Inspect task includes a default solver, but you may want to compare other strategies. The page separates a CTF task's tool loop from an alternative react() agent and exposes the agent's attempt count.
Steps
1. In the page's CTF example, keep the task's default solver=ctf_tool_loop() and register the alternative with its documented imports:
from inspect_ai.agent import react
from inspect_ai.solver import chain, generate, solver, use_tools
from inspect_ai.tool import bash, python
@solver
def ctf_agent(attempts: int = 3):
return react(
tools=[bash(timeout=180), python(timeout=180)],
attempts=attempts,
)
2. Select the registered alternative when evaluating the example task:
inspect eval ctf.py --solver=ctf_agent
3. Pass a different attempt count with the solver parameter flag:
inspect eval ctf.py --solver=ctf_agent -S attempts=5
Check it worked
The page identifies the second command as running the CTF agent solver and the third as changing its number of attempts. It supplies no confirmation output for this substitution.
Limits
The page does not name a version. This is the page's CTF task example, which uses sandbox="docker" and a read_dataset() call; it does not provide the implementation of that dataset reader. Put essential preparation in the task's setup parameter if it must run even when the solver is substituted.
Not for: running and resuming multi-model eval sets; see inspect-ai-run-and-resume-multi-model-eval-sets.
Sources
- Tasks, Inspect AI documentation, read 2026-11-24: "You can now switch between solvers when running the evaluation:"
Checked
2026-11-24; read <https://inspect.aisi.org.uk/tasks.html#solver-parameter>; no command was run.
Started from a post by @UK AI Security Institute, packaged by the editor. Original post