Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion AGENTS.md
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ and its resources.
tinyproxy of a unit's own for the tasks that ask for a proxy) and, in `startup/`,
`sitecustomize`: its VMs' disk write limit in every process its driver starts), `catalogue/agents/<key>/`
(the reference `agent`; DigitalMate's `run` and `gateway` (product startup and task submission);
JiuwenSwarm's `agent` and mini-swe-agent's `run`, the wrappers that start them) and `catalogue/capabilities/<key>/` (the keyword-memory `capability`); `workspace` (and
JiuwenSwarm's `agent`, mini-swe-agent's `run` and SWE-agent's `run`, the wrappers that start them) and `catalogue/capabilities/<key>/` (the keyword-memory `capability`); `workspace` (and
`workspace_cli`, its shell command),
`cli` and `__main__` (the unified `nullius` and `python -m nullius` commands),
`paths` (user config, data and cache locations), `ondisk` (a file written whole then renamed into place, a lock, a digest), `prices` (the user's model price list: fetched on request and before a capped run; what a cost is estimated from), `migrate` (explicit copying of legacy checkout storage), `settings`, `hosts`, `constraints` (what Nullius may use on each machine: one table, the container and systemd scope probes, the warnings), `execution`, `progress` (what a run is doing, one line per stage), `prerequisites` (what a recipe needs of each machine it runs on, asked before Run and again as it starts), `onboarding` (the Getting started checklist: what this machine
Expand Down
178 changes: 178 additions & 0 deletions app/nullius/catalogue/agents/swe-agent/agent.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,178 @@
{
"schema": "nullius.agent/v1",
"key": "swe-agent",
"label": "SWE-agent",
"summary": "Princeton\u2019s software engineering agent with its upstream tool bundles.",
"upstream": {
"repository": "https://github.com/SWE-agent/SWE-agent",
"tag": "v1.1.0",
"tested": "0f3acafacabc0def8cc76b4e48acb4b6cf302cb9",
"version": "1.1.0",
"license": "MIT"
},
"install": {
"python": "3.12",
"project": ".",
"pip": [
"aiohappyeyeballs==2.7.1",
"aiohttp==3.14.5",
"aiosignal==1.4.0",
"annotated-doc==0.0.7",
"annotated-types==0.8.0",
"anyio==4.16.0",
"attrs==26.1.0",
"bashlex==0.18",
"bidict==0.24.1",
"blinker==1.9.0",
"boto3==1.44.9",
"botocore==1.44.9",
"certifi==2026.11.20",
"charset-normalizer==3.5.2",
"click==8.5.1",
"datasets==5.2.0",
"dill==0.4.1",
"distro==1.9.0",
"docstring-parser==0.18.0",
"fastapi==0.165.0",
"fastcore==2.2.46",
"fastspec==0.2.9",
"fasttransport==0.0.4",
"fastuuid==0.14.0",
"filelock==3.32.7",
"flask==3.1.3",
"flask-cors==6.0.5",
"flask-socketio==5.7.2",
"frozenlist==1.8.0",
"fsspec==2026.9.0",
"ghapi==2.1.5",
"gitdb==4.0.12",
"gitpython==3.2.1",
"h11==0.16.0",
"h2==4.4.1",
"hf-xet==1.8.0",
"hpack==4.2.0",
"httpcore==1.0.9",
"httpcore2==2.16.2",
"httpx==0.28.1",
"httpx2==2.16.2",
"huggingface-hub==1.33.0",
"hyperframe==6.1.0",
"idna==3.20",
"importlib-metadata==8.9.0",
"itsdangerous==2.2.0",
"jinja2==3.1.6",
"jiter==0.19.0",
"jmespath==1.1.0",
"jsonschema==4.26.0",
"jsonschema-specifications==2025.9.1",
"linkify-it-py==2.2.0",
"litellm==1.105.7",
"markdown-it-py==4.3.0",
"markupsafe==3.0.4",
"mdit-py-plugins==0.7.0",
"mdurl==0.1.2",
"multidict==7.2.1",
"multiprocess==0.70.19",
"numpy==2.5.5",
"openai==2.54.0",
"opentelemetry-api==1.45.2",
"packaging==26.3",
"pandas==3.1.1",
"pexpect==4.9.0",
"platformdirs==4.14.8",
"propcache==0.5.4",
"ptyprocess==0.7.0",
"pyarrow==26.0.1",
"pydantic==2.14.4",
"pydantic-core==2.50.5",
"pydantic-settings==2.16.3",
"pygments==2.21.0",
"python-dateutil==2.9.0.post0",
"python-dotenv==1.2.4",
"python-engineio==4.15.1",
"python-multipart==0.0.34",
"python-socketio==5.18.1",
"pyyaml==6.0.4",
"referencing==0.37.0",
"regex==2026.11.19",
"requests==2.34.2",
"rich==15.0.0",
"rich-argparse==1.8.0",
"rpds-py==2026.9.1",
"ruamel-yaml==0.19.1",
"s3transfer==0.19.3",
"simple-parsing==0.1.9",
"simple-websocket==1.1.0",
"six==1.17.0",
"smmap==5.0.3",
"sniffio==1.3.1",
"starlette==1.10.0",
"swe-rex==1.2.1",
"tabulate==0.10.0",
"tenacity==9.2.1",
"textual==8.2.8",
"tiktoken==0.14.0",
"tokenizers==0.23.3",
"tqdm==4.70.1",
"truststore==0.10.5",
"typing-extensions==4.16.0",
"typing-inspection==0.4.5",
"unidiff==1.0.1",
"urllib3==2.8.0",
"uvicorn==0.54.0",
"werkzeug==3.1.9",
"wsproto==1.3.2",
"xxhash==4.1.0",
"yarl==1.25.1",
"zipp==4.1.2"
]
},
"prepare": {
"run": [
"{install}/.venv/bin/python",
"{here}/run.py",
"prepare"
],
"network": true,
"seconds": 600
},
"start": {
"command": [
"{install}/.venv/bin/python",
"{here}/run.py",
"run",
"{prompt}"
]
},
"model": {
"apis": [
"chat"
],
"env": {
"NULLIUS_SWE_MODEL": "openai/{model}",
"NULLIUS_SWE_BASE": "{base_url}",
"NULLIUS_SWE_KEY": "{key}"
}
},
"offers": [
"agent.workspace/v1"
],
"proven": {
"agent.workspace/v1": {
"passed": "2/2",
"model": "openai/gpt-4.1",
"provider": "openrouter",
"version": "1.1.0",
"kit_version": 1,
"backend": "container",
"fixture": {
"image": "docker.io/swebench/sweb.eval.x86_64.django_1776_django-17087@sha256:fef77b052bf6729f7b6326b3b485b8a63ac1dc39b6e1c7040242aa2d3b2dc656",
"user": "0",
"kit": "agent-workspace-v1"
}
}
},
"only_for": [
"swe-bench-verified"
]
}
99 changes: 99 additions & 0 deletions app/nullius/catalogue/agents/swe-agent/run.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,99 @@
"""Start SWE-agent v1.1.0 through its public configuration and environment APIs.

Preparation calls its ToolHandler.install without creating a model. Execution
uses its default configuration and RunSingle, including its normal tool setup.
"""
import os
import importlib.util
from pathlib import Path
import sys
import subprocess
import json
import shutil
import shlex
from contextlib import contextmanager


def check_tool_python():
"""Refuse an incompatible task interpreter without replacing its environment."""
result = subprocess.run(
["python", "-c", "import json, sys; print(json.dumps(list(sys.version_info[:3])))"],
check=True, capture_output=True, text=True, timeout=30,
)
version = json.loads(result.stdout)
if tuple(version) < (3, 8):
raise RuntimeError(
"SWE-agent's default editor requires tree-sitter==0.21.3 (Python >=3.8); "
"the task PATH selects Python " + ".".join(map(str, version)) + ". "
"Nullius will not replace the benchmark's Python environment."
)


@contextmanager
def tool_staging(root=Path("/root/tools")):
"""Own only preparation's temporary uploads, not installed dependencies."""
if root.exists() or root.is_symlink():
raise RuntimeError("SWE-agent preparation requires an unused /root/tools directory")
try:
yield
finally:
if root.is_symlink():
root.unlink()
elif root.exists():
shutil.rmtree(root)


def main():
check_tool_python()
os.environ["PIP_CONSTRAINT"] = str(Path(__file__).with_name("tools.constraints.txt"))
# The pinned checkout is mounted read-only and owned by the host user.
# Permit GitPython's provenance lookup for this one path, process-locally.
source = Path(importlib.util.find_spec("sweagent").origin).parent.parent
index = int(os.environ.get("GIT_CONFIG_COUNT", "0"))
os.environ.update({"GIT_CONFIG_COUNT": str(index + 1),
f"GIT_CONFIG_KEY_{index}": "safe.directory",
f"GIT_CONFIG_VALUE_{index}": str(source)})
import yaml
from sweagent import REPO_ROOT
from sweagent.environment.swe_env import EnvironmentConfig, SWEEnv
from sweagent.tools.tools import ToolConfig, ToolHandler

config = yaml.safe_load((REPO_ROOT / 'config/default.yaml').read_text())
# SWE-ReX intentionally starts shells with a fresh environment. Use the
# upstream tool environment option for pip constraints and preparation's
# temporary proxy; normal execution receives no proxy variables.
values = config['agent']['tools'].setdefault('env_variables', {})
for name in ('PIP_CONSTRAINT', 'HTTP_PROXY', 'HTTPS_PROXY', 'NO_PROXY',
'http_proxy', 'https_proxy', 'no_proxy'):
if name in os.environ:
values[name] = os.environ[name]
# Set the task PATH once, before ToolHandler adds its bundle directories.
# ToolConfig.env_variables is applied again on reset and would hide them.
environment = {'deployment': {'type': 'local'},
'post_startup_commands': ['export PATH=' + shlex.quote(os.environ['PATH'])]}
if sys.argv[1] == 'prepare':
env = SWEEnv.from_config(EnvironmentConfig.model_validate(environment))
try:
env.start()
with tool_staging():
handler = ToolHandler(ToolConfig.model_validate(config['agent']['tools']))
handler.install(env)
# Installation checks before reset; ensure reset kept the tools.
for command in handler.config.commands:
env.communicate('command -v ' + shlex.quote(command.name), check='raise')
finally:
env.close()
return
from sweagent.run.run_single import RunSingle, RunSingleConfig
environment['repo'] = {'type': 'preexisting', 'repo_name': str(Path.cwd()).lstrip('/')}
config['env'] = environment
config['agent']['model'] = {'name': os.environ['NULLIUS_SWE_MODEL'],
'api_base': os.environ['NULLIUS_SWE_BASE'],
'api_key': os.environ['NULLIUS_SWE_KEY']}
config['problem_statement'] = {'type': 'text', 'text': sys.argv[2]}
config['output_dir'] = str(Path.home() / 'swe-agent-output')
RunSingle.from_config(RunSingleConfig.model_validate(config)).run()


if __name__ == '__main__':
main()
3 changes: 3 additions & 0 deletions app/nullius/catalogue/agents/swe-agent/tools.constraints.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
# Upstream edit_anthropic/install.sh dependencies, constrained without editing it.
tree-sitter==0.21.3
tree-sitter-languages==1.10.2
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
"On Nullius, the agent can reach only its model. The tests get internet access after the agent ends.",
"The prompt is the issue's title and body, without the hints, as on the leaderboard.",
"Each instance's image is pinned. An image the authors rebuild is not used until the pin is refreshed.",
"SWE-agent, the authors' own agent, runs only on Harbor."
"SWE-agent passes its root workspace fixture and requires task Python >=3.8. A scored instance remains unproven; the selected attempt ended at its spending cap before grading."
],
"datasets": [
{
Expand Down
36 changes: 1 addition & 35 deletions app/nullius/standard/backends/container.py
Original file line number Diff line number Diff line change
Expand Up @@ -116,6 +116,7 @@

from nullius import constraints, ondisk, paths
from nullius.standard.contract import definitions
from nullius.standard.contract.definitions import step_problems
from nullius.standard.requirements import install

def _runs_podman(path: str) -> bool:
Expand Down Expand Up @@ -1284,7 +1285,6 @@ def stop(self):
PYTHON_VERSION = "3.12.14" # the standalone Python an agent started as python3 runs on there; moves with UV_VERSION
_PULL = re.compile(r"^[a-z0-9][a-z0-9._/:-]*@sha256:[0-9a-f]{64}$")
IMAGE_SPEC = ("build", "pull", "memory_mb", "cpus")
STEP = ("copy", "write", "run", "collect", "seconds", "network", "keep_processes")
KEEP_ALIVE = ["sh", "-c", "while :; do sleep 3600; done"]
INIT = "/usr/sbin/docker-init" # what --init mounts: docker's, not the unit's

Expand Down Expand Up @@ -1387,40 +1387,6 @@ def task_env_problems(env, reserved: Iterable[str] = ()) -> List[str]:
return bad


def step_problems(step, *, collect: bool) -> List[str]:
"""What is wrong with a step run in a unit's box (``verify``, ``solve``):
``copy`` {relative path in the upstream: absolute path inside}, ``write``
{absolute path inside: its text - a file the driver has by content, an
eval script or a patch the dataset carries}, ``run``
(argv), ``collect`` (a folder inside, ``verify`` only), ``seconds``,
``network`` (true: a way out to public addresses, :meth:`Box.online`),
``keep_processes`` (``verify`` only - true: what the agent left running is
not stopped before the check, :meth:`Box.settle`)."""
if not isinstance(step, dict):
return ["a step: {copy?, write?, run, collect?, seconds?, network?, keep_processes?}"]
bad = [f"{k}: not a field ({', '.join(STEP)})" for k in step
if k not in STEP or (k in ("collect", "keep_processes") and not collect)]
run = step.get("run")
if not isinstance(run, list) or not run or not all(isinstance(w, str) and w for w in run):
bad.append("run: the command, a list of words")
copy = step.get("copy") or {}
if not isinstance(copy, dict) or not all(isinstance(d, str) and d.startswith("/") for d in copy.values()):
bad.append("copy: {path in the upstream: absolute path inside}")
write = step.get("write") or {}
if not isinstance(write, dict) or not all(isinstance(d, str) and d.startswith("/") and isinstance(t, str)
for d, t in write.items()):
bad.append("write: {absolute path inside: the file's text}")
if "collect" in step and not (isinstance(step["collect"], str) and step["collect"].startswith("/")):
bad.append("collect: an absolute path inside")
if "seconds" in step and (not isinstance(step["seconds"], (int, float)) or step["seconds"] <= 0):
bad.append("seconds: a positive number")
if "network" in step and not isinstance(step["network"], bool):
bad.append("network: true or false")
if "keep_processes" in step and not isinstance(step["keep_processes"], bool):
bad.append("keep_processes: true or false")
return bad


def own_context(path: str) -> Dict[str, str]:
"""An own image's build context: every file of its folder, by its path
there, and its sha256."""
Expand Down
12 changes: 11 additions & 1 deletion app/nullius/standard/cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -505,10 +505,17 @@ def _retries(value: str) -> int:

def cmd_conform(a):
o = _other(a.other)
if a.max_usd_per_unit is not None:
try:
price_list.update()
except ValueError as e:
print("refused: capped conformance needs current model prices:", e)
return 2
try:
got = conform.check(o, model=a.model, provider=a.provider, which=a.port or None, jobs_root=a.jobs, say=print,
unsandboxed=a.unsandboxed, stamp=a.stamp, backend=a.backend, env=run_env(a.provider) if a.from_run else None,
options=options(a.option), repeat=a.repeat)
options=options(a.option), repeat=a.repeat, fixture_image=a.fixture_image,
max_usd_per_unit=a.max_usd_per_unit, max_calls=a.max_calls)
except run.Refused as e:
print("refused:", e)
return 2
Expand Down Expand Up @@ -805,6 +812,9 @@ def main(argv=None):
if name == "fidelity":
p.add_argument("--passes", type=int, default=2, help="runs of each way (default 2: the second shows the noise)")
elif name == "conform":
p.add_argument("--fixture-image", help="digest-pinned root image for the workspace kit")
p.add_argument("--max-usd-per-unit", type=float, help="spending cap per kit check")
p.add_argument("--max-calls", type=int, help="model call cap per kit check")
p.add_argument("--port", type=definitions.names.port, action="append", help="only this port's kit (repeatable)")
p.add_argument("--stamp", help="the time stamp the kit jobs are named with (default: now)")
p.add_argument("--attempts", "--repeat", dest="repeat", type=int, default=1, metavar="K",
Expand Down
Loading