@mammothb/pi-eval
A pi extension that adds an eval tool for executing JavaScript and Python code in isolated subprocesses
Package details
Install @mammothb/pi-eval from npm and Pi will load the resources declared by the package manifest.
$ pi install npm:@mammothb/pi-eval- Package
@mammothb/pi-eval- Version
2.1.1- Published
- Jun 13, 2026
- Downloads
- 1,117/mo · 1,117/wk
- Author
- mammothb
- License
- MIT
- Types
- extension
- Size
- 24.5 KB
- Dependencies
- 1 dependency · 4 peers
Pi manifest JSON
{
"extensions": [
"./index.ts"
]
}Security note
Pi packages can execute code and influence agent behavior. Review the source before installing third-party packages.
README
pi-eval
A pi extension that adds an eval tool for executing
JavaScript and Python code in isolated subprocesses.
Usage
Once installed, the LLM can call the eval tool to run code snippets without
managing temp files. Each call spawns a fresh subprocess — no state persists
between calls.
Tool parameters
| Parameter | Type | Default | Description |
|---|---|---|---|
language |
string | (required) | Programming language: "javascript" or "python" |
code |
string | (required) | Code to execute |
cwd |
string | agent's cwd | Working directory for the subprocess |
Runtime configuration
Python binary and Node.js module paths are configured via JSON files, not per-call parameters:
- Global:
~/.pi/agent/pi-eval.json - Project:
.pi/pi-eval.json(overrides global)
{
"pythonPath": ".venv/bin/python3",
"nodeModulesPath": "./node_modules"
}
Relative paths in project configs are resolved relative to the project root.
Features
- JavaScript: Writes code to a temp file, spawns
nodeas a subprocess. Console output is captured as labeledSTDOUT:/STDERR:sections. SetnodeModulesPathin config to make project packages available viarequire(). - Python: Spawns
python3with-c, capturing stdout/stderr identically. By default, searchesPATHforpython3(falling back to/usr/bin/python3,/usr/local/bin/python3). SetpythonPathin config to target a venv or custom binary. - Safety: 30-second timeout, 1 MB output cap, Escape to cancel a running evaluation.