Add Pi agent support to sandboxy - #850
Conversation
| envVarsBuilder[idx] = "NODE_OPTIONS=-r /usr/local/lib/node_modules/global-agent/dist/routines/bootstrap.js \(existing)" | ||
| } else { | ||
| envVarsBuilder.append("NODE_OPTIONS=-r /usr/local/lib/node_modules/global-agent/dist/routines/bootstrap.js") | ||
| if definition.installCommands.contains(where: { $0.contains("global-agent") }) { |
There was a problem hiding this comment.
@AntApper I don't have a deep understanding of what's necessary when embedding agents in containers but having all this mostly-nodes-related stuff conditionalized here feels somewhat arbitrary.
Can you think of any way to do this declaratively as part of the agent definition, such that it's secure (for example, doesn't allow an agent setup to perform arbitrary operations on the host or access user data)?
There was a problem hiding this comment.
Let's use the conversation here to discuss approaches before making any code changes.
There was a problem hiding this comment.
completely agree, sniffing the install commands was a bit of a hack and having node paths hardcoded in the runner is messy.
the only reason it's there is claude code doesn't respect standard HTTP_PROXY env vars without global-agent, whereas pi doesn't need it (and node crashes if it tries to require a file that isn't installed).
to make it declarative and safe from arbitrary user JSONs, we could do a simple enum like proxyBootstrap: .standard | .nodeGlobalAgent so it's strictly bounded, or something like a proxyEnv dictionary on the agent definition with a {PROXY_URL} token so sandboxy doesn't need any node-specific logic at all. since it's just setting container env vars either way, host files/execution wouldn't be exposed.
let me know if either of those sounds good to you or if you were picturing something different!
Resolves #801
Overview
Adds built-in agent support for Pi (
@earendil-works/pi-coding-agent) tosandboxy. This serves as a second built-in agent definition alongside Claude Code, validating the multi-agent application architecture.Changes
AgentDefinition.piconfigured with:docker.io/library/node:22@earendil-works/pi-coding-agentwith--ignore-scripts~/.pi/agentto/root/.pi/agentANTHROPIC_API_KEY,OPENAI_API_KEY,GEMINI_API_KEY,GOOGLE_API_KEY,OPENROUTER_API_KEY,XAI_API_KEY,ANTHROPIC_OAUTH_TOKEN)global-agentproxy bootstrapping inRunAgentCommandso it is only applied whenglobal-agentis present in the agent's install commands.sigwinchStreamon exit inrunContainerSession.sandboxyREADME documentation and usage examples.Verification
sandboxybinary and verified clean compilation (make -C examples/sandboxy).make fmt) and license/linter checks (make check).swift test, 593 tests passed).sandboxy config list --agentsand interactive launch with PTY relay.