Skip to content

Official Codebase of 3DCodeVerse

Python

eval: the bare-agent arm — the same vendor agent, the same minutes and a Blender, without the harness

gaoypenge00f0d4993cf
diff --git a/eval/bench/_bare_agent.py b/eval/bench/_bare_agent.py
new file mode 100644
index 00000000..9ff4fb9f
--- /dev/null
+++ b/eval/bench/_bare_agent.py
@@ -0,0 +1,93 @@
+"""The bare-agent arm of ``bench/compare_backends.py``: a vendor coding agent with a shell and nothing else.
+
+The strongest objection to the harness is not "a model asked once does worse" — it is "give the SAME
+agent the SAME minutes and a Blender, and it does as well on its own". This arm answers that: the same
+vendor CLI and model the harness drives (``agent:gemini-cli:gemini-3.7-flash``), the one-shot arm's
+brief and minimal contract, a shell with the machine's own tools (Blender, node + three + puppeteer,
+python + moderngl, glslangValidator) and the harness arm's wall clock. It gets no plan, no 3dcode MCP
+tools, no cookbook, no gates, no judge, no starter library and no deterministic repairs — the agent
+decides for itself whether and how to build, render and look.
+
+The delivered file(s) are then scored by the SAME fixed evaluator as every other arm.
+"""
+
+from __future__ import annotations
+
+import shutil
+from pathlib import Path
+
+from bench._oneshot import files_for
+from codeverse3d.agents.registry import get_coding_agent
+from codeverse3d.config import get_settings
+from codeverse3d.contracts.agent import AgentJob, AgentResult
+from codeverse3d.contracts.common import Language
+from codeverse3d.contracts.spec import Spec
+from codeverse3d.workspace import Workspace
+
+HARNESS = Path(__file__).resolve().parents[2] / "harness"
+NODE_MODULES = HARNESS / "runtime_js" / "node_modules"
+GLSLANG = Path.home() / "3dcodeverse_data" / "tools" / "glslang" / "bin" / "glslangValidator"
+
+
+def _tools_note(language: Language) -> str:
+ blender = get_settings().resolve_blender()
+ if language in (Language.BLENDER, Language.URDF_BLENDER):
+ return (f"Blender is installed: `{blender} --background --factory-startup --python src/model.py` runs your "
+ "script headless. You may write your own throwaway scripts under tmp/ (e.g. to export a GLB, check "
+ "bounding boxes, or render PNGs with Eevee/Cycles and then open the PNGs to look at them).")
+ if language is Language.GLSL_SHADER:
+ return (f"`{GLSLANG}` validates GLSL; python3 has moderngl, numpy and Pillow, so you can write your own "
+ "offscreen renderer under tmp/ (prepend the uniforms above, draw a fullscreen quad, save PNGs at a "
+ "few times) and open the PNGs to look at them.")
+ if language is Language.SCENE_THREEJS:
+ return (f"node is installed; `{NODE_MODULES}` contains three (r182) and puppeteer with a cached headless "
+ "Chrome (set NODE_PATH to it, or import by absolute path). You may write your own throwaway "
+ "harness under tmp/ that loads src/scene.js in headless Chrome, renders the cameras to PNGs, and "
+ "open the PNGs to look at them.")
+ return ""
+
+
+def bare_agent_prompt(spec: Spec, minutes: float) -> str:
+ """The one-shot arm's brief + minimal contract, with the output rule replaced by a working session."""
+ from bench._oneshot import oneshot_prompt, output_rule
+
+ brief = oneshot_prompt(spec)
+ brief = brief[: brief.rfind(output_rule(spec.language))].rstrip()
+ brief = brief.replace(" — there is no second chance", "")
+ files = ", ".join(f"`{f}`" for f in files_for(spec.language))
+ return (brief + "\n\n"
+ f"You are working in the current directory. Write the deliverable to {files} (relative to the current "
+ "directory) — only those files are collected and judged; anything else you create is discarded. The "
+ "contract's rules (no render/export/file calls, allowed imports) apply to the deliverable only; your own "
+ "throwaway scripts under tmp/ may do anything. "
+ "You have a shell: build, test, render and inspect your work as much as you find useful, and iterate "
+ f"until you are satisfied. " + _tools_note(spec.language) + " "
+ f"Your session is cut off after about {minutes:.0f} minutes; make sure a complete, working version of "
+ "the file is on disk early and improve it from there.")
+
+
+def run_bare_agent(spec: Spec, target: str, cell: Path, eval_ws: Workspace, *, minutes: float) -> AgentResult:
+ """Run the session in ``cell/agent`` and copy the deliverable into ``eval_ws``. Resumable: a finished
+ session (``cell/agent/.bare_done.json``) is not re-run."""
+ ws = Workspace(cell / "agent")
+ done = ws.root / ".bare_done.json"
+ if done.is_file():
+ result = AgentResult.model_validate_json(done.read_text())
+ else:
+ if ws.exists():
+ shutil.rmtree(ws.root)
+ ws.create()
+ (ws.root / "tmp").mkdir(exist_ok=True)
+ job = AgentJob(workspace=str(ws.root), prompt=bare_agent_prompt(spec, minutes), label="bare",
+ timeout_s=int(minutes * 60), spatial_tools=False, write_roots=["src", "tmp"],
+ kind="baseline", language=spec.language.value, track=spec.track.value,
+ env={"NODE_PATH": str(NODE_MODULES)})
+ result = get_coding_agent(target).run(job)
+ done.write_text(result.model_dump_json(indent=1))
+ for rel in files_for(spec.language):
+ src = ws.root / rel
+ if src.is_file():
+ dst = eval_ws.root / rel
+ dst.parent.mkdir(parents=True, exist_ok=True)
+ shutil.copy2(src, dst)
+ return result
diff --git a/eval/bench/compare_backends.py b/eval/bench/compare_backends.py
index afc19a33..58671c16 100644
--- a/eval/bench/compare_backends.py
+++ b/eval/bench/compare_backends.py
@@ -95,7 +95,7 @@ from codeverse3d.workspace import Workspace # noqa: E402
log = logging.getLogger(__name__)
-ArmKind = Literal["harness", "oneshot", "oneshot+repair"]
+ArmKind = Literal["harness", "oneshot", "oneshot+repair", "agent"]
# ----------------------------------------------------------------------------- arms / options
@@ -111,9 +111,13 @@ class Arm(BaseModel):
def parse_arm(text: str) -> Arm:
kind, sep, target = text.strip().partition(":")
- if not sep or not target or kind not in ("harness", "oneshot", "oneshot+repair"):
- raise ValueError(f"bad arm {text!r}: expected harness:<generator-id> | oneshot:<target> | oneshot+repair:<target>")
- if kind != "harness":
+ if not sep or not target or kind not in ("harness", "oneshot", "oneshot+repair", "agent"):
+ raise ValueError(f"bad arm {text!r}: expected harness:<generator-id> | oneshot:<target> | oneshot+repair:<target>"
+ " | agent:<generator-id>")
+ if kind == "agent":
+ from codeverse3d.agents.registry import parse_agent_id
+ parse_agent_id(target) # validates the vendor id early
+ elif kind != "harness":
get_oneshot_backend(target) # validates the target early
return Arm(raw=text.strip(), kind=kind, target=target) # type: ignore[arg-type]
@@ -148,7 +152,7 @@ class CompareOptions(BaseModel):
def spec_for(battery: Battery, item: BenchPrompt, arm: Arm, opts: CompareOptions) -> Spec:
- generator = arm.target if arm.kind == "harness" else f"single-shot:{arm.target}"
+ generator = arm.target if arm.kind in ("harness", "agent") else f"single-shot:{arm.target}"
backends = get_settings().backends(generator=generator, judge=opts.loop_judge, planner=opts.planner)
return build_spec(battery, item, backends=backends, rounds=opts.rounds,
max_minutes=opts.max_minutes, tag0="compare", extra_tags=(arm.kind,))
@@ -277,6 +281,24 @@ def _run_harness(spec: Spec, cell: Path, eval_ws: Workspace, opts: CompareOption
shutil.copytree(run_ws.root / "public", eval_ws.root / "public", dirs_exist_ok=True)
+def _run_bare_agent(arm: Arm, spec: Spec, cell: Path, eval_ws: Workspace, opts: CompareOptions,
+ deps: CompareDeps, res: CellResult) -> None:
+ """``agent:<generator-id>``: the same vendor CLI with a shell and the harness arm's minutes, nothing else
+ (``bench/_bare_agent.py``)."""
+ from bench._bare_agent import run_bare_agent
+
+ if spec.track is Track.SCENE: # the render host's scaffold, exactly as a one-shot scene cell gets it
+ deps.evaluator.runtime(spec.language).skeleton(eval_ws, None)
+ result = run_bare_agent(spec, arm.target, cell, eval_ws, minutes=opts.max_minutes)
+ res.gen_cost_usd = result.usage.cost_usd
+ res.tool_calls = result.tool_calls
+ res.gen_seconds = result.duration_s
+ res.harness_status = result.exit_reason
+ if not (eval_ws.root / entry_of(spec)).is_file():
+ res.error = f"bare agent delivered no {entry_of(spec)} ({result.exit_reason}: {'; '.join(result.errors)[:300]})"
+ res.error_is_infra = bool(result.transient)
+
+
def _new_cell(item: BenchPrompt, arm: Arm, out: Path, opts: CompareOptions) -> tuple[Path, CellResult]:
"""The cell's directory and its identity row. ONE place knows what identifies a row,
so run_matrix's synthesized last-resort row is shaped like every real one."""
@@ -299,6 +321,8 @@ def run_cell(battery: Battery, item: BenchPrompt, arm: Arm, out: Path, opts: Com
with run_ledger(cell, run=f"{item.id}:{arm.slug}"):
if arm.kind == "harness":
_run_harness(spec, cell, eval_ws, opts, deps, res)
+ elif arm.kind == "agent":
+ _run_bare_agent(arm, spec, cell, eval_ws, opts, deps, res)
else:
_generate_oneshot(arm, spec, cell, eval_ws, opts, deps, res)
# A one-shot arm whose LAST attempt was lost to the provider has not finished
@@ -307,7 +331,7 @@ def run_cell(battery: Battery, item: BenchPrompt, arm: Arm, out: Path, opts: Com
# evaluated and scored 0 — a hard zero for someone else's downtime, the exact
# asymmetry tests/compare_bench/test_infra_failures.py exists to end. Drop the
# cell instead (infra_failed); --redo-status re-runs the lost attempt only.
- truncated = arm.kind != "harness" and res.error_is_infra
+ truncated = arm.kind not in ("harness", "agent") and res.error_is_infra
if (eval_ws.root / entry_of(spec)).is_file() and not truncated:
outcome = deps.evaluator.evaluate(eval_ws, spec)
eval_ws.write_json(eval_ws.root / "eval.json", outcome)
diff --git a/eval/docs/EVAL.md b/eval/docs/EVAL.md
index 5eec8ab6..55f5ef9e 100644
--- a/eval/docs/EVAL.md
+++ b/eval/docs/EVAL.md
@@ -97,6 +97,16 @@ Arms:
plan, repair); `x` ∈ `claude-code[:model]` · `codex[:model]` · `gemini|anthropic|openai:<model>`.
* `oneshot+repair:<x>` — same plus ≤ `--repair-attempts` build-error-feedback retries
(labelled; never judge feedback).
+* `agent:<generator-id>` — the **bare agent** (`bench/_bare_agent.py`, 2026-09-22): the same vendor
+ CLI and model the harness drives, the one-shot brief + minimal contract, a shell with the
+ machine's own tools (Blender, node + three + puppeteer, python + moderngl, glslangValidator) and
+ `--max-minutes` of wall clock — and no plan, no 3dcode MCP tools, no cookbook, no gates, no
+ judge, no starter library, no deterministic repairs. It answers "give the same agent the same
+ minutes and a Blender": the harness's lift over it is what the harness itself adds. Smoke
+ (dining chair, 15 min): the agent wrote its own test + render scripts, looked at its PNGs, 0.682.
+ Two known asymmetries: a session killed by a 503 storm has no single-shot fallback (the harness
+ has D68), so on a storm day this arm loses more cells to `infra_failed`; and its USD is 0 when
+ the CLI dies before printing stats.
Every arm ends with a `src/model.py` copied into a fresh eval workspace and scored by
the same `FixedEvaluator` (`BlenderRuntime` lint+build → measure → connectivity →
diff --git a/eval/tests/test_bare_agent.py b/eval/tests/test_bare_agent.py
new file mode 100644
index 00000000..8811feff
--- /dev/null
+++ b/eval/tests/test_bare_agent.py
@@ -0,0 +1,70 @@
+"""The bare-agent arm: same brief and contract as one-shot, a working session instead of an answer (offline)."""
+
+from __future__ import annotations
+
+import sys
+from pathlib import Path
+
+import pytest
+
+REPO = Path(__file__).resolve().parents[1]
+if str(REPO) not in sys.path:
+ sys.path.insert(0, str(REPO))
+
+from bench._bare_agent import bare_agent_prompt, run_bare_agent # noqa: E402
+from bench._oneshot import output_rule # noqa: E402
+from bench.compare_backends import parse_arm # noqa: E402
+from codeverse3d.contracts.agent import AgentJob, AgentResult # noqa: E402
+from codeverse3d.contracts.common import Language, Track # noqa: E402
+from codeverse3d.contracts.spec import Constraints, Spec # noqa: E402
+from codeverse3d.workspace import Workspace # noqa: E402
+
+
+def _spec(track: Track = Track.STATIC_OBJECT, language: Language = Language.BLENDER) -> Spec:
+ return Spec(id="t/stool", track=track, language=language, prompt="a three-legged stool",
+ constraints=Constraints(must_have=["round seat"]))
+
+
+def test_parse_agent_arm():
+ arm = parse_arm("agent:gemini-cli:gemini-3.7-flash")
+ assert arm.kind == "agent" and arm.target == "gemini-cli:gemini-3.7-flash"
+ assert arm.slug == "agent_gemini-cli_gemini-3.7-flash"
+ with pytest.raises(ValueError):
+ parse_arm("agent:nope:model")
+
+
[email protected]("language,track,entry", [
+ (Language.BLENDER, Track.STATIC_OBJECT, "src/model.py"),
+ (Language.URDF_BLENDER, Track.ARTICULATED_OBJECT, "src/robot.urdf"),
+ (Language.GLSL_SHADER, Track.GRAPHICS, "src/shader.frag"),
+ (Language.SCENE_THREEJS, Track.SCENE, "src/scene.js"),
+])
+def test_prompt_keeps_brief_and_contract_but_not_the_no_tools_rule(language, track, entry):
+ p = bare_agent_prompt(_spec(track, language), 45)
+ assert "a three-legged stool" in p and "MUST HAVE: round seat" in p and entry in p
+ assert output_rule(language) not in p and "NO tools" not in p and "no second chance" not in p
+ assert "You have a shell" in p and "45 minutes" in p
+ # nothing of the harness: no plan, no MCP tools, no cookbook, no starter library
+ assert "cookbook" not in p.lower() and "mcp" not in p.lower() and "src/lib" not in p
+
+
+class _FakeAgent:
+ def __init__(self) -> None:
+ self.jobs: list[AgentJob] = []
+
+ def run(self, job: AgentJob) -> AgentResult:
+ self.jobs.append(job)
+ (Path(job.workspace) / "src" / "model.py").write_text("import bpy\n")
+ return AgentResult(ok=True, exit_reason="completed")
+
+
+def test_run_copies_the_deliverable_and_resumes(tmp_path, monkeypatch):
+ agent = _FakeAgent()
+ monkeypatch.setattr("bench._bare_agent.get_coding_agent", lambda target: agent)
+ eval_ws = Workspace(tmp_path / "eval").create()
+ r = run_bare_agent(_spec(), "gemini-cli:gemini-3.7-flash", tmp_path, eval_ws, minutes=10)
+ assert r.ok and (eval_ws.root / "src" / "model.py").read_text() == "import bpy\n"
+ job = agent.jobs[0]
+ assert job.spatial_tools is False and job.timeout_s == 600 and job.write_roots == ["src", "tmp"]
+ run_bare_agent(_spec(), "gemini-cli:gemini-3.7-flash", tmp_path, eval_ws, minutes=10)
+ assert len(agent.jobs) == 1 # a finished session is not re-run