Repository navigation
feat: headless sandboxes and an MCP server to drive PentAGI without an LLM key - #475
Open
IshanKulkarni02 wants to merge 1 commit into
Open
IshanKulkarni02 wants to merge 1 commit into
IshanKulkarni02 wants to merge 1 commit into
Conversation
…n LLM key Adds a flow mode with no agent loop and no LLM provider behind it: a flows.headless row plus a real Docker container (same hardened docker.WorkerSpec agents get), reached through new REST endpoints that reuse the existing terminal tool's exec/file plumbing directly. - POST /sandboxes/ create - DELETE /sandboxes/:sandboxID stop + remove container - POST /sandboxes/:sandboxID/exec run a command - GET/PUT /sandboxes/:sandboxID/file read/write a file Migration adds flows.headless; model_provider_name/model_provider_type carry inert 'headless'/'custom' placeholders rather than a new PROVIDER_TYPE enum value, keeping GraphQL/gqlgen/frontend untouched. LoadFlowWorker skips headless flows on restart (they never had a FlowWorker to rebuild). Regression tests pin both bugs found while testing this live: a route that silently no-op'd DELETE, and an empty placeholder that 500'd GET /flows/ for every flow once a headless one existed. mcp/ is a stdio MCP server (Node, @modelcontextprotocol/sdk) wrapping both the new sandbox endpoints and the existing flow API, plus a pentagi skill, so Claude Code can drive a PentAGI instance directly. Verified live against a local Postgres + Docker: create, exec, file read/write, restart-survival, and stop, through real MCP tool calls. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What
Adds a flow mode with no agent loop and no LLM provider behind it: a Docker sandbox (same hardened
docker.WorkerSpecagents get) that a caller drives directly, so PentAGI's Docker sandboxing is usable with zero LLM provider configured. Alongside it,mcp/is a small stdio MCP server wrapping both this new surface and the existing flow API, so a tool like Claude Code can drive a PentAGI instance over MCP — the motivating use case.New REST endpoints (reusing the existing terminal tool's exec/file plumbing, not new exec logic):
Design choices (happy to revisit)
flows.headless;model_provider_name/model_provider_typecarry inert'headless'/'custom'placeholders rather than a newPROVIDER_TYPEenum value, so GraphQL/gqlgen/frontend stay untouched. A headless flow is a real row inflows(shows up in the normal flows list/UI), butLoadFlowWorkerskips it on restart — it never had aFlowWorkerto rebuild./sandboxes/*reuses the existingflows.*privileges rather than adding a new privilege namespace.mcp/is a standalone Node project (ownpackage.json:@modelcontextprotocol/sdk,zod, both MIT), not wired intofrontend/'s dependency tree or the existing license-scan scripts — let me know if you'd rather it live elsewhere or be folded into an existing scope.I know
examples/proposals/mcp_client_integration.mdstages MCP work carefully given PR #268's review history (no implicit lifecycle state, explicit operator visibility/control) — that RFC is about the other direction (PentAGI as an MCP client calling external tools). This is PentAGI as something an MCP client drives, a narrower surface, but I'm glad to split this into smaller slices if that's preferred.Testing
No existing test suite covers this (new feature), but it's verified live, not just compiled:
tools/callrequests end-to-end, not just the REST layer.DELETE(redirect instead of deleting), and an empty placeholder value that 500'dGET /flows/for every flow once a headless one existed — both now pinned by regression tests (shown failing before the fix, per this repo's testing conventions).go build ./...,go test ./...,go vet ./..., andgolangci-lint run(v2.12.2) all clean.swag/gqlgen: no schema change, so only swagger was regenerated (pinned swag v1.8.7 to match the committed output, not@latest, which silently produced an empty paths list on this toolchain — worth knowing about independent of this PR).Not done here
/sandboxesis the right name/shape, or whether this belongs behind a feature flag given it's a new unauthenticated-by-default (well, same Bearer-token auth as everything else) way to get arbitrary command execution in a container — same privilege model as flows, but worth a second look given the dual-use nature of this tool.🤖 Generated with Claude Code