pi-google-code-execution

May 12, 2026 · View on GitHub

ci license: MIT

Google native code execution extension for the pi coding agent.

This package is the standalone extraction of senpi's former builtin google-code-execution extension.

Behavior

The extension does not register a new tool. It intercepts Google provider requests before they are sent and ensures a native codeExecution tool is present for google-generative-ai / google-vertex payloads when code execution is enabled via opt-in env var.

CaseResult
API is google-generative-ai or google-vertex, PI_GOOGLE_CODE_EXECUTION is truthy, and no Tool object has a codeExecution keyinjects a new Tool entry { codeExecution: {} }
Existing Tool object already has codeExecution key (any value)preserves caller payload without duplication or overwrite
Existing Tool object has only functionDeclarationskeeps that object and adds separate { codeExecution: {} } entry
PI_GOOGLE_CODE_EXECUTION is unset/empty/falsy/unknownno-op
API is non-Googleno-op

Truthy values for PI_GOOGLE_CODE_EXECUTION are: 1, true, yes, on (case-insensitive, surrounding whitespace allowed). Any other value disables injection (opt-in default off).

It also appends a system-prompt section for Google sessions indicating native code_execution availability when enabled.

Installation

The package targets the pi coding agent. Pi loads extensions from ~/.pi/agent/extensions/, project .pi/extensions/, or via the --extension / -e CLI flag.

# From npm (once published)
pi install npm:pi-google-code-execution

# From git
pi install git:github.com/code-yeongyu/pi-google-code-execution

# Manual placement
git clone https://github.com/code-yeongyu/pi-google-code-execution ~/.pi/agent/extensions/pi-google-code-execution
cd ~/.pi/agent/extensions/pi-google-code-execution && npm install

# Dev / one-shot test
pi -e /path/to/pi-google-code-execution/src/index.ts

After installation, restart pi or run /reload inside an interactive session.

Development

npm install
npm test
npm run typecheck
npm run check
pi -e ./src/index.ts

The test suite uses vitest. TypeScript is strict, Node-only, and uses ESM imports with .js suffixes.

Origin

Ported from packages/coding-agent/src/core/extensions/builtin/google-code-execution/index.ts in the senpi-mono fork of pi-mono.

  • senpi — the fork/runtime these extensions are extracted from.
  • Ultraworkers Discord — community link from the senpi README.
  • Dori — the product powered by senpi under the hood.