Repository navigation
feat: implement Pi as a sandbox external agent (#2426) - #2550
Merged
Merged
Conversation
Add Pi (@earendil-works/pi-coding-agent, pinned 0.80.3) as an external-agent runtime with Claude Code parity: gateway-managed turns (VK + metering) over the OpenAI-compatible route via a per-exec staged models.json provider, BYO via the user's own credentials (catalog model-id dialect), multi-turn resume (--session + a stable PI_CODING_AGENT_SESSION_DIR), normalized events with auto-retry-aware result mapping, per-exec APPEND_SYSTEM.md for the system-prompt append, docs in en/de/fr, and a parser fixture captured from a real pinned-CLI run against a mock gateway.
yannickmonney
added a commit
that referenced
this pull request
Jul 7, 2026
…leet The budget was set at 4400 MB when the image was ~4.0 GB; the six external agent CLIs added since (Cursor #2481, Hermes #2500, Gemini #2535, Codex #2536, Pi #2550, OpenClaw #2555) grew it to ~4.9 GB and none of those PRs updated the budget, so the Validate images gate is red on main too. Document the fleet as a named cost and restore the ~10% headroom convention at 5400.
3 tasks
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.
Closes #2426
Adds Pi (the pi coding agent,
@earendil-works/pi-coding-agent, pinned 0.80.3) as a sandbox external-agent runtime with Claude Code parity, following the Hermes (#2500) / Gemini CLI (#2535) / Codex (#2536) pattern.What ships
services/platform/lib/agent-adapters/pi/—buildExec+ stream parser + tests, andfixtures/pi/shell-turn.jsonlcaptured from a real pinned-CLI run against a mock OpenAI-completions gateway (the bash tool call executed for real; ids/timestamps sanitized).services/sandbox-runtime/tale-pi-run— stages a private per-exec config dir (PI_CODING_AGENT_DIR) holdingmodels.json/settings.json/APPEND_SYSTEM.md, pins a stablePI_CODING_AGENT_SESSION_DIRfor resume, and pipes the prompt intopi --mode jsonstdin. Prompt and system-prompt append ride stdin/staged files, never argv.models.jsonbaseUrl <gateway>/openai/v1,apiKey "$TALE_GATEWAY_TOKEN"env interpolation, so the staged file never contains the key), pinned via--provider tale-gateway --model <gateway id>.OPENROUTER_API_KEY/ANTHROPIC_API_KEY/OPENAI_API_KEY/GEMINI_API_KEY).byoModelIdSource: 'catalog': the shipped catalog refs resolve to ids Pi's built-in openrouter catalog speaks verbatim (anthropic/claude-sonnet-4.6is a literal model id at v0.80.3).sessionheader; next turn passes--session <id>(local-then-global lookup, verified in 0.80.3 source and exercised locally through the wrapper: same session id, full prior context replayed).agentKind: 'pi'appended last in every union/validator/registry, agent-editor kind option, readiness types,builtin-configs/agents/chat/pi.json(managed, composer order 45, Claude Sonnet 4.6 + Opus 4.8 like Hermes),Dockerfilepin + wrapper, container runtime checks (PATH/version + AST flag-drift guard against the pinnedpi --help), docs en/de/fr + frontmatter manifest, locale labelagents.form.agentKind.pi.Verified against the pinned CLI (0.80.3 source + real runs)
--mode jsonevent shapes (sessionheader,message_update/message_end,tool_execution_*,agent_end,auto_retry_*) — parser built from a real captured run.agent_endand pi may retry; the parser holds an error result open until the stream ends (orauto_retry_endfails) so a recovered turn reportscompletedexactly once.APPEND_SYSTEM.mdappends to the default system prompt (verified in the request body of a real run) —spec.systemPromptAppenddemonstrably reaches the model.models.jsonvalue resolution ($ENV_VARinterpolation) — verified:Authorization: Bearer <session key>on the wire, key absent from staged JSON.skillsStageDir: ~/.agents/skills, an always-trusted homedir location independent of the config-dir override).fallbackModelandmaxTurnsare deliberately ignored and documented as such).Verification
viteston agent-adapters, shared schemas/readiness, external_agent, sandbox, model-selector, i18n: 1433 passed; docs suite: 166 passed (frontmatter manifest guarded).tsc --noEmitclean;oxlintclean on all touched paths;knipandformat:checkgreen.pi --help.Not provable locally: sandbox image build (Docker), live gateway metering/VK mint, real BYO provider calls — the container-runtime integration test covers image assertions in CI.