> ## Documentation Index
> Fetch the complete documentation index at: https://docs.tavily.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Pi

> Use Tavily in Pi via the official @tavily/pi-extension package to add web search and page extraction tools to your coding agent workflow.

<CardGroup cols={2}>
  <Card title="npm" icon="npm" href="https://www.npmjs.com/package/@tavily/pi-extension" horizontal>
    `@tavily/pi-extension`
  </Card>

  <Card title="Get API Key" icon="key" href="https://app.tavily.com" horizontal>
    Sign up at tavily.com
  </Card>
</CardGroup>

## Introduction

[Pi](https://pi.dev) is a minimal terminal coding agent and harness that you can extend with TypeScript extensions, skills, prompt templates, and themes.

Tavily integrates with Pi through the official npm package:

```bash theme={null}
@tavily/pi-extension
```

Install it in Pi with:

```bash theme={null}
pi install npm:@tavily/pi-extension
```

## What this adds to Pi

The Tavily Pi extension adds two Tavily-powered tools:

* `web_search` — search the web with Tavily Search
* `web_fetch` — extract content from one or more URLs with Tavily Extract

<Note>These are Pi extension tools, not Pi built-in tools.</Note>

## Requirements

* Pi installed locally
* A Tavily API key

## Authentication

Version 1 uses an API key via environment variable:

```bash theme={null}
export TAVILY_API_KEY=tvly-...
```

OAuth or Pi-native login for Tavily is not included yet.

## Install

<AccordionGroup>
  <Accordion title="Step 1: Install Pi">
    If Pi is not installed yet, install it first:

    ```bash theme={null}
    npm install -g @mariozechner/pi-coding-agent
    ```
  </Accordion>

  <Accordion title="Step 2: Set your Tavily API key">
    Export your Tavily API key in the same shell where you will launch Pi:

    ```bash theme={null}
    export TAVILY_API_KEY=tvly-...
    ```
  </Accordion>

  <Accordion title="Step 3: Install the Tavily Pi extension">
    Install the published npm package into Pi:

    ```bash theme={null}
    pi install npm:@tavily/pi-extension
    ```
  </Accordion>

  <Accordion title="Step 4: Enable the extension resource">
    After installation, make sure the extension resource is enabled:

    ```bash theme={null}
    pi config
    ```

    If the package is installed but `web_search` or `web_fetch` do not appear, this is the first thing to check.
  </Accordion>

  <Accordion title="Step 5: Verify the tools are available">
    Start a fresh Pi session in a clean directory:

    ```bash theme={null}
    mkdir -p /tmp/pi-tavily-test
    cd /tmp/pi-tavily-test
    export TAVILY_API_KEY=tvly-...
    pi --no-session
    ```

    Then ask Pi:

    ```text theme={null}
    What tools do you have available right now? Reply with only the tool names.
    ```

    You should see `web_search` and `web_fetch` in the available tools.
  </Accordion>
</AccordionGroup>

## Example prompts

### Search

```text theme={null}
Use the web_search tool to search the web for the latest Tavily announcements.
```

```text theme={null}
Search the web for recent Tavily news from the last month. Use news topic, advanced depth, include an answer, and include favicons.
```

### Fetch

```text theme={null}
Use the web_fetch tool to fetch https://docs.tavily.com and summarize it.
```

```text theme={null}
Fetch these pages and compare them:
https://docs.tavily.com/documentation/api-reference/endpoint/search
https://docs.tavily.com/documentation/api-reference/endpoint/extract
```

## Troubleshooting

If Pi says it cannot access the web or Tavily tools do not appear, check these in order:

1. Is the package installed?
   ```bash theme={null}
   pi list
   ```
2. Is the extension resource enabled?
   ```bash theme={null}
   pi config
   ```
3. Is the API key set in the same shell where Pi is launched?
   ```bash theme={null}
   echo $TAVILY_API_KEY
   ```
4. Are you starting a fresh session?
   ```bash theme={null}
   pi --no-session
   ```

## Learn more

* [Pi website](https://pi.dev)
* [Pi GitHub repository](https://github.com/badlogic/pi-mono)
* [Tavily API documentation](/documentation/api-reference/introduction)
