Skip to content
Closed
Changes from all commits
Commits
Show all changes
20 commits
Select commit Hold shift + click to select a range
ff6a922
docs: add an "Any MCP client" integration item
rejojer Aug 28, 2026
46386cc
docs: plainer wording for the MCP item
rejojer Aug 28, 2026
139f196
docs: tighten the MCP item's opening line
rejojer Aug 28, 2026
d4d26f6
docs: tighten the MCP item's prose
rejojer Aug 28, 2026
c89c776
docs: mark the missing local MCP server as a not-yet
rejojer Aug 28, 2026
e37e4a6
docs: don't offer as_claude_mcp() as a general MCP entry point
rejojer Aug 28, 2026
313fb7e
docs: link the MCP item to the Claude Agent SDK block
rejojer Aug 28, 2026
55f02f2
docs: say "local mode", the README's established term
rejojer Aug 28, 2026
1eb1b6a
docs: link PageIndex Cloud in the MCP item
rejojer Aug 28, 2026
db23676
docs: parenthesize the tool-runner qualifier
rejojer Aug 28, 2026
2c72f9c
docs: lead with the noun in the local fallback
rejojer Aug 28, 2026
fbe7e76
docs: fix the (b) intro and the messages() model-name rule
rejojer Aug 28, 2026
968c327
docs: trim the Anthropic model-id note
rejojer Aug 28, 2026
ab9dc7e
docs: parenthesize the prefix caveat
rejojer Aug 28, 2026
1a5fec1
docs: move the whole model-name clause into parentheses
rejojer Aug 28, 2026
50a7124
docs: say "plain model id"
rejojer Aug 28, 2026
820a487
docs: drop the prefix caveat, explain the Agents SDK model name
rejojer Aug 28, 2026
c615709
docs: Claude Agent SDK item — key, model rule, model= in the explicit…
rejojer Aug 28, 2026
fd6f987
docs: say chat_model carries over on messages() and the tool runner
rejojer Aug 28, 2026
01c8b0d
docs: Anthropic examples rely on the carried-over chat_model
rejojer Aug 28, 2026
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
44 changes: 35 additions & 9 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -282,18 +282,18 @@ Returns the agent's process transcript in `items`. Append those items to the nex
**Use the Anthropic Messages format:**

```python
client.messages("...", model="claude-sonnet-4-6", doc_id=doc_id)
client.messages("...", doc_id=doc_id)
```

Uses Anthropic's native Messages API and tool runner. Install it with `pip install 'pageindex[anthropic]'`.
Uses Anthropic's native Messages API and tool runner; assumes a Claude `chat_model`, otherwise pass `model=`. Install with `pip install 'pageindex[anthropic]'`.

Pass a list of ids to `doc_id` to search several documents at once, and keep it identical across a conversation's calls.

</details>

### (b) Integrate PageIndex with your own agent

PageIndex can also be integrated into your own agent. Each example below covers a different framework:
PageIndex can also be integrated into your own agent. Each item below covers a different integration path:

<details>
<summary><b>OpenAI Agents SDK</b></summary>
Expand All @@ -320,11 +320,13 @@ agent = Agent(
)
```

The Agents SDK resolves `model` itself, so a non-OpenAI name needs its `litellm/` prefix; `openai_agent_config()` adds that, plus prompt-cache settings for Claude models.

</details>
<br>

<details>
<summary><b>Anthropic SDK tool runner</b></summary>
<summary><b>Anthropic SDK (tool runner)</b></summary>
<br>

Install with `pip install 'pageindex[anthropic]'`:
Expand All @@ -333,14 +335,14 @@ Install with `pip install 'pageindex[anthropic]'`:
import anthropic

runner = anthropic.Anthropic().beta.messages.tool_runner(
**client.anthropic_runner_config(model="claude-sonnet-4-6", doc_id=doc_id),
**client.anthropic_runner_config(doc_id=doc_id),
messages=[{"role": "user", "content": "Summarize the auditor's concerns."}],
)
final = runner.until_done()
print(final.content[-1].text)
```

`anthropic_runner_config()` fills every `tool_runner` slot except `messages`. The explicit form:
`anthropic_runner_config()` fills every `tool_runner` slot except `messages`; assumes a Claude `chat_model`, otherwise pass `model=`. The explicit form:

```python
runner = anthropic.Anthropic().beta.messages.tool_runner(
Expand All @@ -357,10 +359,10 @@ runner = anthropic.Anthropic().beta.messages.tool_runner(
<br>

<details>
<summary><b>Claude Agent SDK</b></summary>
<summary><a id="claude-agent-sdk"></a><b>Claude Agent SDK</b></summary>
<br>

Install with `pip install 'pageindex[claude]'`. The Claude Agent SDK is async-native:
Install with `pip install 'pageindex[claude]'` and set `ANTHROPIC_API_KEY`. The Claude Agent SDK is async-native:

```python
from claude_agent_sdk import ClaudeAgentOptions, ResultMessage, query
Expand All @@ -371,10 +373,11 @@ async for message in query(prompt="Summarize the auditor's concerns.", options=o
print(message.result)
```

`claude_agent_config()` supplies the system prompt, the PageIndex MCP server, and its tool pre-approval. The explicit form:
`claude_agent_config()` supplies the system prompt, the PageIndex MCP server, and its tool pre-approval. The agent runs on Claude only: a Claude `chat_model` carries over, or pass `model=` directly. The explicit form:

```python
options = ClaudeAgentOptions(
model="claude-sonnet-4-6", # optional; the SDK's default otherwise
system_prompt=client.agent_instructions(doc_id=doc_id),
mcp_servers={"pageindex": client.as_claude_mcp(doc_id=doc_id)},
allowed_tools=["mcp__pageindex"],
Expand All @@ -397,6 +400,29 @@ tools = client.agent_tools(doc_id=doc_id) # plain functions returning JSON
Every helper above accepts `doc_id=` to point the agent at specific documents and `include_management=True` to also expose document deletion (off by default). Locally, `doc_id` is enforced at the tool layer, not just prompted: out-of-scope lookups return `NOT_FOUND`.

</details>
<br>

<details>
<summary><b>MCP server</b></summary>
<br>

[PageIndex Cloud](#pageindex-cloud) also runs an MCP server, so any agent or app that supports MCP can connect directly to it without the SDK:

```json
{
"mcpServers": {
"pageindex": {
"type": "http",
"url": "https://api.pageindex.ai/mcp",
"headers": { "Authorization": "Bearer your-pageindex-key" }
}
}
}
```

Full details in the [MCP documentation](https://docs.pageindex.ai/mcp). Local mode has no standalone MCP server yet: use `agent_tools()` above, or the in-process MCP server for the [Claude Agent SDK](#claude-agent-sdk).

</details>



Expand Down
Loading