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

> ## Agent Instructions
> Every page is listed in https://docs.keenable.ai/llms.txt. To pick a product for a job, read https://docs.keenable.ai/choose.md
> Setup steps for agents, covering the SDKs, the MCP server and the CLI: https://docs.keenable.ai/skill.md
> Keenable search and fetch work without an API key. To add them to code, use the official SDK for the project's language: https://docs.keenable.ai/sdks.md
> Without a key, call POST https://api.keenable.ai/v1/search/public or GET https://api.keenable.ai/v1/fetch/public with an X-Keenable-Title header that names your app.
> With a key, send it in the X-API-Key header and read it from the KEENABLE_API_KEY environment variable. Never ask a user to paste a key into chat. Every access method: https://docs.keenable.ai/auth.md
> To get an API key without the console, use device login: https://docs.keenable.ai/authentication.md#device-login
> MCP server: https://api.keenable.ai/mcp (no key, or X-API-Key; keyless Codex uses https://api.keenable.ai/mcp-public), or https://api.keenable.ai/mcp-oauth for OAuth sign-in. These docs are an MCP server at https://docs.keenable.ai/mcp and the OpenAPI spec is at https://docs.keenable.ai/api-reference/openapi.json
> Keenable searches and fetches public web pages. If a question needs no web information, skip the call.
> On 402 with an API key (code insufficient_credits), stop and ask a human to add credits; don't retry. On 429, wait the number of seconds in Retry-After, then retry. Before you ship, follow https://docs.keenable.ai/production.md
> Every error, with its cause and fix, is in https://docs.keenable.ai/errors.md and moving from another search API is covered in https://docs.keenable.ai/migrate.md
> Before you compare Keenable with another search API, read https://docs.keenable.ai/guides/evaluate-search-apis.md

# Look up current library docs from a coding agent

> How to give a coding agent current library docs and changelogs: connect the MCP server, add an AGENTS.md rule, search one docs site, fetch with a prompt.

Give your coding agent the docs for the library version you run, instead of what it remembers from training. Connect the Keenable MCP server, add a rule that tells the agent to check the library's own docs before it writes code, and the agent searches one docs site with `site`, then reads only the part of the page it needs with a fetch `prompt`.

## What to send for each lookup

Each docs task maps to one tool call and one or two parameters:

| Task | Tool | What to send |
| - | - | - |
| Find the docs page for a function or setting | `search_web_pages` | `site` set to the docs host and version path, such as `docs.pydantic.dev/latest` |
| Read a signature, a config key or an example | `fetch_page_content` | `prompt` naming the function or key, and `max_chars` to cap the answer |
| Find what changed in a release | `search_web_pages` | `site` set to the repository, such as `github.com/pydantic/pydantic`, and `published_after` such as `180d` |
| Search for an exact error message | `search_web_pages` | The error string in double quotes inside `query`. See [Search operators](https://docs.keenable.ai/guides/search-operators.md). |
| Read a page that changed today | `fetch_page_content` | `live: true`. See [Live fetch](https://docs.keenable.ai/guides/live-fetch.md). |

The `site` value covers subdomains, and a path narrows it further, so `github.com/pydantic/pydantic` searches one repository. See [Search request](https://docs.keenable.ai/api-reference/search.md#request) for the full `site` rules and [Filter by domain](https://docs.keenable.ai/guides/filter-by-domain.md) for leaving hosts out.

## Connect the MCP server

The [Keenable CLI](https://docs.keenable.ai/cli.md) adds the server to every coding agent it finds among Claude Code, Cursor, Devin Desktop, Codex and OpenCode:

```bash theme={"theme":{"light":"github-light-high-contrast","dark":"dark-plus"}}
keenable configure-mcp --all
```

To add it to Claude Code by hand, run this command. It needs no API key:

```bash theme={"theme":{"light":"github-light-high-contrast","dark":"dark-plus"}}
claude mcp add --transport http --scope user keenable https://api.keenable.ai/mcp
```

Without a key, the agent's calls share the keyless limit of 1,000 requests per hour per IP address. Add `--header "X-API-Key: keen_<your_key>"` at the end of the command to lift the hourly cap. [MCP server](https://docs.keenable.ai/mcp-server.md#installation) has the config for Codex, Cursor and other clients.

## Tell the agent to check the docs

An agent that has the tools still answers from memory unless you tell it when to look. Add this block to `AGENTS.md` at the root of your repository. Codex and Cursor read `AGENTS.md`, and Codex also reads `~/.codex/AGENTS.md` for every project:

```markdown AGENTS.md theme={"theme":{"light":"github-light-high-contrast","dark":"dark-plus"}}
## Library docs

- Before you write or change code that calls a third-party library, check its current docs with Keenable. Don't rely on memory for signatures, config keys or defaults.
- Find the page with `search_web_pages`. Set `site` to the library's docs host, with the version path if the docs have one, for example `docs.pydantic.dev/latest`.
- Read the page with `fetch_page_content`. Pass a `prompt` that names the function or setting you need, so you get that part instead of the whole page.
- For upgrades and breaking changes, search the repository with `site` set to `github.com/<org>/<repo>` and `published_after` set to `180d`.
- Put the URL of the docs page you used in your reply or the commit message.
```

Claude Code, from v2.1.277, reads `AGENTS.md` only when the repository has no `CLAUDE.md`. If it has one, add a line with `@AGENTS.md` to `CLAUDE.md` so Claude Code imports the block, or paste the block into `CLAUDE.md`. For every project on your machine, put the block in `~/.claude/CLAUDE.md`.

If your agent also has a built-in web search, turn it off so the rule isn't split between two tools. See [Claude](https://docs.keenable.ai/integrations/claude.md#turn-off-the-built-in-search), [Codex](https://docs.keenable.ai/integrations/codex.md) and [Cursor](https://docs.keenable.ai/integrations/cursor.md).

## Search one docs site, then read the answer

The agent makes the same two calls as this sample. The sample searches the current Pydantic docs, takes the top result, and fetches only the example it needs. It runs with no API key:

```typescript TypeScript theme={"theme":{"light":"github-light-high-contrast","dark":"dark-plus"}}
// Needs keenable 0.2.0 or later on npm.
import { Keenable } from "keenable";

async function main() {
  const client = new Keenable(); // keyless: no API key needed to try it

  // 1. Search only the current docs of one library
  const results = await client.search("how to validate one field against another with a model validator", {
    site: "docs.pydantic.dev/latest", // the /latest path skips old versioned docs
    maxResults: 3,
  });
  const top = results.results[0];
  console.log(`Top result: ${top.title} (${top.url})`);

  // 2. Read only the part of that page you need
  const page = await client.fetch(top.url, {
    prompt:
      "Show how a model validator with mode='after' checks one field against another. Answer with one short code block and one sentence.",
    maxChars: 800,
  });
  console.log(page.content);
}

main();
```

```python Python theme={"theme":{"light":"github-light-high-contrast","dark":"dark-plus"}}
from keenable import Keenable

client = Keenable()  # keyless: no API key needed to try it

# 1. Search only the current docs of one library
results = client.search(
    "how to validate one field against another with a model validator",
    site="docs.pydantic.dev/latest",  # the /latest path skips old versioned docs
    max_results=3,
)
top = results[0]
print(f"Top result: {top.title} ({top.url})")

# 2. Read only the part of that page you need
page = client.fetch(
    top.url,
    prompt="Show how a model validator with mode='after' checks one field against another. Answer with one short code block and one sentence.",
    max_chars=800,
)
print(page.content)
```

```go Go theme={"theme":{"light":"github-light-high-contrast","dark":"dark-plus"}}
package main

import (
	"context"
	"fmt"
	"log"

	"github.com/keenableai/keenable-sdk/go"
)

func main() {
	ctx := context.Background()
	client, err := keenable.New(nil) // keyless: no API key needed to try it
	if err != nil {
		log.Fatal(err)
	}
	defer client.Close()

	// 1. Search only the current docs of one library
	results, err := client.Search(ctx, "how to validate one field against another with a model validator",
		&keenable.SearchOptions{
			Site:       "docs.pydantic.dev/latest", // the /latest path skips old versioned docs
			MaxResults: 3,
		})
	if err != nil {
		log.Fatal(err)
	}
	if len(results.Results) == 0 {
		log.Fatal("no results")
	}
	top := results.Results[0]
	fmt.Printf("Top result: %s (%s)\n", top.Title, top.URL)

	// 2. Read only the part of that page you need
	page, err := client.FetchWithOptions(ctx, top.URL, &keenable.FetchOptions{
		Prompt:   "Show how a model validator with mode='after' checks one field against another. Answer with one short code block and one sentence.",
		MaxChars: 800,
	})
	if err != nil {
		log.Fatal(err)
	}
	fmt.Println(page.Content)
}
```

```rust Rust theme={"theme":{"light":"github-light-high-contrast","dark":"dark-plus"}}
use keenable::{Client, FetchOptions, SearchOptions};

#[tokio::main]
async fn main() -> Result<(), keenable::Error> {
    let client = Client::new()?; // keyless: no API key needed to try it

    // 1. Search only the current docs of one library
    let results = client
        .search_with(
            "how to validate one field against another with a model validator",
            &SearchOptions {
                site: Some("docs.pydantic.dev/latest".into()), // the /latest path skips old versioned docs
                max_results: Some(3),
                ..Default::default()
            },
        )
        .await?;
    let top = &results.results[0];
    println!("Top result: {} ({})", top.title, top.url);

    // 2. Read only the part of that page you need
    let page = client
        .fetch_with(
            &top.url,
            &FetchOptions {
                prompt: Some(
                    "Show how a model validator with mode='after' checks one field against another. Answer with one short code block and one sentence."
                        .into(),
                ),
                max_chars: Some(800),
                ..Default::default()
            },
        )
        .await?;
    println!("{}", page.content);
    Ok(())
}
```

```bash curl theme={"theme":{"light":"github-light-high-contrast","dark":"dark-plus"}}
# 1. Search only the current docs of one library
curl -X POST https://api.keenable.ai/v1/search/public \
  -H "Content-Type: application/json" \
  -H "X-Keenable-Title: My App" \
  -d '{
    "query": "how to validate one field against another with a model validator",
    "site": "docs.pydantic.dev/latest",
    "max_results": 3
  }'

# 2. Fetch the URL you picked, and only the part you need
curl -G https://api.keenable.ai/v1/fetch/public \
  -H "X-Keenable-Title: My App" \
  --data-urlencode "url=https://docs.pydantic.dev/latest/examples/custom_validators" \
  --data-urlencode "prompt=Show how a model validator with mode='after' checks one field against another. Answer with one short code block and one sentence." \
  --data-urlencode "max_chars=800"
```

You see the page the search picked, then the code example and one sentence from that page. This run was made on 19 November 2026 with the Python sample:

````text Example output · results vary theme={"theme":{"light":"github-light-high-contrast","dark":"dark-plus"}}
Top result: Custom Validators (https://docs.pydantic.dev/latest/examples/custom_validators)
```python
class Organization(BaseModel):
    forbidden_passwords: list[str]
    users: list[User]

    @model_validator(mode='after')
    def validate_user_passwords(self) -> Self:
        for user in self.users:
            current_pw = user.password
            if current_pw in self.forbidden_passwords:
                raise ValueError(
                    f'Password {current_pw} is forbidden. Please choose another password for user {user.username}.'
                )
        return self
```

A model validator with `mode='after'` can check fields against one another by iterating through the model's attributes (such as checking `user.password` against `self.forbidden_passwords`) after standard validation has completed.
````

The prompt returns under 800 characters, the `max_chars` cap, instead of the whole page. That keeps the agent's context free for your code. See [Fetch with a prompt](https://docs.keenable.ai/guides/fetch-with-prompt.md) for prompts that return parseable output.

## Pin the docs version

Many docs sites keep a copy for every release. If `site` names only the host, old versions can rank first. On 19 November 2026, a search for `model_validator` with `site` set to `docs.pydantic.dev` returned only pages under version paths such as `/2.8/` in its top 3. With `docs.pydantic.dev/latest`, every result came from the current docs.

| Docs layout | `site` value |
| - | - |
| A `latest` or `stable` path for the current release | The host and that path, such as `docs.pydantic.dev/latest` |
| A path per version | The host and the version you run, read from your lockfile |
| One copy, no version paths | The host alone |
| Release notes on GitHub | `github.com/<org>/<repo>` with `published_after` |

## Common mistakes

| Wrong | Right | Why |
| - | - | - |
| `site` set to the docs host when the site keeps old versions | The host plus the version path | Old versioned pages can rank above the current one. |
| Fetch the whole docs page into context | Fetch with a `prompt` and `max_chars` | A reference page can run to tens of thousands of characters. See [Long pages](https://docs.keenable.ai/guides/long-pages.md). |
| A rule that says only "use Keenable for the web" | A rule that says when to check docs and which `site` to use | The agent decides that it knows a library and skips the lookup. |
| The rule in `AGENTS.md` while the repository also has a `CLAUDE.md` | Import it with `@AGENTS.md` in `CLAUDE.md` | Claude Code reads `CLAUDE.md` instead of `AGENTS.md` when both exist. |
| `published_after` on a docs site search | `published_after` on a repository or blog search | `published_after` leaves out every page with no known publish date, and docs pages often have none. See [Filter by date](https://docs.keenable.ai/guides/filter-by-date#publish-date-or-index-date). |

## Verify

Start a new session in your repository and ask the agent to change code that uses a library, such as "Add a model validator that checks `end` is after `start`." The agent should call `search_web_pages` with `site` set to the docs host before it edits the file, and name the docs URL in its reply.

## API reference

* [MCP server tools](https://docs.keenable.ai/mcp-server.md#available-tools): every `search_web_pages` and `fetch_page_content` argument.
* [Search request](https://docs.keenable.ai/api-reference/search.md#request): `site` and `published_after` over HTTP.
* [Agent skill](https://docs.keenable.ai/agent-skill.md): search from a shell script when the agent has no MCP client.


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.