chore(agent): make sandbox-agent runner first-class#4786
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
📝 WalkthroughSummary by CodeRabbitRelease Notes
WalkthroughIntroduces Changessandbox-agent Runner Rollout
Estimated code review effort🎯 4 (Complex) | ⏱️ ~60 minutes 🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
Railway Preview Environment
|
There was a problem hiding this comment.
Actionable comments posted: 4
🧹 Nitpick comments (2)
docs/design/agent-workflows/sidecar-deployment-proposal/proposal.md (1)
154-168: ⚡ Quick winMissing
SANDBOX_AGENT_DAYTONA_INSTALL_PIfrom the runner service configuration contract.Section 4b lists the runner service env contract, but
SANDBOX_AGENT_DAYTONA_INSTALL_PIis absent. However, this variable is present in the actual Docker Compose wiring (hosting/docker-compose/oss/docker-compose.gh.local.yml) and documented in the configuration reference (02-configuration.mdx, line 136). It should be added to the table in section 4b for completeness.The variable controls whether the Pi harness is installed in Daytona sandboxes and is a legitimate part of the runner's configuration contract.
📝 Proposed fix for section 4b
| `SANDBOX_AGENT_DAYTONA_SNAPSHOT` | unset | Snapshot name for Daytona runs. | | `SANDBOX_AGENT_DAYTONA_IMAGE` | unset | Plain image override for Daytona runs when no snapshot is set. | +| `SANDBOX_AGENT_DAYTONA_INSTALL_PI` | `false` | Install Pi harness in Daytona sandbox images (only for custom snapshots). |docs/docs/self-host/guides/07-deploy-the-agent-runner.mdx (1)
22-28: ⚡ Quick winClarify or document the image override environment variables.
Lines 25–26 reference
AGENTA_SANDBOX_AGENT_IMAGE_NAMEandAGENTA_SANDBOX_AGENT_IMAGE_TAGas optional Compose overrides, but these variables are not documented in the configuration reference (02-configuration.mdx) or the proposal's configuration contract (sections 4a–4b). The Docker Compose template uses${AGENTA_VERSION}rather than these named variables.Either:
- Add them to the configuration reference if they are part of the official self-host contract, or
- Remove them if they are undocumented internal details not meant for operators, or
- Clarify with a note (e.g., "advanced: for custom registries") if they are Compose-level overrides for specialized deployments.
ℹ️ Review info
⚙️ Run configuration
Configuration used: Organization UI
Review profile: CHILL
Plan: Pro Plus
Run ID: b837c7a0-d3de-4e7a-8e17-9c22461ee14f
📒 Files selected for processing (32)
docs/design/agent-workflows/sidecar-deployment-proposal/README.mddocs/design/agent-workflows/sidecar-deployment-proposal/proposal.mddocs/design/agent-workflows/sidecar-deployment-proposal/status.mddocs/docs/self-host/02-configuration.mdxdocs/docs/self-host/guides/07-deploy-the-agent-runner.mdxdocs/docs/self-host/guides/09-agent-daytona-sandboxes.mdxdocs/docs/self-host/infrastructure/01-architecture.mdxhosting/docker-compose/ee/docker-compose.gh.local.ymlhosting/docker-compose/ee/env.ee.dev.examplehosting/docker-compose/oss/docker-compose.dev.ymlhosting/docker-compose/oss/docker-compose.gh.local.ymlhosting/docker-compose/oss/docker-compose.gh.ssl.ymlhosting/docker-compose/oss/env.oss.dev.exampleservices/agent/AGENTS.mdservices/agent/CLAUDE.mdservices/agent/src/engines/skills.tsservices/agent/src/entry.tsservices/agent/src/version.tsservices/agent/tests/unit/cli.test.tsservices/agent/tests/unit/code-tool.test.tsservices/agent/tests/unit/continuation.test.tsservices/agent/tests/unit/extension-tools.test.tsservices/agent/tests/unit/mcp-servers.test.tsservices/agent/tests/unit/responder.test.tsservices/agent/tests/unit/server.test.tsservices/agent/tests/unit/skills.test.tsservices/agent/tests/unit/stream-events.test.tsservices/agent/tests/unit/tool-bridge.test.tsservices/agent/tests/unit/tool-dispatch.test.tsservices/agent/tests/unit/wire-contract.test.tsservices/agent/tests/utils/golden.tsservices/agent/vitest.config.ts
| ## Optional snapshot | ||
|
|
||
| Daytona runs start faster from a prepared snapshot. Agenta ships the recipe, not a | ||
| prebuilt snapshot: | ||
|
|
||
| ```bash | ||
| cd services/agent/sandbox-images/daytona | ||
| uv run build_snapshot.py --force | ||
| ``` | ||
|
|
||
| Then configure the snapshot name: | ||
|
|
||
| ```bash | ||
| SANDBOX_AGENT_DAYTONA_SNAPSHOT=agenta-sandbox-pi | ||
| SANDBOX_AGENT_DAYTONA_INSTALL_PI=false | ||
| ``` |
There was a problem hiding this comment.
🧩 Analysis chain
🏁 Script executed:
#!/bin/bash
# Check for the snapshot build directory and script
if [[ -f services/agent/sandbox-images/daytona/build_snapshot.py ]]; then
echo "build_snapshot.py found."
head -20 services/agent/sandbox-images/daytona/build_snapshot.py
else
echo "build_snapshot.py not found; check for build documentation."
fd -type f -name "*snapshot*" -o -name "*daytona*" services/agent/
fi
# Check for README or docs
fd -type f -name "README*" services/agent/sandbox-images/daytona/ 2>/dev/nullRepository: Agenta-AI/agenta
Length of output: 309
🏁 Script executed:
#!/bin/bash
# Check the actual structure of services/agent/
ls -la services/agent/sandbox-images/ 2>/dev/null || echo "Directory not found"
# Search for any snapshot-related files
fd -type f -name "*snapshot*" services/ 2>/dev/null | head -20
# Search for build scripts
fd -type f -name "build*.py" services/ 2>/dev/null | head -20
# Check if daytona directory exists
ls -la services/agent/sandbox-images/daytona 2>/dev/null || echo "daytona directory not found"Repository: Agenta-AI/agenta
Length of output: 108
🏁 Script executed:
#!/bin/bash
# Search for uv references in docs
rg -i "uv" docs/ --type markdown -A 2 -B 2 | head -50
# Search for uv in entire codebase
rg -i "^uv " --type markdown --type python | head -30Repository: Agenta-AI/agenta
Length of output: 5784
🏁 Script executed:
#!/bin/bash
# Check the actual documentation file mentioned
cat -n docs/docs/self-host/guides/09-agent-daytona-sandboxes.mdx | head -60Repository: Agenta-AI/agenta
Length of output: 1759
Remove or replace the non-existent snapshot build instructions—the referenced directory and script do not exist in the repository.
Lines 36–37 reference services/agent/sandbox-images/daytona/build_snapshot.py, but:
- The directory
services/agent/sandbox-images/does not exist in the codebase - The script
build_snapshot.pydoes not exist
Users following this guide will encounter an immediate "No such file or directory" error. Either:
- Restore the snapshot build tooling and document its setup (including
uvinstallation and Python prerequisites), or - Remove the "Optional snapshot" section entirely if snapshot building is not supported in self-hosted deployments, or
- Link to separate, complete snapshot build documentation if it exists elsewhere
| - ${ENV_FILE:-./.env.oss.dev} | ||
| environment: | ||
| DOCKER_NETWORK_MODE: ${DOCKER_NETWORK_MODE:-bridge} | ||
| AGENTA_AGENT_RUNNER_URL: http://sandbox-agent:8765 |
There was a problem hiding this comment.
Allow overriding AGENTA_AGENT_RUNNER_URL in dev compose.
Line 410 hardcodes the runner URL, so values from the selected env file cannot override it. This diverges from the other compose variants and breaks the expected env-driven runner routing.
Suggested fix
- AGENTA_AGENT_RUNNER_URL: http://sandbox-agent:8765
+ AGENTA_AGENT_RUNNER_URL: ${AGENTA_AGENT_RUNNER_URL:-http://sandbox-agent:8765}📝 Committable suggestion
‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.
| AGENTA_AGENT_RUNNER_URL: http://sandbox-agent:8765 | |
| AGENTA_AGENT_RUNNER_URL: ${AGENTA_AGENT_RUNNER_URL:-http://sandbox-agent:8765} |
| import { | ||
| type AgentRunRequest, | ||
| type AgentRunResult, | ||
| type HarnessCapabilities, | ||
| messageText, | ||
| resolvePromptText, | ||
| resolveRunSessionId, | ||
| } from "../../src/protocol.ts"; |
There was a problem hiding this comment.
🧩 Analysis chain
🏁 Script executed:
#!/bin/bash
# Verify that protocol.ts exports the required types and functions
PROTOCOL_FILE="services/agent/src/protocol.ts"
echo "=== Checking exports in src/protocol.ts ==="
if [ ! -f "$PROTOCOL_FILE" ]; then
echo "✗ Protocol file not found: $PROTOCOL_FILE"
exit 1
fi
echo "Checking for required exports:"
for export in "AgentRunRequest" "AgentRunResult" "HarnessCapabilities" "messageText" "resolvePromptText" "resolveRunSessionId"; do
if grep -q "export.*$export" "$PROTOCOL_FILE"; then
echo "✓ $export"
else
echo "✗ $export not found"
fi
doneRepository: Agenta-AI/agenta
Length of output: 162
🏁 Script executed:
# Find protocol.ts and wire-contract.test.ts files
fd -type f -name "protocol.ts"
fd -type f -name "wire-contract.test.ts"Repository: Agenta-AI/agenta
Length of output: 402
🏁 Script executed:
# Find protocol.ts and wire-contract.test.ts files
fd -t f "protocol.ts"
fd -t f "wire-contract.test.ts"Repository: Agenta-AI/agenta
Length of output: 108
🏁 Script executed:
# Search for any files with "protocol" in the name
fd -t f "protocol"
# List the services/agent directory structure
ls -la services/agent/
ls -la services/agent/src/ 2>/dev/null || echo "src directory not found"Repository: Agenta-AI/agenta
Length of output: 762
🏁 Script executed:
# List all .ts files in services/agent recursively
find services/agent -name "*.ts" -o -name "*.tsx" | head -20
# Read the wire-contract.test.ts file to see what it's importing
cat services/agent/tests/unit/wire-contract.test.ts | head -40Repository: Agenta-AI/agenta
Length of output: 2312
🏁 Script executed:
# Search for any file named protocol.ts anywhere
find . -name "protocol.ts" 2>/dev/null
# Search for where these symbols are defined
rg "export.*AgentRunRequest" --type ts
rg "export.*messageText" --type ts
rg "export.*resolvePromptText" --type tsRepository: Agenta-AI/agenta
Length of output: 42
🏁 Script executed:
# Check the full wire-contract.test.ts content
wc -l services/agent/tests/unit/wire-contract.test.ts
# Read the entire test file
cat services/agent/tests/unit/wire-contract.test.ts
# Search without type filter
grep -r "AgentRunRequest" . 2>/dev/null | head -10Repository: Agenta-AI/agenta
Length of output: 7910
🏁 Script executed:
# Check continuation.test.ts to see how it imports AgentRunRequest
grep -A 5 -B 5 "AgentRunRequest" services/agent/tests/unit/continuation.test.ts | head -20
# Check if there's a protocol file anywhere with a different name or location
fd -t f "protocol" services/agent/Repository: Agenta-AI/agenta
Length of output: 618
🏁 Script executed:
# Check if protocol.ts is gitignored or in git history
cd services/agent && git status src/protocol.ts 2>&1 || echo "Not in git status"
# Check git log for protocol.ts
cd services/agent && git log --oneline src/protocol.ts 2>&1 | head -5
# Look at what's in sandbox_agent.ts to see if it has any of these exports
grep -E "export.*(AgentRunRequest|messageText|resolvePromptText|resolveRunSessionId)" services/agent/src/engines/sandbox_agent.tsRepository: Agenta-AI/agenta
Length of output: 286
🏁 Script executed:
# Use git ls-files to find all relevant files
git ls-files | grep -E "protocol\.ts|wire-contract\.test\.ts|sandbox_agent\.ts"
# Check current working directory
pwd
# List services directory
ls -la services/ 2>/dev/null | head -20Repository: Agenta-AI/agenta
Length of output: 928
🏁 Script executed:
# Check if protocol.ts exists in the filesystem at all
test -f services/agent/src/protocol.ts && echo "EXISTS" || echo "NOT FOUND"
# Check for any file named protocol in services/agent
find services/agent -name "*protocol*" 2>/dev/null
# Check if there's a .gitignore entry
cat services/agent/.gitignore 2>/dev/null || echo "No .gitignore in services/agent"
# List all files in services/agent/src/
ls -la services/agent/src/ 2>/dev/nullRepository: Agenta-AI/agenta
Length of output: 388
🏁 Script executed:
# Search for where AgentRunRequest might be defined anywhere
rg "AgentRunRequest\s*=" --type ts
# Search for type AgentRunRequest anywhere
rg "type\s+AgentRunRequest" --type ts
# Look for interface AgentRunRequest
rg "interface\s+AgentRunRequest" --type ts
# Check all imports in continuation.test.ts
cat services/agent/tests/unit/continuation.test.ts | head -30Repository: Agenta-AI/agenta
Length of output: 1633
Create services/agent/src/protocol.ts with the required type and function exports.
The test file imports AgentRunRequest, AgentRunResult, HarnessCapabilities, messageText, resolvePromptText, and resolveRunSessionId from ../../src/protocol.ts, but this file does not exist. The test will fail to compile. You need to create services/agent/src/protocol.ts and export all six of these items (three types and three functions) with signatures that match the test's usage patterns.
| const here = dirname(fileURLToPath(import.meta.url)); | ||
| // services/agent/tests/utils -> repo root -> the shared Python golden fixtures. | ||
| export const GOLDEN_DIR = join( | ||
| here, | ||
| "../../../../sdks/python/oss/tests/pytest/unit/agents/golden", | ||
| ); |
There was a problem hiding this comment.
🧩 Analysis chain
🏁 Script executed:
#!/bin/bash
# Verify golden fixture directory and files exist
REPO_ROOT=$(git rev-parse --show-toplevel)
GOLDEN_DIR="${REPO_ROOT}/sdks/python/oss/tests/pytest/unit/agents/golden"
echo "=== Checking golden fixture directory ==="
if [ -d "$GOLDEN_DIR" ]; then
echo "✓ Directory exists: $GOLDEN_DIR"
echo ""
echo "=== Fixture files present ==="
ls -la "$GOLDEN_DIR"/*.json 2>/dev/null || echo "No JSON files found"
else
echo "✗ Directory not found: $GOLDEN_DIR"
exit 1
fiRepository: Agenta-AI/agenta
Length of output: 192
🏁 Script executed:
#!/bin/bash
# Search for the mentioned golden fixture JSON files
echo "=== Searching for golden fixture JSON files ==="
fd -t f \( -name "run_request.pi.json" -o -name "run_request.claude.json" -o -name "run_result.ok.json" -o -name "run_result.error.json" \)
echo ""
echo "=== Searching for any 'golden' directories ==="
fd -t d -i golden
echo ""
echo "=== Searching for GOLDEN_DIR usage in codebase ==="
rg "GOLDEN_DIR" --type ts --type tsxRepository: Agenta-AI/agenta
Length of output: 485
🏁 Script executed:
#!/bin/bash
# Find and examine wire-contract.test.ts
echo "=== Searching for wire-contract.test.ts ==="
fd -t f -name "wire-contract.test.ts"Repository: Agenta-AI/agenta
Length of output: 353
🏁 Script executed:
#!/bin/bash
# Search for golden fixture JSON files with corrected syntax
echo "=== Searching for golden fixture JSON files ==="
find . -type f \( -name "run_request.pi.json" -o -name "run_request.claude.json" -o -name "run_result.ok.json" -o -name "run_result.error.json" \) 2>/dev/null
echo ""
echo "=== Searching for any 'golden' directories ==="
find . -type d -iname "*golden*" 2>/dev/null
echo ""
echo "=== Searching for GOLDEN_DIR usage ==="
rg "GOLDEN_DIR" 2>/dev/null || echo "No matches found"Repository: Agenta-AI/agenta
Length of output: 370
🏁 Script executed:
#!/bin/bash
# Find wire-contract.test.ts and golden.ts file
echo "=== Locating golden.ts ==="
find . -name "golden.ts" 2>/dev/null
echo ""
echo "=== Locating wire-contract.test.ts ==="
find . -name "wire-contract.test.ts" 2>/dev/null
echo ""
echo "=== Examining services/agent/tests directory structure ==="
ls -la services/agent/tests/utils/ 2>/dev/null || echo "Directory not found"Repository: Agenta-AI/agenta
Length of output: 443
🏁 Script executed:
#!/bin/bash
# Examine the golden.ts file to see how GOLDEN_DIR is used
echo "=== Content of golden.ts ==="
cat -n services/agent/tests/utils/golden.ts
echo ""
echo "=== Check wire-contract.test.ts for fixture usage ==="
cat -n services/agent/tests/unit/wire-contract.test.tsRepository: Agenta-AI/agenta
Length of output: 8986
🏁 Script executed:
#!/bin/bash
# Search for imports of golden functions in test files
echo "=== Search for golden fixture usage in tests ==="
rg "import.*golden|from.*golden" services/agent/tests/ 2>/dev/null || echo "No imports found"
echo ""
echo "=== Search for the specific JSON file references ==="
rg "run_request|run_result" services/agent/tests/ 2>/dev/null || echo "No references found"Repository: Agenta-AI/agenta
Length of output: 861
Golden fixture directory and files are missing — tests will fail at runtime.
The directory sdks/python/oss/tests/pytest/unit/agents/golden/ does not exist in the repository, and none of the fixture files referenced by wire-contract.test.ts are present:
run_request.pi.jsonrun_request.claude.jsonrun_result.ok.jsonrun_result.error.json
The loadGolden() function in golden.ts and all calls to it in wire-contract.test.ts will fail when the tests are executed. Either commit the missing fixture files to the repository or ensure they are generated before tests run.
Context
The agent runtime POC still refers to the runner sidecar through older names and scattered self-host docs. Review needs a deployment-oriented core slice that documents the sandbox-agent service and wires the local/dev compose surfaces without taking Railway, Kubernetes, or image-build CI.
This PR is intentionally part of the existing agent-workflows POC stack. Review it with #4771, #4772, #4776, #4778, and #4779; it is not meant to merge alone.
Changes
Moves the sidecar deployment proposal into a project folder with status tracking, adds self-host docs for the agent runner and Daytona sandboxes, and updates OSS/EE local compose/env examples to expose the
sandbox-agentservice shape. It also adds runner docs and test scaffolding for the first-class sandbox-agent name.Child PRs:
Tests / notes
pnpm run typecheckandpnpm testinservices/agent, relevant Python unit tests, compose config checks, and Helm template renders.What to QA
sandbox-agentthrough the documented env variables.