Pi Coding Agent is the minimal terminal harness from Mario Zechner's pi-mono project. The design choice is four tools only (read, write, edit, bash) and extensions for everything else. The first extension most Pi users write is web search. This tutorial shows how to add Scavio as a Pi extension so the agent can search Google, Reddit, YouTube, and retail platforms during a session.
Prerequisites
- Node.js 20+
- Pi Coding Agent installed (npm install -g @mariozechner/pi-coding-agent)
- A Scavio API key (free 500 credits at scavio.dev)
- Basic TypeScript familiarity
Walkthrough
Step 1: Install the Scavio SDK
Add the Scavio TypeScript client to your Pi extensions directory.
cd ~/.pi/extensions
npm init -y
npm install scavioStep 2: Create the extension file
Pi extensions are TypeScript modules that export a tool registration function.
// ~/.pi/extensions/scavio-search.ts
import { Scavio } from 'scavio';
export const scavioSearch = {
name: 'web_search',
description: 'Search Google, Reddit, YouTube, Amazon via Scavio',
parameters: {
query: { type: 'string', required: true },
platform: { type: 'string', default: 'google' }
},
handler: async ({ query, platform }) => {
const client = new Scavio({ apiKey: process.env.SCAVIO_API_KEY });
const results = await client.search({ query, platform });
return results.organic_results?.slice(0, 5) || results;
}
};Step 3: Register the extension with Pi
Add to your Pi config so it loads on every session.
// ~/.pi/config.ts
import { scavioSearch } from './extensions/scavio-search';
export default {
extensions: [scavioSearch]
};Step 4: Set your Scavio API key
Export the key so Pi sessions pick it up automatically.
echo 'export SCAVIO_API_KEY=sk_live_...' >> ~/.zshrc
source ~/.zshrcStep 5: Use the tool in a Pi session
Start Pi and ask it to search. The agent now has a web_search tool alongside read, write, edit, and bash.
pi
> Find the latest Next.js 16 app router breaking changesPython Example
# Pi is TypeScript-native. For Python parity, use the Scavio Python SDK in your own harness:
import os
from scavio import Scavio
client = Scavio(api_key=os.environ['SCAVIO_API_KEY'])
results = client.search(query='Next.js 16 app router breaking changes')
for r in results['organic_results'][:5]:
print(r['title'], '-', r['link'])JavaScript Example
import { Scavio } from 'scavio';
export const scavioSearch = {
name: 'web_search',
description: 'Search Google via Scavio',
parameters: { query: { type: 'string', required: true } },
handler: async ({ query }) => {
const client = new Scavio({ apiKey: process.env.SCAVIO_API_KEY });
return (await client.search({ query })).organic_results.slice(0, 5);
}
};Expected Output
Pi session returns the top 5 Google results inline, ready to feed into the next agent step. The extension persists across every future Pi session and adds ~30 credits per call on Scavio.