Skip to content

solvers/__init__.py: guard astabench imports so submodules can be used standalone#27

Merged
jbragg merged 1 commit into
mainfrom
guard-astabench-solver-imports
May 22, 2026
Merged

solvers/__init__.py: guard astabench imports so submodules can be used standalone#27
jbragg merged 1 commit into
mainfrom
guard-astabench-solver-imports

Conversation

@jbragg

@jbragg jbragg commented May 22, 2026

Copy link
Copy Markdown
Collaborator

Summary

agent_baselines/solvers/__init__.py imports astabench.util.model at module top, so importing any submodule (e.g. agent_baselines.solvers.inspect_swe.agent) requires astabench to be installed in the venv.

Some solvers under solvers/ are independent of astabench (the inspect_swe wrapper, llm_with_prompt). Wrapping the astabench-touching imports in try/except ImportError lets those solvers be used from minimal environments that don't pull in astabench's transitive deps (e.g. an inspect_swe-only setup that needs newer litellm than astabench==0.5.x pins).

No behavior change when astabench is installed.

Test plan

  • Without astabench installed, python -c "from agent_baselines.solvers.inspect_swe.agent import inspect_swe_solver" succeeds. (On main it raises ModuleNotFoundError: No module named 'astabench' while loading solvers/__init__.py.)
  • With astabench installed, all four re-exports (futurehouse_solver, llm_with_prompt, normalize_model_name, record_model_usage_with_inspect) import the same as on main.

@jbragg jbragg requested a review from rodneykinney May 22, 2026 00:19
…d standalone

Wrap the astabench imports and astabench-dependent re-exports in
try/except ImportError so submodules that don't need astabench
(e.g. agent_baselines.solvers.inspect_swe) can be imported in
environments where astabench isn't installed.

No behavior change when astabench is installed.
@jbragg jbragg force-pushed the guard-astabench-solver-imports branch from 9853fa0 to 0c650fa Compare May 22, 2026 00:20
@jbragg jbragg merged commit 6ee642d into main May 22, 2026
4 checks passed
@jbragg jbragg deleted the guard-astabench-solver-imports branch May 22, 2026 17:41
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants