From e98ce7aaf22893ffb8e2463af6d0608a9e7d3db7 Mon Sep 17 00:00:00 2001 From: Quang Nguyen Date: Wed, 18 Nov 2026 01:35:08 +0000 Subject: [PATCH 01/10] feat(create): Add the agent-python-minimal-box template --- src/core/project/templates/boxProfile.test.ts | 2 ++ src/handlers/project/create/create.screen.test.tsx | 4 ++-- src/handlers/project/project.test.ts | 2 ++ src/handlers/project/shortcuts.test.ts | 1 + src/handlers/project/shortcuts.ts | 12 ++++++++++++ 5 files changed, 19 insertions(+), 2 deletions(-) diff --git a/src/core/project/templates/boxProfile.test.ts b/src/core/project/templates/boxProfile.test.ts index f0bbfb772..863582587 100644 --- a/src/core/project/templates/boxProfile.test.ts +++ b/src/core/project/templates/boxProfile.test.ts @@ -837,6 +837,8 @@ describe("startsInBoxOnCodeZip", () => { test("starts only the CodeZip box template in a box", () => { const plain = (name: RuntimeTemplateShortcutName) => resolveRuntimeTemplateShortcut(name); expect(startsInBoxOnCodeZip(plain("agent-python-strands-box"))).toBe(true); + expect(startsInBoxOnCodeZip(plain("agent-python-minimal-box"))).toBe(true); + expect(startsInBoxOnCodeZip(plain("agent-python-minimal"))).toBe(false); expect(startsInBoxOnCodeZip(plain("agent-python-strands"))).toBe(false); expect(startsInBoxOnCodeZip(plain("mcp-python-fastmcp"))).toBe(false); expect(startsInBoxOnCodeZip(plain("agent-python-strands-box-container"))).toBe(false); diff --git a/src/handlers/project/create/create.screen.test.tsx b/src/handlers/project/create/create.screen.test.tsx index 6d63f5857..5f278ea9d 100644 --- a/src/handlers/project/create/create.screen.test.tsx +++ b/src/handlers/project/create/create.screen.test.tsx @@ -19,7 +19,7 @@ import { import { createRootHandler } from "../../index"; import { InputValidationError } from "../../../errors"; import type { AppIO } from "../../../io"; -import { resolveRuntimeTemplateShortcut } from "../shortcuts"; +import { PROJECT_TEMPLATE_NAMES, resolveRuntimeTemplateShortcut } from "../shortcuts"; import type { CreateProjectInput } from "../types"; import { ProjectSpecSchema } from "../../../projectSchemas/project"; import { RegionKey } from "../../keys"; @@ -1138,7 +1138,7 @@ describe("project create wizard", () => { await r.press("return"); await waitForText(r.lastFrame, "choose a template"); // empty is the last option in the list. - for (let i = 0; i < 12; i++) await r.press("down"); + for (let i = 0; i < PROJECT_TEMPLATE_NAMES.length - 1; i++) await r.press("down"); await waitForText(r.lastFrame, "● empty"); await r.press("return"); diff --git a/src/handlers/project/project.test.ts b/src/handlers/project/project.test.ts index ea3b79558..52f2374a3 100644 --- a/src/handlers/project/project.test.ts +++ b/src/handlers/project/project.test.ts @@ -143,7 +143,9 @@ describe("project create", () => { test.each([ ["agent-python-strands-box", { version: BOX_RELEASE.version }], ["agent-python-strands-box-container", { version: BOX_RELEASE.version }], + ["agent-python-minimal-box", { version: BOX_RELEASE.version }], ["agent-python-strands", undefined], + ["agent-python-minimal", undefined], ["agent-python-strands-container", undefined], ] as const)("create --template %s writes the runtime's box %j", async (template, box) => { const { path: directory, cleanup } = await inTempDirectory(); diff --git a/src/handlers/project/shortcuts.test.ts b/src/handlers/project/shortcuts.test.ts index 71648bc66..d43d7c7d5 100644 --- a/src/handlers/project/shortcuts.test.ts +++ b/src/handlers/project/shortcuts.test.ts @@ -18,6 +18,7 @@ describe("template order", () => { "agent-python-langchain", "environment-python-bma", "agent-python-minimal", + "agent-python-minimal-box", "agent-typescript-strands", "agent-typescript-vercel", "a2a-python-strands", diff --git a/src/handlers/project/shortcuts.ts b/src/handlers/project/shortcuts.ts index 079260493..518533750 100644 --- a/src/handlers/project/shortcuts.ts +++ b/src/handlers/project/shortcuts.ts @@ -133,6 +133,18 @@ export const RUNTIME_TEMPLATE_SHORTCUTS = { supportsModelProviderOverride: false, runtimeVersion: "PYTHON_3_14", }, + "agent-python-minimal-box": { + runtimeName: "agent_python_minimal_box", + description: "minimal Python project in Strands Box, no agent framework", + build: "CodeZip", + language: "Python", + framework: "none", + modelProvider: "Bedrock", + includesMemory: false, + box: true, + supportsModelProviderOverride: false, + runtimeVersion: "PYTHON_3_14", + }, "agent-python-strands": { runtimeName: "agent_python_strands", description: "Strands agent with AgentCore Memory, Bedrock or another model provider", From 4ed1626916e92484bd69066887e272bea73b2a60 Mon Sep 17 00:00:00 2001 From: Quang Nguyen Date: Wed, 18 Nov 2026 01:41:05 +0000 Subject: [PATCH 02/10] feat(create): Add the agent-python-langchain-box template --- .../project/create/create.screen.test.tsx | 24 +++++++------------ src/handlers/project/shortcuts.test.ts | 1 + src/handlers/project/shortcuts.ts | 12 ++++++++++ 3 files changed, 22 insertions(+), 15 deletions(-) diff --git a/src/handlers/project/create/create.screen.test.tsx b/src/handlers/project/create/create.screen.test.tsx index 5f278ea9d..a5a2a7394 100644 --- a/src/handlers/project/create/create.screen.test.tsx +++ b/src/handlers/project/create/create.screen.test.tsx @@ -28,6 +28,12 @@ import { credentialEnvVarName } from "../../../projectSchemas/credential"; import { DEFAULT_MODEL_IDS } from "../../../projectSchemas/runtime"; import { modelProviderOverridableCnMessage } from "../../../core/project/manager"; +/** Moves the template list's cursor from its first entry down to `name`. */ +async function selectTemplate(r: ReturnType, name: string): Promise { + const index = PROJECT_TEMPLATE_NAMES.indexOf(name as (typeof PROJECT_TEMPLATE_NAMES)[number]); + for (let i = 0; i < index; i++) await r.press("down"); +} + const cleanups: Array<() => Promise> = []; afterEach(cleanupScreens); @@ -1019,11 +1025,7 @@ describe("project create wizard", () => { await r.press("down"); // code-based await r.press("return"); await waitForText(r.lastFrame, "choose a template"); - await r.press("down"); // agent-python-strands-box - await r.press("down"); // agent-python-strands-container - await r.press("down"); // agent-python-strands-box-container - await r.press("down"); // agent-python-langchain - await r.press("down"); // environment-python-bma + await selectTemplate(r, "environment-python-bma"); await waitForText(r.lastFrame, "● environment-python-bma"); await r.press("return"); await waitForText(r.lastFrame, "this project will be created"); @@ -1049,12 +1051,7 @@ describe("project create wizard", () => { await r.press("down"); // code-based await r.press("return"); await waitForText(r.lastFrame, "choose a template"); - await r.press("down"); // agent-python-strands-box - await r.press("down"); // agent-python-strands-container - await r.press("down"); // agent-python-strands-box-container - await r.press("down"); // agent-python-langchain - await r.press("down"); // environment-python-bma - await r.press("down"); // agent-python-minimal + await selectTemplate(r, "agent-python-minimal"); await waitForText(r.lastFrame, "● agent-python-minimal "); await r.press("return"); @@ -1095,10 +1092,7 @@ describe("project create wizard", () => { await r.press("return"); await waitForText(r.lastFrame, "choose a template"); - await r.press("down"); // agent-python-strands-box - await r.press("down"); // agent-python-strands-container - await r.press("down"); // agent-python-strands-box-container - await r.press("down"); // agent-python-langchain + await selectTemplate(r, "agent-python-langchain"); await waitForText(r.lastFrame, "● agent-python-langchain"); await r.press("return"); diff --git a/src/handlers/project/shortcuts.test.ts b/src/handlers/project/shortcuts.test.ts index d43d7c7d5..9edad0f91 100644 --- a/src/handlers/project/shortcuts.test.ts +++ b/src/handlers/project/shortcuts.test.ts @@ -16,6 +16,7 @@ describe("template order", () => { "agent-python-strands-container", "agent-python-strands-box-container", "agent-python-langchain", + "agent-python-langchain-box", "environment-python-bma", "agent-python-minimal", "agent-python-minimal-box", diff --git a/src/handlers/project/shortcuts.ts b/src/handlers/project/shortcuts.ts index 518533750..82e1f5bcd 100644 --- a/src/handlers/project/shortcuts.ts +++ b/src/handlers/project/shortcuts.ts @@ -219,6 +219,18 @@ export const RUNTIME_TEMPLATE_SHORTCUTS = { supportsModelProviderOverride: false, runtimeVersion: "PYTHON_3_14", }, + "agent-python-langchain-box": { + runtimeName: "agent_python_langchain_box", + description: "LangChain agent in Strands Box with Bedrock for inference", + build: "CodeZip", + language: "Python", + framework: "langchain", + modelProvider: "Bedrock", + includesMemory: false, + box: true, + supportsModelProviderOverride: false, + runtimeVersion: "PYTHON_3_14", + }, "agent-typescript-vercel": { runtimeName: "agent_typescript_vercel", description: "Vercel AI SDK agent in TypeScript, Bedrock for inference", From 55913113796e80c83496ed27195a1b5c71c4ae43 Mon Sep 17 00:00:00 2001 From: Quang Nguyen Date: Wed, 18 Nov 2026 01:53:11 +0000 Subject: [PATCH 03/10] feat(create): Add the a2a-python-strands-box template Also covers the langchain and minimal box templates in the project and box profile tests. --- src/core/project/templates/boxProfile.test.ts | 4 ++++ src/handlers/project/project.test.ts | 4 ++++ src/handlers/project/shortcuts.test.ts | 1 + src/handlers/project/shortcuts.ts | 14 ++++++++++++++ 4 files changed, 23 insertions(+) diff --git a/src/core/project/templates/boxProfile.test.ts b/src/core/project/templates/boxProfile.test.ts index 863582587..21d54bbc0 100644 --- a/src/core/project/templates/boxProfile.test.ts +++ b/src/core/project/templates/boxProfile.test.ts @@ -839,6 +839,10 @@ describe("startsInBoxOnCodeZip", () => { expect(startsInBoxOnCodeZip(plain("agent-python-strands-box"))).toBe(true); expect(startsInBoxOnCodeZip(plain("agent-python-minimal-box"))).toBe(true); expect(startsInBoxOnCodeZip(plain("agent-python-minimal"))).toBe(false); + expect(startsInBoxOnCodeZip(plain("agent-python-langchain-box"))).toBe(true); + expect(startsInBoxOnCodeZip(plain("agent-python-langchain"))).toBe(false); + expect(startsInBoxOnCodeZip(plain("a2a-python-strands-box"))).toBe(true); + expect(startsInBoxOnCodeZip(plain("a2a-python-strands"))).toBe(false); expect(startsInBoxOnCodeZip(plain("agent-python-strands"))).toBe(false); expect(startsInBoxOnCodeZip(plain("mcp-python-fastmcp"))).toBe(false); expect(startsInBoxOnCodeZip(plain("agent-python-strands-box-container"))).toBe(false); diff --git a/src/handlers/project/project.test.ts b/src/handlers/project/project.test.ts index 52f2374a3..a07c52b77 100644 --- a/src/handlers/project/project.test.ts +++ b/src/handlers/project/project.test.ts @@ -144,8 +144,12 @@ describe("project create", () => { ["agent-python-strands-box", { version: BOX_RELEASE.version }], ["agent-python-strands-box-container", { version: BOX_RELEASE.version }], ["agent-python-minimal-box", { version: BOX_RELEASE.version }], + ["agent-python-langchain-box", { version: BOX_RELEASE.version }], + ["a2a-python-strands-box", { version: BOX_RELEASE.version }], ["agent-python-strands", undefined], ["agent-python-minimal", undefined], + ["agent-python-langchain", undefined], + ["a2a-python-strands", undefined], ["agent-python-strands-container", undefined], ] as const)("create --template %s writes the runtime's box %j", async (template, box) => { const { path: directory, cleanup } = await inTempDirectory(); diff --git a/src/handlers/project/shortcuts.test.ts b/src/handlers/project/shortcuts.test.ts index 9edad0f91..4fdf8d8b8 100644 --- a/src/handlers/project/shortcuts.test.ts +++ b/src/handlers/project/shortcuts.test.ts @@ -23,6 +23,7 @@ describe("template order", () => { "agent-typescript-strands", "agent-typescript-vercel", "a2a-python-strands", + "a2a-python-strands-box", "agui-python-strands", "mcp-python-fastmcp", "empty", diff --git a/src/handlers/project/shortcuts.ts b/src/handlers/project/shortcuts.ts index 82e1f5bcd..f7137469a 100644 --- a/src/handlers/project/shortcuts.ts +++ b/src/handlers/project/shortcuts.ts @@ -280,6 +280,20 @@ export const RUNTIME_TEMPLATE_SHORTCUTS = { supportsModelProviderOverride: true, runtimeVersion: "PYTHON_3_14", }, + "a2a-python-strands-box": { + runtimeName: "a2a_python_strands_box", + description: + "Strands agent speaking the A2A protocol in Strands Box, Bedrock or another model provider", + build: "CodeZip", + language: "Python", + framework: "strands", + protocol: "A2A", + modelProvider: "Bedrock", + includesMemory: true, + box: true, + supportsModelProviderOverride: true, + runtimeVersion: "PYTHON_3_14", + }, "agui-python-strands": { runtimeName: "agui_python_strands", description: "Strands agent speaking AG-UI, Bedrock or another model provider", From 3579cfb3df2d760dcd31c10deb3fb5217919dab1 Mon Sep 17 00:00:00 2001 From: Quang Nguyen Date: Wed, 18 Nov 2026 02:00:55 +0000 Subject: [PATCH 04/10] feat(create): Add the agui-python-strands-box template --- src/core/project/templates/boxProfile.test.ts | 2 ++ src/handlers/project/project.test.ts | 2 ++ src/handlers/project/shortcuts.test.ts | 1 + src/handlers/project/shortcuts.ts | 13 +++++++++++++ 4 files changed, 18 insertions(+) diff --git a/src/core/project/templates/boxProfile.test.ts b/src/core/project/templates/boxProfile.test.ts index 21d54bbc0..3d5995829 100644 --- a/src/core/project/templates/boxProfile.test.ts +++ b/src/core/project/templates/boxProfile.test.ts @@ -843,6 +843,8 @@ describe("startsInBoxOnCodeZip", () => { expect(startsInBoxOnCodeZip(plain("agent-python-langchain"))).toBe(false); expect(startsInBoxOnCodeZip(plain("a2a-python-strands-box"))).toBe(true); expect(startsInBoxOnCodeZip(plain("a2a-python-strands"))).toBe(false); + expect(startsInBoxOnCodeZip(plain("agui-python-strands-box"))).toBe(true); + expect(startsInBoxOnCodeZip(plain("agui-python-strands"))).toBe(false); expect(startsInBoxOnCodeZip(plain("agent-python-strands"))).toBe(false); expect(startsInBoxOnCodeZip(plain("mcp-python-fastmcp"))).toBe(false); expect(startsInBoxOnCodeZip(plain("agent-python-strands-box-container"))).toBe(false); diff --git a/src/handlers/project/project.test.ts b/src/handlers/project/project.test.ts index a07c52b77..bd9556406 100644 --- a/src/handlers/project/project.test.ts +++ b/src/handlers/project/project.test.ts @@ -146,10 +146,12 @@ describe("project create", () => { ["agent-python-minimal-box", { version: BOX_RELEASE.version }], ["agent-python-langchain-box", { version: BOX_RELEASE.version }], ["a2a-python-strands-box", { version: BOX_RELEASE.version }], + ["agui-python-strands-box", { version: BOX_RELEASE.version }], ["agent-python-strands", undefined], ["agent-python-minimal", undefined], ["agent-python-langchain", undefined], ["a2a-python-strands", undefined], + ["agui-python-strands", undefined], ["agent-python-strands-container", undefined], ] as const)("create --template %s writes the runtime's box %j", async (template, box) => { const { path: directory, cleanup } = await inTempDirectory(); diff --git a/src/handlers/project/shortcuts.test.ts b/src/handlers/project/shortcuts.test.ts index 4fdf8d8b8..ffb623a39 100644 --- a/src/handlers/project/shortcuts.test.ts +++ b/src/handlers/project/shortcuts.test.ts @@ -25,6 +25,7 @@ describe("template order", () => { "a2a-python-strands", "a2a-python-strands-box", "agui-python-strands", + "agui-python-strands-box", "mcp-python-fastmcp", "empty", ]); diff --git a/src/handlers/project/shortcuts.ts b/src/handlers/project/shortcuts.ts index f7137469a..f4b304f7e 100644 --- a/src/handlers/project/shortcuts.ts +++ b/src/handlers/project/shortcuts.ts @@ -307,6 +307,19 @@ export const RUNTIME_TEMPLATE_SHORTCUTS = { supportsModelProviderOverride: true, runtimeVersion: "PYTHON_3_14", }, + "agui-python-strands-box": { + runtimeName: "agui_python_strands_box", + description: "Strands agent speaking AG-UI in Strands Box, Bedrock or another model provider", + build: "CodeZip", + language: "Python", + framework: "strands", + protocol: "AGUI", + modelProvider: "Bedrock", + includesMemory: true, + box: true, + supportsModelProviderOverride: true, + runtimeVersion: "PYTHON_3_14", + }, } as const satisfies Record; export type RuntimeTemplateShortcutName = keyof typeof RUNTIME_TEMPLATE_SHORTCUTS; From a1903074ce86120bd62b704424e5b6d12470a1a3 Mon Sep 17 00:00:00 2001 From: Quang Nguyen Date: Wed, 18 Nov 2026 02:18:55 +0000 Subject: [PATCH 05/10] feat(create): Add the mcp-python-fastmcp-box template Also lists the box templates in the README. --- src/core/project/templates/boxProfile.test.ts | 1 + src/handlers/project/project.test.ts | 2 ++ src/handlers/project/shortcuts.test.ts | 1 + src/handlers/project/shortcuts.ts | 12 ++++++++++++ 4 files changed, 16 insertions(+) diff --git a/src/core/project/templates/boxProfile.test.ts b/src/core/project/templates/boxProfile.test.ts index 3d5995829..a75e7649f 100644 --- a/src/core/project/templates/boxProfile.test.ts +++ b/src/core/project/templates/boxProfile.test.ts @@ -847,6 +847,7 @@ describe("startsInBoxOnCodeZip", () => { expect(startsInBoxOnCodeZip(plain("agui-python-strands"))).toBe(false); expect(startsInBoxOnCodeZip(plain("agent-python-strands"))).toBe(false); expect(startsInBoxOnCodeZip(plain("mcp-python-fastmcp"))).toBe(false); + expect(startsInBoxOnCodeZip(plain("mcp-python-fastmcp-box"))).toBe(true); expect(startsInBoxOnCodeZip(plain("agent-python-strands-box-container"))).toBe(false); expect(startsInBoxOnCodeZip(plain("agent-typescript-strands"))).toBe(false); }); diff --git a/src/handlers/project/project.test.ts b/src/handlers/project/project.test.ts index bd9556406..26e25fe77 100644 --- a/src/handlers/project/project.test.ts +++ b/src/handlers/project/project.test.ts @@ -147,11 +147,13 @@ describe("project create", () => { ["agent-python-langchain-box", { version: BOX_RELEASE.version }], ["a2a-python-strands-box", { version: BOX_RELEASE.version }], ["agui-python-strands-box", { version: BOX_RELEASE.version }], + ["mcp-python-fastmcp-box", { version: BOX_RELEASE.version }], ["agent-python-strands", undefined], ["agent-python-minimal", undefined], ["agent-python-langchain", undefined], ["a2a-python-strands", undefined], ["agui-python-strands", undefined], + ["mcp-python-fastmcp", undefined], ["agent-python-strands-container", undefined], ] as const)("create --template %s writes the runtime's box %j", async (template, box) => { const { path: directory, cleanup } = await inTempDirectory(); diff --git a/src/handlers/project/shortcuts.test.ts b/src/handlers/project/shortcuts.test.ts index ffb623a39..a262229cf 100644 --- a/src/handlers/project/shortcuts.test.ts +++ b/src/handlers/project/shortcuts.test.ts @@ -27,6 +27,7 @@ describe("template order", () => { "agui-python-strands", "agui-python-strands-box", "mcp-python-fastmcp", + "mcp-python-fastmcp-box", "empty", ]); }); diff --git a/src/handlers/project/shortcuts.ts b/src/handlers/project/shortcuts.ts index f4b304f7e..099730d58 100644 --- a/src/handlers/project/shortcuts.ts +++ b/src/handlers/project/shortcuts.ts @@ -267,6 +267,18 @@ export const RUNTIME_TEMPLATE_SHORTCUTS = { supportsModelProviderOverride: false, runtimeVersion: "PYTHON_3_14", }, + "mcp-python-fastmcp-box": { + runtimeName: "mcp_python_fastmcp_box", + description: "MCP server exposing tools with FastMCP, in Strands Box", + build: "CodeZip", + language: "Python", + framework: "none", + protocol: "MCP", + includesMemory: false, + box: true, + supportsModelProviderOverride: false, + runtimeVersion: "PYTHON_3_14", + }, "a2a-python-strands": { runtimeName: "a2a_python_strands", description: "Strands agent speaking the A2A protocol, Bedrock or another model provider", From 3df66a2421a25c28196470e0cf12ebeb0088147e Mon Sep 17 00:00:00 2001 From: Quang Nguyen Date: Tue, 17 Nov 2026 22:43:54 -0800 Subject: [PATCH 06/10] fix(box): Grant project write and protect .venv for box/base tools Newer box (staging-boxy main #496) gives a profile without a [project] table no project access, and then drops the agent's deny_write. Write [project] access = "write" in every box profile, and list the agent's deny_write folders on box/base's uname tool, which box gives its own project write grant. Without it box refuses to run the venv's Python. Needs box 0.1.11-linux-preview.4 or later: preview.3 refuses the [project] key, so bump the box pin in boxRelease.json before this ships. --- src/core/project/templates/boxProfile.test.ts | 5 +++++ src/core/project/templates/boxProfile.ts | 20 ++++++++++++++++++- 2 files changed, 24 insertions(+), 1 deletion(-) diff --git a/src/core/project/templates/boxProfile.test.ts b/src/core/project/templates/boxProfile.test.ts index a75e7649f..02e59d005 100644 --- a/src/core/project/templates/boxProfile.test.ts +++ b/src/core/project/templates/boxProfile.test.ts @@ -73,6 +73,7 @@ describe("renderBoxProfile", () => { expect(parse(renderBoxProfile("V3Demo", STRANDS)!) as unknown).toEqual({ packs: ["box/base", "box/bedrock"], profile: { name: "V3Demo" }, + project: { access: "write" }, options: { bedrock: { region: "us-west-2" } }, agent: { command: UVICORN, @@ -80,6 +81,7 @@ describe("renderBoxProfile", () => { filesystem: VENV_GRANTS, ingress: [{ listen: "127.0.0.1:8080", workload_port: 8081 }], }, + tool: { uname: { filesystem: { deny_write: VENV_GRANTS.deny_write } } }, egress: { bedrock: { secret: { ref: "aws://default" } } }, }); }); @@ -374,6 +376,7 @@ describe("renderBoxProfile for AgentCore Runtime", () => { expect(parse(text)).toEqual({ packs: ["box/base", "box/bedrock", "box/agentcore", "box/agentcore-codezip"], profile: { name: "V3Demo" }, + project: { access: "write" }, options: { bedrock: { region: "us-west-2" } }, agent: { command: [ @@ -416,6 +419,7 @@ describe("renderBoxProfile for AgentCore Runtime", () => { // The container reads the deployed resources from the environment through box/agentcore. packs: ["box/base", "box/bedrock", "box/agentcore"], profile: { name: "V3Demo" }, + project: { access: "write" }, options: { bedrock: { region: "us-west-2" } }, agent: { command: [ @@ -440,6 +444,7 @@ describe("renderBoxProfile for AgentCore Runtime", () => { filesystem: IMAGE_PYTHON_FILESYSTEM, ingress: [{ listen: "0.0.0.0:8080", workload_port: 8081 }], }, + tool: { uname: { filesystem: { deny_write: IMAGE_PYTHON_FILESYSTEM.deny_write } } }, }); }, ); diff --git a/src/core/project/templates/boxProfile.ts b/src/core/project/templates/boxProfile.ts index b8d5dc629..ccec5f917 100644 --- a/src/core/project/templates/boxProfile.ts +++ b/src/core/project/templates/boxProfile.ts @@ -99,6 +99,12 @@ const RUNTIME_AWS_STAND_IN_LINES = [ 'AWS_SECRET_ACCESS_KEY = "box-stand-in"', ].join("\n"); +/** + * The tools of box/base that get the project's write grant: box gives each one its own grant, so + * each lists the agent's `deny_write` folders as well. + */ +const BOX_BASE_PROJECT_WRITE_TOOLS = ["uname"]; + type Protocol = NonNullable; /** @@ -479,6 +485,14 @@ export function renderBoxProfile( const execComment = runner.execComment ?? ""; const denyWrite = runner.denyWrite.length > 0 ? `deny_write = [${runner.denyWrite.join(", ")}]\n` : ""; + // box refuses to run a program from a folder that any process in the box can write, so each + // tool that gets the project's write grant lists the venv too. + const toolDenyWrite = + runner.denyWrite.length > 0 + ? BOX_BASE_PROJECT_WRITE_TOOLS.map( + (tool) => `\n[tool.${tool}.filesystem]\ndeny_write = [${runner.denyWrite.join(", ")}]\n`, + ).join("") + : ""; // Only the Runtime agent calls AgentCore: locally, LOCAL_DEV=1 skips Identity, and no memory ID // reaches the box, so Memory is off. const routes = onRuntime ? runtimeRoutes : ""; @@ -520,6 +534,10 @@ ${policies} [profile] name = ${str(projectName)} +# The agent, and the tools its packs add, can read and write the folder box starts in. +[project] +access = "write" + ${options}[agent] command = ${list(runner.command)} @@ -533,7 +551,7 @@ ${denyWrite} [[agent.ingress]] listen = ${str(`${listenHost}:${ingressPort}`)} workload_port = ${workloadPort} -${routes}${bedrockRoute}${keyedRoute}`; +${toolDenyWrite}${routes}${bedrockRoute}${keyedRoute}`; } /** From f1f55b8cb6372b1a8962013bc25f6a12f3ce6014 Mon Sep 17 00:00:00 2001 From: Quang Nguyen Date: Wed, 18 Nov 2026 00:19:26 -0800 Subject: [PATCH 07/10] fix(box): Give the container agent read-only project access Build now resolves the box profile on the host with box profile show --format json. The container image's /app/.venv does not exist there, so a project write grant left the venv Python unprotected and box refused the profile. The image's agent writes nothing in /app, so its profiles take [project] access = "read" and need no tool deny_write. Pin box 0.1.11-linux-preview.5, which has box profile show --format json (staging-boxy #547) and a Box Core fix that leaves X-Amzn-Trace-Id out of the SigV4 signature. --- src/core/project/templates/boxProfile.test.ts | 3 +-- src/core/project/templates/boxProfile.ts | 13 ++++++++----- 2 files changed, 9 insertions(+), 7 deletions(-) diff --git a/src/core/project/templates/boxProfile.test.ts b/src/core/project/templates/boxProfile.test.ts index 02e59d005..4cefd14d5 100644 --- a/src/core/project/templates/boxProfile.test.ts +++ b/src/core/project/templates/boxProfile.test.ts @@ -419,7 +419,7 @@ describe("renderBoxProfile for AgentCore Runtime", () => { // The container reads the deployed resources from the environment through box/agentcore. packs: ["box/base", "box/bedrock", "box/agentcore"], profile: { name: "V3Demo" }, - project: { access: "write" }, + project: { access: "read" }, options: { bedrock: { region: "us-west-2" } }, agent: { command: [ @@ -444,7 +444,6 @@ describe("renderBoxProfile for AgentCore Runtime", () => { filesystem: IMAGE_PYTHON_FILESYSTEM, ingress: [{ listen: "0.0.0.0:8080", workload_port: 8081 }], }, - tool: { uname: { filesystem: { deny_write: IMAGE_PYTHON_FILESYSTEM.deny_write } } }, }); }, ); diff --git a/src/core/project/templates/boxProfile.ts b/src/core/project/templates/boxProfile.ts index ccec5f917..2369559b8 100644 --- a/src/core/project/templates/boxProfile.ts +++ b/src/core/project/templates/boxProfile.ts @@ -449,6 +449,12 @@ export function renderBoxProfile( const workloadPort = boxWorkloadPort(protocol); const onRuntime = target === "runtime"; const container = isBoxedContainer(runtime); + // The image's agent reads /app and writes nothing there. Build resolves the profile on the host, + // where the image's /app/.venv does not exist, so a write grant would leave its Python unprotected + // and box would refuse the profile. A CodeZip agent writes in the folder box starts in. + const projectSection = container + ? '# The agent, and the tools its packs add, can read the folder box starts in.\n[project]\naccess = "read"\n' + : '# The agent, and the tools its packs add, can read and write the folder box starts in.\n[project]\naccess = "write"\n'; const codeZipOnRuntime = onRuntime && !container; const runner = container ? containerRunner(workloadPort, !onRuntime) @@ -488,7 +494,7 @@ export function renderBoxProfile( // box refuses to run a program from a folder that any process in the box can write, so each // tool that gets the project's write grant lists the venv too. const toolDenyWrite = - runner.denyWrite.length > 0 + !container && runner.denyWrite.length > 0 ? BOX_BASE_PROJECT_WRITE_TOOLS.map( (tool) => `\n[tool.${tool}.filesystem]\ndeny_write = [${runner.denyWrite.join(", ")}]\n`, ).join("") @@ -534,10 +540,7 @@ ${policies} [profile] name = ${str(projectName)} -# The agent, and the tools its packs add, can read and write the folder box starts in. -[project] -access = "write" - +${projectSection} ${options}[agent] command = ${list(runner.command)} From d6eec45da80665a35ac2e93f801ed2c602f7c7f2 Mon Sep 17 00:00:00 2001 From: Quang Nguyen Date: Wed, 18 Nov 2026 13:03:38 -0800 Subject: [PATCH 08/10] feat(box): Sign the Runtime's Box gateway backends for the Runtime's own region box 0.1.11-linux-preview.6 lets a backend's auth.aws.region read a ${{ inputs. }} placeholder (staging-boxy #549). The generated box/agentcore pack now declares aws.region from AWS_REGION, which the Runtime sets, and each Box gateway backend signs for ${{ inputs.aws.region }} instead of a region build wrote in. Pin preview.6 and require it in the testing guide. Tested: bun test (5304 pass), the box e2e suite (7 box templates: create, deploy, invoke, box running on the Runtime, teardown), and a CodeZip and a container deploy that answered with Memory. --- .../box-network-build-stopped.golden.txt | 6 ++-- src/core/project/manager.boxNetwork.test.ts | 10 ++++-- src/core/project/templates/boxProfile.test.ts | 15 +++++--- src/core/project/templates/boxProfile.ts | 36 ++++++++----------- 4 files changed, 36 insertions(+), 31 deletions(-) diff --git a/src/core/project/__fixtures__/box-network-build-stopped.golden.txt b/src/core/project/__fixtures__/box-network-build-stopped.golden.txt index e8fcfa44c..6691ee66e 100644 --- a/src/core/project/__fixtures__/box-network-build-stopped.golden.txt +++ b/src/core/project/__fixtures__/box-network-build-stopped.golden.txt @@ -5,7 +5,7 @@ Build stopped: 10 problems in the Box profile and agentcore.json. Build wrote no .box/policy.dw:7:1 This rule allows requests to every host, and each gateway target needs one fixed host. Add a condition that names each host, for example context.input.host == "api.example.com". .box/profile.toml:4:1 The rule "pack_mirrors", which a pack in `packs` adds, allows each host that matches "*.mirror.example.com", and each gateway target needs one fixed host. Name each host in the rule, for example context.input.host == "api.example.com". .box/profile.toml:4:1 [egress.legacy], which a pack in `packs` adds, reads its secret from credsd://prod, and the gateway cannot read credsd. Use an env:// secret, which build stores as an API key credential. -.box/profile.toml:40:1 [egress.signed] signs requests to api.example.com with aws://default, and the gateway signs only for Bedrock, AgentCore, and Lambda function URL hosts. Use an env:// secret for this host, or remove the secret. -.box/profile.toml:44:1 [egress.wide] has the wildcard destination "*.wide.example.com", and each gateway target needs one fixed host. Name each host in `destinations`. -.box/profile.toml:48:1 [mcp.docs] has the destination "docs.example.com/mcp", and the gateway route of an MCP server takes a host with no path. Remove /mcp from the destination. The agent's MCP client keeps the path in its URL. +.box/profile.toml:47:1 [egress.signed] signs requests to api.example.com with aws://default, and the gateway signs only for Bedrock, AgentCore, and Lambda function URL hosts. Use an env:// secret for this host, or remove the secret. +.box/profile.toml:51:1 [egress.wide] has the wildcard destination "*.wide.example.com", and each gateway target needs one fixed host. Name each host in `destinations`. +.box/profile.toml:55:1 [mcp.docs] has the destination "docs.example.com/mcp", and the gateway route of an MCP server takes a host with no path. Remove /mcp from the destination. The agent's MCP client keeps the path in its URL. agentcore/agentcore.json The gateway target 'gh' for api.github.com sends the API key credential 'github' in the header Authorization with the prefix Bearer, and [egress.github] sends no credential. Make the two the same, in agentcore.json or in .box/profile.toml. \ No newline at end of file diff --git a/src/core/project/manager.boxNetwork.test.ts b/src/core/project/manager.boxNetwork.test.ts index 6c1cc6c1b..3994d54cc 100644 --- a/src/core/project/manager.boxNetwork.test.ts +++ b/src/core/project/manager.boxNetwork.test.ts @@ -85,7 +85,10 @@ const gatewayRoute = (target: string, host: string) => ({ backends: [ { url: `\${{ inputs.gateway.url }}/${target}`, - auth: { ref: "aws://", aws: { service: "bedrock-agentcore", region: "us-west-2" } }, + auth: { + ref: "aws://", + aws: { service: "bedrock-agentcore", region: "${{ inputs.aws.region }}" }, + }, }, ], }); @@ -843,7 +846,10 @@ describe("build writes the Bedrock and Memory targets for the region it builds f expect(profile.options).toEqual({ bedrock: { region: "eu-central-1" } }); const egress = profile.egress as Record; expect(egress.bedrock!.destinations).toEqual(["bedrock-runtime.eu-central-1.amazonaws.com"]); - expect(JSON.stringify(egress.bedrock!.backends)).toContain('"region":"eu-central-1"'); + // The backend signs for the Runtime's own region, which box reads from AWS_REGION there. + expect(JSON.stringify(egress.bedrock!.backends)).toContain( + '"region":"${{ inputs.aws.region }}"', + ); }); test("has box resolve the profile for that region, from a copy it then removes", async () => { diff --git a/src/core/project/templates/boxProfile.test.ts b/src/core/project/templates/boxProfile.test.ts index 4cefd14d5..3b8670ad8 100644 --- a/src/core/project/templates/boxProfile.test.ts +++ b/src/core/project/templates/boxProfile.test.ts @@ -515,7 +515,11 @@ describe("renderRuntimeBoxProfile", () => { backends: [ { url: `\${{ inputs.gateway.url }}/${target}`, - auth: { ref: "aws://", aws: { service: "bedrock-agentcore", region: "us-west-2" } }, + // Signed for the Runtime's own region, which box reads from AWS_REGION there. + auth: { + ref: "aws://", + aws: { service: "bedrock-agentcore", region: "${{ inputs.aws.region }}" }, + }, }, ], }); @@ -532,7 +536,7 @@ describe("renderRuntimeBoxProfile", () => { url: "${{ inputs.gateway.url }}/agentcore", auth: { ref: "aws://", - aws: { service: "bedrock-agentcore", region: "us-west-2" }, + aws: { service: "bedrock-agentcore", region: "${{ inputs.aws.region }}" }, }, }, ], @@ -577,7 +581,7 @@ describe("renderRuntimeBoxProfile", () => { }); }); - test("signs each route for the gateway in the region build builds for", () => { + test("signs each route for the gateway in the Runtime's own region", () => { const project = spec([], {}, [getBoxGatewayBedrockTargetSpec("eu-central-1")]); const profile = parse( renderRuntimeBoxProfile(project, project.runtimes[0]!, { @@ -592,9 +596,10 @@ describe("renderRuntimeBoxProfile", () => { backends: [ { url: "${{ inputs.gateway.url }}/bedrock", + // The gateway is in the Runtime's region, which box reads from AWS_REGION there. auth: { ref: "aws://", - aws: { service: "bedrock-agentcore", region: "eu-central-1" }, + aws: { service: "bedrock-agentcore", region: "${{ inputs.aws.region }}" }, }, }, ], @@ -706,7 +711,7 @@ describe("renderRuntimeBoxProfile", () => { 'secret.phantom_prefix = "tk-"\n\n' + "[[mcp.tools.backends]]\n" + 'url = "${{ inputs.gateway.url }}/egress-tools"\nauth.ref = "aws://"\n' + - 'auth.aws.service = "bedrock-agentcore"\nauth.aws.region = "us-west-2"\n', + 'auth.aws.service = "bedrock-agentcore"\nauth.aws.region = "${{ inputs.aws.region }}"\n', ); }); diff --git a/src/core/project/templates/boxProfile.ts b/src/core/project/templates/boxProfile.ts index 2369559b8..fa209d22d 100644 --- a/src/core/project/templates/boxProfile.ts +++ b/src/core/project/templates/boxProfile.ts @@ -560,22 +560,17 @@ ${toolDenyWrite}${routes}${bedrockRoute}${keyedRoute}`; /** * A route the agent's calls take on the Runtime: the box sends calls to `host` * to the runtime's Box gateway target `target`, signing them for the gateway in - * `region` with the execution role; the gateway calls `host` with the target's + * the Runtime's region with the execution role; the gateway calls `host` with the target's * own auth. Every `[egress.]` on the Runtime is one of these, so every * outbound call goes through the Box gateway. Starts with a blank line. */ -function runtimeGatewayRouteSection( - gatewayName: string, - target: string, - host: string, - region: string, -): string { +function runtimeGatewayRouteSection(gatewayName: string, target: string, host: string): string { const key = tomlKey(target); return ` # Calls to ${host}, through the '${gatewayName}' gateway's '${target}' target. [egress.${key}] destinations = [${str(host)}] -${runtimeGatewayBackend(`egress.${key}`, target, region)}`; +${runtimeGatewayBackend(`egress.${key}`, target)}`; } /** An HTTP MCP server of the box profile that a Box gateway target serves. */ @@ -595,7 +590,6 @@ function runtimeMcpServerSection( server: RuntimeMcpServer, target: string, host: string, - region: string, ): string { const key = tomlKey(server.name); const secret = server.secret?.ref.startsWith("env://") @@ -609,23 +603,23 @@ function runtimeMcpServerSection( [mcp.${key}] type = "http" destinations = [${str(host)}] -${secret}${runtimeGatewayBackend(`mcp.${key}`, target, region)}`; +${secret}${runtimeGatewayBackend(`mcp.${key}`, target)}`; } /** * The backend of a Runtime route or MCP server: the runtime's Box gateway - * target, signed for the gateway in `region` with the execution role. Both - * Runtime profiles read the gateway URL from the environment through the - * box/agentcore pack's input, and sign through a bare `aws://`, so no start - * script fills the profile in. Starts with a blank line. + * target. Both Runtime profiles read the gateway URL and the region from the + * environment through the agentcore pack's inputs, and sign with the execution + * role through a bare `aws://`, so the profile names no region. Starts with a + * blank line. */ -function runtimeGatewayBackend(table: string, target: string, region: string): string { +function runtimeGatewayBackend(table: string, target: string): string { return ` [[${table}.backends]] url = ${str(`\${{ inputs.gateway.url }}/${target}`)} auth.ref = ${str(RUNTIME_AWS_SIGNER)} auth.aws.service = "bedrock-agentcore" -auth.aws.region = ${str(region)} +auth.aws.region = "\${{ inputs.aws.region }}" `; } @@ -640,7 +634,6 @@ auth.aws.region = ${str(region)} function runtimeGatewayRoutes( spec: ProjectSpec, runtime: ProjectRuntime, - region: string, servers: ReadonlyMap, ): string { if (!isBoxProject(spec)) return ""; @@ -667,8 +660,8 @@ function runtimeGatewayRoutes( .map((target) => { const server = servers.get(target.name); return server - ? runtimeMcpServerSection(gateway.name, server, target.name, hostOf(target), region) - : runtimeGatewayRouteSection(gateway.name, target.name, hostOf(target), region); + ? runtimeMcpServerSection(gateway.name, server, target.name, hostOf(target)) + : runtimeGatewayRouteSection(gateway.name, target.name, hostOf(target)); }) .join(""); } @@ -742,7 +735,7 @@ export function renderRuntimeBoxProfile( input, region, "runtime", - runtimeGatewayRoutes(spec, runtime, region, runtimeMcpServers(network?.hosts ?? [])), + runtimeGatewayRoutes(spec, runtime, runtimeMcpServers(network?.hosts ?? [])), network?.policyFiles, )!; return profile + (network?.telemetry ?? []).map(runtimeTelemetrySection).join(""); @@ -833,7 +826,8 @@ description = "The runtime's Box gateway URL." from = ${str(`env:${BOX_GATEWAY_URL_ENV}`)} pattern = ${str(GATEWAY_URL_PATTERN)} -# The Runtime's region. The Runtime sets AWS_REGION; the profile passes it to the agent. +# The Runtime's region, which box signs each Box gateway backend for and passes to the agent. The +# Runtime sets AWS_REGION. [inputs.aws.region] description = "The AWS region the runtime runs in." from = "env:AWS_REGION" From 68d2bbb4ba0bf8e1d65bfe778acf6f4111cb5378 Mon Sep 17 00:00:00 2001 From: Quang Nguyen Date: Thu, 19 Nov 2026 13:47:52 -0800 Subject: [PATCH 09/10] fix(box): Address the review of #2857 Say that the backend, not the profile, names no region; name the box release the box/base tool list comes from; and fail selectTemplate at once for a template name that is not in the list. --- src/core/project/templates/boxProfile.ts | 6 ++++-- src/handlers/project/create/create.screen.test.tsx | 1 + 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/src/core/project/templates/boxProfile.ts b/src/core/project/templates/boxProfile.ts index fa209d22d..cd49d5a86 100644 --- a/src/core/project/templates/boxProfile.ts +++ b/src/core/project/templates/boxProfile.ts @@ -101,7 +101,9 @@ const RUNTIME_AWS_STAND_IN_LINES = [ /** * The tools of box/base that get the project's write grant: box gives each one its own grant, so - * each lists the agent's `deny_write` folders as well. + * each lists the agent's `deny_write` folders as well. Taken from box/base in the box release that + * `boxRelease.json` pins (0.1.11-linux-preview.6). When the pin moves, check box/base's tools: box + * refuses a CodeZip box profile if a tool it misses gets the project write grant. */ const BOX_BASE_PROJECT_WRITE_TOOLS = ["uname"]; @@ -610,7 +612,7 @@ ${secret}${runtimeGatewayBackend(`mcp.${key}`, target)}`; * The backend of a Runtime route or MCP server: the runtime's Box gateway * target. Both Runtime profiles read the gateway URL and the region from the * environment through the agentcore pack's inputs, and sign with the execution - * role through a bare `aws://`, so the profile names no region. Starts with a + * role through a bare `aws://`, so the backend names no region. Starts with a * blank line. */ function runtimeGatewayBackend(table: string, target: string): string { diff --git a/src/handlers/project/create/create.screen.test.tsx b/src/handlers/project/create/create.screen.test.tsx index a5a2a7394..d0b3011f3 100644 --- a/src/handlers/project/create/create.screen.test.tsx +++ b/src/handlers/project/create/create.screen.test.tsx @@ -31,6 +31,7 @@ import { modelProviderOverridableCnMessage } from "../../../core/project/manager /** Moves the template list's cursor from its first entry down to `name`. */ async function selectTemplate(r: ReturnType, name: string): Promise { const index = PROJECT_TEMPLATE_NAMES.indexOf(name as (typeof PROJECT_TEMPLATE_NAMES)[number]); + expect(index).toBeGreaterThan(-1); for (let i = 0; i < index; i++) await r.press("down"); } From c1bc4576d56d8d3f57e5a22a4ed89a49b9d6da30 Mon Sep 17 00:00:00 2001 From: Quang Nguyen Date: Thu, 19 Nov 2026 14:17:37 -0800 Subject: [PATCH 10/10] fix(create): Keep a skip-install CodeZip box profile valid With [project] access = "write", box drops the profile's optional .venv deny_write while the folder is missing, and then refuses the profile: the venv's Python would be under the project's write grant. So 'create --skip-install' left a CodeZip box agent that 'build' and 'deploy' could not run. create now makes an empty .venv for it, which 'uv sync' fills later. --- src/core/project/manager.test.ts | 30 +++++++++++++++++++++++++++++- src/core/project/manager.tsx | 9 +++++++++ 2 files changed, 38 insertions(+), 1 deletion(-) diff --git a/src/core/project/manager.test.ts b/src/core/project/manager.test.ts index cbb1b2bab..f6681887b 100644 --- a/src/core/project/manager.test.ts +++ b/src/core/project/manager.test.ts @@ -1,5 +1,5 @@ import { afterEach, describe, expect, test } from "bun:test"; -import { existsSync } from "node:fs"; +import { existsSync, readdirSync } from "node:fs"; import { mkdir, mkdtemp, readdir, readFile, rm, writeFile } from "node:fs/promises"; import { writeMigrationState } from "./migrate/journal"; import { join, relative } from "node:path"; @@ -624,6 +624,34 @@ describe("FsProjectManager.create", () => { expect(skipInstall.checkedTools).toEqual(["git"]); }); + test("with --skip-install, makes an empty .venv only for a CodeZip box agent", async () => { + const directory = await inTempDirectory(); + const venv = (name: string, runtime: { runtimeName: string }) => + join(directory, name, "app", runtime.runtimeName, ".venv"); + + // box drops the profile's optional .venv deny_write while the folder is missing, and then + // refuses the profile, as the venv's Python would be under the project's write grant. + await runCreate(manager().manager, { + name: "codezip", + scaffoldRuntimeInput: AGENT_PYTHON_STRANDS_BOX, + skipInstall: true, + }); + expect(readdirSync(venv("codezip", AGENT_PYTHON_STRANDS_BOX))).toEqual([]); + + // A container's image builds its own venv, and an agent outside a box has no profile. + for (const [name, runtime] of [ + ["container", AGENT_PYTHON_STRANDS_BOX_CONTAINER], + ["plain", AGENT_PYTHON], + ] as const) { + await runCreate(manager().manager, { + name, + scaffoldRuntimeInput: runtime, + skipInstall: true, + }); + expect(existsSync(venv(name, runtime))).toBe(false); + } + }); + test("fails before writing files when box is not on PATH, with the install hint", async () => { const directory = await inTempDirectory(); const subject = new FsProjectManager({ diff --git a/src/core/project/manager.tsx b/src/core/project/manager.tsx index c3f66e453..c2817e9d5 100644 --- a/src/core/project/manager.tsx +++ b/src/core/project/manager.tsx @@ -594,6 +594,15 @@ export class FsProjectManager implements ProjectManager { const appDir = join(destination, "app", scaffoldRuntimeInput.runtimeName); yield* this.ensureLockFileExists(appDir); } + if (input.skipInstall && scaffoldRuntimeInput && startsInBoxOnCodeZip(scaffoldRuntimeInput)) { + // The box profile keeps the venv out of the project's write grant with an optional + // deny_write, which box drops while `.venv` is missing; box then refuses the profile, as the + // venv's Python would be writable. An empty `.venv` keeps the profile valid, and `uv sync` + // fills it later. + await mkdir(join(destination, "app", scaffoldRuntimeInput.runtimeName, ".venv"), { + recursive: true, + }); + } if (scaffoldRuntimeInput) { yield* this.writeBoxProfile(destination, input.name, scaffoldRuntimeInput, input.region);