allenai / allenai/asta-autodiscovery
Unify AD-job code execution onto the asta-sandbox backend registry
- Dominant language
- Python
- Stars
- 10
- Forks
- 2
- Avg merge
- 1d 21h
- Merged PRs (30d)
- 11
Description
### Context
Making the code-execution backend configurable (part of #34) surfaced an inconsistency in how the AD job runs generated code. The job's `--backend` flag has three values, but only one routes through `asta-sandbox`:
- `modal` → `asta_sandbox.backends.modal_ephemeral.ModalEphemeralExecutor` (asta-sandbox)
- `process` → the workspace's own `code_execution.ProcessIPythonBackend` (**not** asta-sandbox), wrapped by an ad-hoc `_ProcessBackendAdapter` in `packages/autodiscovery/src/autodiscovery/agents.py`
- `local` → autogen's `LocalCommandLineCodeExecutor` (**not** asta-sandbox)
`asta-sandbox` already ships equivalent backends: `inprocess`, `docker`, `modal_ephemeral`, `modal_kernel`. So today's `process`/`local` are parallel, one-off implementations of things the library provides (or could).
### Proposal
Route all code execution through the `asta-sandbox` backend registry so backend selection is uniform and the ad-hoc adapter goes away:
- Transplant `ProcessIPythonBackend` onto `asta_sandbox.SandboxBase` as a first-class local process backend (make `run_cell` async via `asyncio.to_thread`) and move it into the `asta-sandbox` library alongside `InProcessExecutor` and `ModalEphemeralExecutor`. This is already flagged by a `TODO` in `packages/code_execution/src/code_execution/process_backend.py`.
- Once it lives in the library, delete `_ProcessBackendAdapter` in `agents.py` and construct executors from a single `SandboxBase` factory keyed by the backend name.
- Consider mapping the job's `--backend` names onto the library's names (or adopting the library's names directly) so the vocabulary is shared.
### Why not now
This PR keeps the change small and low-risk: it makes the existing, working knob configurable (`CODE_EXECUTION_BACKEND`) without moving code between packages or changing the `asta-sandbox` public surface. The unification is a mechanical-but-cross-package refactor best done on its own.
### Acceptance
- The AD job's code execution is selected via a single `asta-sandbox` `SandboxBase` factory.
- `_ProcessBackendAdapter` is removed.
- No behavior change for existing `process`/`local`/`modal` runs.
Related: #34
Contributor guide
No contributing guide indexed for this repository
Assessment
This issue has not been assessed yet.