Harden builder sandbox package install
All checks were successful
build / build (push) Successful in 10s

This commit is contained in:
robert
2026-06-07 22:10:23 -03:00
parent aba68aaf2e
commit cd1c661109
4 changed files with 12 additions and 3 deletions

View File

@@ -1,5 +1,5 @@
name: agent-builder name: agent-builder
version: 0.1.1 version: 0.1.4
entrypoint: agent:AgentBuilder entrypoint: agent:AgentBuilder
description: Generate, test, and deploy new a2a agents from natural language. description: Generate, test, and deploy new a2a agents from natural language.
expose: expose:

View File

@@ -49,7 +49,7 @@ class AgentBuilder(A2AAgent[BuilderConfig, NoAuth]):
"Writes the project into the user's workspace, validates it in a " "Writes the project into the user's workspace, validates it in a "
"sandbox, then ships it via the control plane." "sandbox, then ships it via the control plane."
) )
version = "0.1.3" version = "0.1.4"
config_model = BuilderConfig config_model = BuilderConfig
auth_model = NoAuth auth_model = NoAuth

View File

@@ -34,6 +34,7 @@ if TYPE_CHECKING:
A2A_PACK_MIN_VERSION = "0.1.80" A2A_PACK_MIN_VERSION = "0.1.80"
A2A_PACK_SANDBOX_FALLBACK_VERSION = "0.1.79"
logger = logging.getLogger(__name__) logger = logging.getLogger(__name__)
@@ -468,7 +469,13 @@ def build_tools(ctx: ToolContext) -> list[Any]:
script = ( script = (
"set -e\n" "set -e\n"
"export PYTHONDONTWRITEBYTECODE=1\n" "export PYTHONDONTWRITEBYTECODE=1\n"
f"pip install --quiet 'a2a-pack>={A2A_PACK_MIN_VERSION}' >/dev/null\n" "python -m pip install --quiet "
f"'a2a-pack>={A2A_PACK_MIN_VERSION}' >/dev/null || "
"(echo 'a2a-pack>="
f"{A2A_PACK_MIN_VERSION} unavailable; falling back to "
f"a2a-pack=={A2A_PACK_SANDBOX_FALLBACK_VERSION} for sandbox card validation' >&2; "
"python -m pip install --quiet --index-url https://pypi.org/simple "
f"'a2a-pack=={A2A_PACK_SANDBOX_FALLBACK_VERSION}' >/dev/null)\n"
"mkdir -p /tmp/agent\n" "mkdir -p /tmp/agent\n"
f"echo '{b64}' | base64 -d | tar -xzf - -C /tmp/agent\n" f"echo '{b64}' | base64 -d | tar -xzf - -C /tmp/agent\n"
"cd /tmp/agent\n" "cd /tmp/agent\n"

View File

@@ -342,6 +342,8 @@ class TemplateInitTests(unittest.TestCase):
"export PYTHONDONTWRITEBYTECODE=1", "export PYTHONDONTWRITEBYTECODE=1",
str(sandbox.calls[0]["script"]), str(sandbox.calls[0]["script"]),
) )
self.assertIn("a2a-pack>=0.1.80 unavailable", str(sandbox.calls[0]["script"]))
self.assertIn("a2a-pack==0.1.79", str(sandbox.calls[0]["script"]))
self.assertEqual(_FakeAsyncClient.posts, []) self.assertEqual(_FakeAsyncClient.posts, [])
def test_cp_deploy_tarball_posts_agent_dsl(self) -> None: def test_cp_deploy_tarball_posts_agent_dsl(self) -> None: