Skip to content
This repository was archived by the owner on Jun 13, 2026. It is now read-only.

jarcelao/pi-exa-api

Repository files navigation

pi-exa-api

Important

Development of this extension has been moved to jarcelao/pi-extensions

Web search, content fetching, and code context for pi via the Exa API.

Installation

Install as a pi package:

pi install npm:@jarcelao/pi-exa-api

Note

This extension is tested up to pi-coding-agent v0.78.0

Configuration

You can configure your Exa API key using either method below. File-based auth takes priority over the environment variable.

Option 1 — Auth file (recommended)

Create ~/.pi/agent/exa-auth.json:

{
  "exaApiKey": "your-api-key-here"
}

Option 2 — Environment variable

Set your Exa API key as an environment variable before starting pi:

export EXA_API_KEY="your-api-key-here"
pi

Or add to your shell profile (~/.bashrc, ~/.zshrc, etc.) for persistence.

Check Configuration

Run the /exa-status command in pi to verify your API key is configured and see which source it was loaded from:

/exa-status

Usage

Web Search

The agent can use exa_search to find information on the web:

Search for recent developments in quantum computing

Parameters:

  • query (required) - Natural language search query
  • contentType (optional) - Type of content to retrieve:
    • highlights (default) - Key excerpts from each result
    • text - Full text content (may be truncated)
    • summary - AI-generated summary
    • none - Metadata only (title, URL, date, author)
  • numResults (optional) - Number of results (1-100, default: 10)

Fetch URL Content

The agent can use exa_fetch to extract content from a specific URL:

Fetch the content from https://example.com/article

Parameters:

  • url (required) - URL to fetch
  • contentType (optional) - Type of content:
    • text (default) - Full page text
    • highlights - Key excerpts
    • summary - AI-generated summary
  • maxCharacters (optional) - Maximum characters to return (1000-100000)

Code Context

Important

On July 1, 2026, I aim to retire this tool from the extension. From experience, most models opt to use the search and fetch tools instead, which still gives satisfactory results. You can already try this out in the feat/remove-context branch. For any feedback, feel free to raise an issue.

The agent can use exa_code_context to find code snippets and examples from open source libraries and repositories:

Find examples of React hooks for state management

It's ideal for understanding how libraries, frameworks, or programming concepts are implemented in practice.

Parameters:

  • query (required) - Search query for code snippets and examples (1-2000 characters)
  • tokensNum (optional) - Token limit for the response:
    • "dynamic" (default) - Automatically determine optimal response length
    • 50-100000 - Specific number of tokens (5000 is a good default, use 10000 when more context is needed)

Development

# Install dependencies
npm install

# Run tests
npm test

# Run linting
npm run lint

# Format code
npm run format

License

MIT

About

Web search and content fetching for pi via the Exa API

Topics

Resources

Stars

Watchers

Forks

Releases

Contributors

Languages