Forward sandbox into agent builder backend
All checks were successful
build / build (push) Successful in 4s

This commit is contained in:
robert
2026-06-03 21:51:30 -03:00
parent 74c99643b4
commit bc8de5a7ae
3 changed files with 60 additions and 4 deletions

View File

@@ -27,6 +27,8 @@ class BuilderPromptTests(unittest.TestCase):
"config={\"recursion_limit\": DEEPAGENTS_RECURSION_LIMIT}",
agent_source,
)
self.assertIn("sandbox = ctx.sandbox", agent_source)
self.assertIn("sandbox=sandbox", agent_source)
self.assertIn("stream=True", agent_source)
self.assertIn('grant_write_prefixes=("agents/{name}/",)', agent_source)
@@ -256,3 +258,37 @@ inline = Pricing(price_per_call_usd=0.01, compute={"runtime_seconds": 600}, tota
result.matches,
[{"path": "/agents/github-repo-inspector/agent.py"}],
)
def test_project_backend_grep_compat_preserves_sandbox_kwargs(self) -> None:
class _Backend:
def __init__(
self,
workspace: object,
*,
sandbox: object | None = None,
default_image: str = "python:3.11-slim",
) -> None:
self.workspace = workspace
self.sandbox = sandbox
self.default_image = default_image
def grep(
self,
pattern: str,
path: str | None = None,
glob: str | None = None,
):
return type("GrepResult", (), {"error": None, "matches": []})()
workspace = object()
sandbox = object()
backend = _workspace_backend_with_grep_compat(
_Backend,
workspace,
sandbox=sandbox,
default_image="python:3.12-slim",
)
self.assertIs(backend.workspace, workspace)
self.assertIs(backend.sandbox, sandbox)
self.assertEqual(backend.default_image, "python:3.12-slim")