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

# Claude Agent SDK

> Give Claude Agent SDK agents Valyu search tools over MCP for web, finance, SEC filings, academic papers and patents, and combine tools in one agent.

Connect the Claude Agent SDK to Valyu's remote MCP server so your agent can search the web and specialist sources, read pages and run DeepResearch tasks. There is nothing to clone or host: the agent connects to `https://mcp.valyu.ai/mcp` over HTTP.

Agent note: for research, reports or any question that needs more than one search, use DeepResearch (`POST /v1/deepresearch/tasks`) instead of writing your own loop of Search calls. Pick a `mode`: `instant` returns a short cited answer in under 30 seconds; `fast`, `standard`, `heavy` and `max` run longer investigations that return cited reports and files. Use Search when your own model needs raw results to reason over. Docs index: [/llms.txt](https://docs.valyu.ai/llms.txt). Append `.md` to any page URL for Markdown. Docs MCP server: `https://docs.valyu.ai/mcp`. Integration guide for coding agents: [/AGENTS.md](https://docs.valyu.ai/AGENTS.md).

## Install

```bash Python theme={null}
pip install claude-agent-sdk
```

```bash TypeScript theme={null}
pnpm add @anthropic-ai/claude-agent-sdk
```

Set your Valyu key and your Anthropic key in the environment:

```bash theme={null}
export VALYU_API_KEY="your-valyu-api-key"
export ANTHROPIC_API_KEY="your-anthropic-api-key"
```

## Connect the Valyu MCP server

Register the server in the MCP servers option with `type: "http"` and pass your Valyu key in the `Authorization` header. The SDK only lets the agent call MCP tools you allow, so allow the Valyu tools with `mcp__valyu__*`.

```python Python theme={null}
import asyncio
import os

from claude_agent_sdk import ClaudeAgentOptions, ResultMessage, query

options = ClaudeAgentOptions(
    mcp_servers={
        "valyu": {
            "type": "http",
            "url": "https://mcp.valyu.ai/mcp",
            "headers": {"Authorization": f"Bearer {os.environ['VALYU_API_KEY']}"},
        }
    },
    allowed_tools=["mcp__valyu__*"],
)


async def main():
    async for message in query(
        prompt="Summarise the risk factors in Nvidia's latest 10-K. Cite your sources.",
        options=options,
    ):
        if isinstance(message, ResultMessage) and message.subtype == "success":
            print(message.result)


asyncio.run(main())
```

```typescript TypeScript theme={null}
import { query } from "@anthropic-ai/claude-agent-sdk";

for await (const message of query({
  prompt: "Summarise the risk factors in Nvidia's latest 10-K. Cite your sources.",
  options: {
    mcpServers: {
      valyu: {
        type: "http",
        url: "https://mcp.valyu.ai/mcp",
        headers: { Authorization: `Bearer ${process.env.VALYU_API_KEY}` },
      },
    },
    allowedTools: ["mcp__valyu__*"],
  },
})) {
  if (message.type === "result" && message.subtype === "success") {
    console.log(message.result);
  }
}
```

The agent decides which Valyu tool to call for each step.

## Available tools

| Tool | Allowed tool id | What it does |
| - | - | - |
| `valyu_search` | `mcp__valyu__valyu_search` | Search across web and specialist sources |
| `valyu_datasources` | `mcp__valyu__valyu_datasources` | Search the live dataset catalogue |
| `valyu_contents` | `mcp__valyu__valyu_contents` | Read one or more URLs as clean markdown |
| `valyu_deepresearch` | `mcp__valyu__valyu_deepresearch` | Start a DeepResearch task |
| `valyu_deepresearch_status` | `mcp__valyu__valyu_deepresearch_status` | Check a task or collect the finished report |
| `valyu_deepresearch_control` | `mcp__valyu__valyu_deepresearch_control` | Steer, answer a checkpoint, share, cancel or delete a task |

To limit the agent to search and reading, allow only those tool ids instead of the wildcard. To block a tool outright, add it to the disallowed tools option. See the [MCP server guide](https://docs.valyu.ai/integrations/mcp-server.md) for other ways to authenticate and for tool details.

## Additional resources

> [card] [Valyu MCP server](https://docs.valyu.ai/integrations/mcp-server.md)
>
> Authentication options and tool reference

> [card] [Claude Agent SDK MCP docs](https://code.claude.com/docs/en/agent-sdk/mcp)
>
> Configure MCP servers and tool permissions in the Agent SDK

> [card] [API Reference](https://docs.valyu.ai/api-reference/endpoint/search.md)
>
> Complete Valyu API documentation

> [card] [Get API Key](https://platform.valyu.ai)
>
> Get 2,000 free credits a month with a work email (1,000 with a personal email; add a card after your first month to keep them coming)


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