Skip to content

feat: Add Pi agent support and .env.example template#56

Closed
shrwnsan wants to merge 12 commits intofletchgqc:mainfrom
shrwnsan:feat/pi-agent-support
Closed

feat: Add Pi agent support and .env.example template#56
shrwnsan wants to merge 12 commits intofletchgqc:mainfrom
shrwnsan:feat/pi-agent-support

Conversation

@shrwnsan
Copy link
Contributor

@shrwnsan shrwnsan commented Feb 27, 2026

Summary

  • Add Pi agent support with AGENTBOX_INCLUDE_PI build arg and --tool pi flag
  • Add comprehensive .env.example template for API key configuration
  • Fix NVM sourcing for Pi npm installation in Dockerfile
  • Update tool error messages to include 'pi' option
  • Clarify ANTHROPIC_API_KEY vs ANTHROPIC_AUTH_TOKEN usage in .env.example

Dependency:
Based on feat/config-file (PR #54) which adds config file support and optional toolchains.

Changes

Pi Agent Support

  • New AGENTBOX_INCLUDE_PI build arg (default: false)
  • New --tool pi CLI flag for running Pi instead of Claude
  • Auto-enables Pi installation when --tool pi is selected
  • Mounts ~/.pi directory for Pi configuration persistence

.env.example Template

  • Comprehensive template with all Anthropic environment variables
  • Documents model selection variables for Claude Code
  • Lists optional LLM provider API keys (OpenAI, Gemini, Mistral, Groq, etc.)
  • Clarifies which tools use which authentication variables

Bug Fixes

  • Fix NVM sourcing before npm install in Pi installation block
  • Update --tool error message to list all three options

Test plan

  • Build image with --tool pi and verify Pi installs correctly
  • Verify agentbox --tool pi starts Pi agent
  • Confirm .env.example template covers necessary API keys
  • Test all three tool selections: claude, opencode, pi

shrwnsan and others added 11 commits February 27, 2026 01:04
Add ~/.agentbox/config for persistent settings (tool, Java, Claude channel).
Make Java opt-out with --no-java flag (backwards compatible).
Add --cc-latest flag for latest Claude Code channel.
Improve Java status message to avoid command-not-found errors.

Config file supports bash key=value format with shebang for syntax highlighting.
CLI flags override config file settings.

Co-Authored-By: GLM <zai-org@users.noreply.github.com>
Override AGENTBOX_INCLUDE_OPENCODE=false when AGENTBOX_TOOL=opencode
since the tool cannot run without being installed.

Co-Authored-By: GLM <zai-org@users.noreply.github.com>
- Prefix all Docker ARGs with AGENTBOX_ for consistency (INCLUDE_JAVA, CC_CHANNEL, etc.)
- Add AGENTBOX_SIMPLE_PROMPT arg for simple traditional Unix-style prompt (user@host:~)
- Keep default oh-my-zsh theme for backwards compatibility
- Maintain terminal size handling for better TTY support
- Add projects/ and .agents/ to .gitignore

Co-Authored-By: OpenCode <noreply@opencode.ai>
Add support for Pi coding agent (pi.dev) as an opt-in tool.

- Add AGENTBOX_INCLUDE_PI build arg (default: false)
- Auto-enable Pi when AGENTBOX_TOOL=pi is set
- Mount ~/.pi/ directory for config persistence
- Add Pi to tool validation and help text
- Update entrypoint.sh to display Pi version

Usage: AGENTBOX_TOOL=pi agentbox
- Template for ~/.agentbox/.env (global configuration)
- Anthropic API key (required for Claude, Pi, OpenCode)
- Optional LLM providers for Pi and OpenCode (OpenAI, Gemini, Mistral, Groq, etc.)
- Docker host access configuration (AGENTBOX_EXTRA_HOSTS)
- Clear authentication setup instructions for each tool
- Documented config/auth directory mounts and precedence

Co-authored-by: Amp <amp@ampcode.com>
- ANTHROPIC_AUTH_TOKEN (used by Claude Code)
- ANTHROPIC_BASE_URL (API endpoint)
- ANTHROPIC_MODEL variants (Opus, Sonnet, Haiku selection)
- Kept ANTHROPIC_API_KEY for Pi compatibility
- Both AUTH_TOKEN and API_KEY can be set to same value

Co-authored-by: Amp <amp@ampcode.com>
Claude Code recommends AUTH_TOKEN over API_KEY. Kept both for Pi compatibility.

Co-authored-by: Amp <amp@ampcode.com>
Replace generic beach emoji with 🤖 to match other tool icons

Co-Authored-By: GLM <zai-org@users.noreply.github.com>
- Update --tool error message to include 'pi' option
- Move ANTHROPIC_API_KEY to optional section in .env.example
  (Pi agent uses this variable, Claude Code uses ANTHROPIC_AUTH_TOKEN)
The claude.ai/install.sh URL is geo-blocked in some regions, returning
an HTML page instead of the install script. Using npm to install
@anthropic-ai/claude-code bypasses this restriction.

Co-Authored-By: GLM <zai-org@users.noreply.github.com>
@shrwnsan
Copy link
Contributor Author

shrwnsan commented Feb 27, 2026

Dockerfile Update

This PR now includes a fix for Claude Code installation:

Problem: The https://claude.ai/install.sh URL is geo-blocked in some regions, returning an HTML "App unavailable in region" page instead of the install script. This causes Docker builds to fail with:

bash: line 1: syntax error near unexpected token `<'
bash: line 1: `<!DOCTYPE html>...

Solution: Changed to install Claude Code via npm (@anthropic-ai/claude-code) which bypasses the geo-restriction:

RUN export NVM_DIR="/home/agent/.nvm" && \
    [ -s "$NVM_DIR/nvm.sh" ] && . "$NVM_DIR/nvm.sh" && \
    if [ "$AGENTBOX_CC_CHANNEL" = "latest" ]; then \
        npm install -g @anthropic-ai/claude-code@latest; \
    else \
        npm install -g @anthropic-ai/claude-code@stable; \
    fi && \
    zsh -i -c 'which claude && claude --version'

This also maintains support for the --cc-latest flag via the @latest npm tag.

🤖 Generated by Claude Code - GLM 5

Without a tag, npm defaults to @latest. Explicitly use @stable to
match intended behavior (stable by default, latest opt-in via --cc-latest).

Co-Authored-By: GLM <zai-org@users.noreply.github.com>
@shrwnsan
Copy link
Contributor Author

Closing in favor of a new clean PR

@shrwnsan shrwnsan closed this Feb 28, 2026
@shrwnsan
Copy link
Contributor Author

shrwnsan commented Mar 1, 2026

Closing this PR in favor of #60, which contains the same Pi agent support feature but is now based on upstream/main instead of feat/config-file. This makes the PR self-contained and not dependent on the config file feature.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant