@mjakl/pi-kagi-search

Kagi search tool for Pi coding agent

Package details

extension

Install @mjakl/pi-kagi-search from npm and Pi will load the resources declared by the package manifest.

$ pi install npm:@mjakl/pi-kagi-search
Package
@mjakl/pi-kagi-search
Version
1.0.2
Published
Feb 16, 2026
Downloads
75/mo · 25/wk
Author
mjakl
License
MIT
Types
extension
Size
17.1 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 Kagi Search

Kagi search tool for Pi agent. Uses your existing Kagi subscription via session token.

Why Pi Kagi Search

Uses Existing Subscription — If you have a Kagi subscription, you can use this extension without needing a separate API key. Just provide your session token.

High-Quality Results — Kagi is designed for relevance over ads. In practice, this often means cleaner, more useful results with less SEO noise, so Pi can start from stronger sources.

Better Research Flow — When search results are high-signal, the agent spends less time filtering low-value pages and more time helping you solve the real problem.

Install

Option 1: Install from npm (recommended)

Once the package is published to npm:

pi install npm:@mjakl/pi-kagi-search

If it is not published yet, use Option 2 or 3 below.

Option 2: Install via git

pi install git:github.com/mjakl/pi-kagi-search

Option 3: Manual Installation

Clone this repository to your Pi extensions directory:

cd ~/.pi/agent/extensions
git clone https://github.com/mjakl/pi-kagi-search.git
cd pi-kagi-search
npm install

Configuration

Get Your Session Token

  1. Log in to Kagi
  2. Go to Settings → User Details
  3. Find your Session Link or visit kagi.com/settings?p=token
  4. Extract the token value from the URL

Set the Token

Option 1: Environment Variable (Recommended)

export KAGI_SESSION_TOKEN="your-token-here"

Add to your shell profile (~/.zshrc, ~/.bashrc) to persist.

Option 2: Interactive Login

pi
# Then use the command:
/kagi-login

Option 3: Config File

Create ~/.pi/kagi-search.json:

{
  "sessionToken": "your-token-here"
}

Option 4: Plain Text File

Create ~/.kagi_session_token with just the token:

echo "your-token-here" > ~/.kagi_session_token

This is checked as the last fallback if other methods are not configured.

Web Fetching

For fetching page contents, we recommend using a dedicated webfetch tool like Ben Vargas' Firecrawl extension. The agent can also fall back to curl to retrieve content when needed.

Commands

Command Description
/kagi-login Set your Kagi session token interactively

Security Note

Your session token provides access to your Kagi account. Keep it private and treat it like a password. The token can be stored in:

  1. Environment variable (most secure for shell sessions)
  2. ~/.pi/kagi-search.json config file
  3. ~/.kagi_session_token plain text file (last fallback)

Comparison to Kagi API

Feature Kagi API This Extension
Requires API access Yes (invite-only) No
Uses existing subscription No Yes
Search Yes Yes
Rate limits API limits Account limits

This extension is useful if you have a Kagi subscription but don't have API access yet.

Related Projects

Author

Inspired by kagi-ken by Carlo Zottmann.

License

MIT