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

# Alexandria

> 面向超级智能的知识库

Alexandria 代理示例之旅

Alexandria 让代理通过 Firecrawl 访问结构化数据。发现工具、查看其输入参数，然后运行。发现工具免费；执行则会消耗工具上标注的额度。

[浏览提供商](https://www.firecrawl.dev/app/alexandria) · [管理提供商条款](https://www.firecrawl.dev/app/settings?tab=data-sources)

## 为代理而生

安装 [CLI](https://docs.firecrawl.dev/zh/sdks/cli.md) 或连接 [MCP server](https://docs.firecrawl.dev/zh/mcp-server.md)。

> [tab] Firecrawl CLI
>
> ```bash theme={null}
> # 在网页结果之外同时查找工具。
> firecrawl search "podcast conversations about AI agents" --sources web,alexandria --domain-tools --limit 2
>
> # 查看输入参数与定价。
> firecrawl find-tools --providers particle --level tools --expand options,response
>
> # 运行该工具。
> firecrawl scrape particle/podcasts/episodes/search --options '{"keyword_search":"AI agents","limit":2}'
> ```
>
> 使用 `npm install -g firecrawl-cli` 安装，并通过 `firecrawl login` 登录。

> [tab] MCP
>
> 向你的代理提问：“找到 Particle 的播客工具，查看剧集搜索的输入参数与定价，然后找出关于 AI 代理的对话。”
>
> 该代理会用 `firecrawl_search` 发现工具，用 `firecrawl_find_tools` 查看工具详情，再用 `firecrawl_scrape` 执行工具。

## 通过 SDKs 和 API 使用

**1. 找到合适的工具**

描述你的需求，Alexandria 会在返回网页结果的同时给出相关工具。

```javascript JavaScript theme={null}
const result = await firecrawl.search(
  "podcast conversations about AI agents",
  {
    sources: ["web", "alexandria"],
    limit: 2,
  },
);
```

```python Python theme={null}
result = firecrawl.search(
    "podcast conversations about AI agents",
    sources=["web", "alexandria"],
    limit=2,
)
```

```bash cURL theme={null}
curl https://api.firecrawl.dev/v2/search \
  -H "Authorization: Bearer $FIRECRAWL_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
  "query": "podcast conversations about AI agents",
  "sources": [
    "web",
    "alexandria"
  ],
  "limit": 2
}'
```

结果中包含 `web` 页面和已排序的 `tools`。每个工具都会给出其提供商、功能、输入参数、响应约定和执行价格。

**2. 确认工具的调用要求**

调用前，先查看所选工具的 `options`、`response` 和执行价格。更多细节参见 [Find Tools](#find-tools)。

**3. 获取数据**

使用 `scrape` 调用该工具，并按其约定传入相应输入参数。在 `alexandria` 下指定 provider 和 capability，无需提供页面 URL。

```javascript JavaScript theme={null}
const episodes = await firecrawl.scrape({
  alexandria: {
    provider: "particle",
    capability: "podcasts/episodes/search",
    options: {
      semantic_search: "AI agents",
      limit: 2,
    },
  },
});

console.log(episodes.alexandria[0].data);
```

```python Python theme={null}
episodes = firecrawl.scrape(
    alexandria={
        "provider": "particle",
        "capability": "podcasts/episodes/search",
        "options": {
            "semantic_search": "AI agents",
            "limit": 2,
        },
    },
)

print(episodes.alexandria[0].data)
```

```bash cURL theme={null}
REQUEST_ID="$(uuidgen)"

curl https://api.firecrawl.dev/v2/scrape \
  -H "Authorization: Bearer $FIRECRAWL_API_KEY" \
  -H "Content-Type: application/json" \
  -H "x-request-id: $REQUEST_ID" \
  -d '{
  "alexandria": {
    "provider": "particle",
    "capability": "podcasts/episodes/search",
    "options": {
      "semantic_search": "AI agents",
      "limit": 2
    }
  }
}'
```

从 `episodes.alexandria[0].data` 读取结果。使用数据前，请先检查每个工具结果是否报错。原始 HTTP 响应会将 SDK 结果包装在 `data` 中。

## Find Tools

使用 `findTools` / `find_tools` 即可免费浏览提供商并查看其工具。沿着某个条目的 `next` 请求可获取更多详情；顶层的 `next` 用于对目录分页。

```javascript JavaScript theme={null}
const catalogue = await firecrawl.findTools({
  providers: ["particle"],
  limit: 2,
});

// 每个 next 请求都会展现目录的另一部分。
const next = catalogue.items[0]?.next;
if (next) {
  const details = await firecrawl.scrape({ alexandria: next });
  console.log(details.alexandria[0].data);
}
```

```python Python theme={null}
catalogue = firecrawl.find_tools(providers=["particle"], limit=2)

if catalogue.items and catalogue.items[0].get("next"):
    details = firecrawl.scrape(alexandria=catalogue.items[0]["next"])
    print(details.alexandria[0].data)
```

## 在代理中使用

[代理](https://docs.firecrawl.dev/zh/features/agent.md)运行在执行研究任务时，可以自行调用你团队的提供商。只需在请求中传入 `exchange: { "enabled": true }`；如有需要，还可以通过 `toolkits` 指定最多五个提供商。如果未设置 `exchange`，通过 API 或 SDK 发起的运行将仅使用网页数据。请参见[使用已连接的 Alexandria 工具](https://docs.firecrawl.dev/zh/features/agent.md#use-your-connected-alexandria-tools)。

## 价格与访问

* **工具发现：** 免费。使用 `sources: ["alexandria"]` 仅获取工具，或使用 `["web", "alexandria"]` 同时包含付费的网页结果。
* **执行：** 按工具标价计费。
* **提供商条款：** `THIRD_PARTY_DATA_TERMS_REQUIRED` 错误中会包含 `requiresAction.url`。组织管理员需在该页面查看并接受条款。代理在接受条款前须获得用户的明确授权。[代理](https://docs.firecrawl.dev/zh/features/agent.md#data-providers-that-need-terms)运行时会跳过你的团队尚未接受条款的提供商，并在 `exchange.skippedProviders` 中列出这些提供商。

> [accordion] 为某个网站查找工具
>
> 在搜索或普通的 URL 抓取中添加 `domainTools: true`，即可包含与该网站匹配的工具。匹配免费；网页搜索或页面抓取照常计费。结果中会包含 `matchedBy` 和 `matchedUrls`。
>
> 当 `sources` 包含 `alexandria` 时，搜索默认启用域名匹配，可设置 `domainTools: false` 将其关闭。对于 URL 抓取，域名匹配默认关闭。

## 反馈

可通过 `firecrawl alexandria feedback` 报告 issue 或申请新功能，也可以使用 MCP 的 `firecrawl_feedback` 工具并指定 `endpoint: "alexandria"`。运行 `firecrawl alexandria feedback --help` 查看可用选项。

Alexandria 反馈必须在你的团队最近一次 Alexandria 搜索、发现或执行后的 20 分钟内提交。每次调用 Alexandria 都会重新计时；超时提交的反馈将被拒绝，并返回 `FEEDBACK_WINDOW_EXPIRED`。

每条反馈无论评分高低，均返还 1 个额度。返还额度按 UTC 自然日设有上限：每个网站 10 个额度，每个团队 100 个额度。超出任一上限后，反馈仍会被记录，但不再返还额度；该网站达到上限时，响应中会返回 `websiteCapReached: true`；团队达到上限时，则返回 `dailyCapReached: true`。

悬赏：5,000 额度奖励
，征集关于 Alexandria 的优质反馈

参与方式：与我们的 Firecrawl 反馈助手完成一次高质量访谈 (观点有深度、使用场景具体等) 。只需几分钟，可随时中止，人类和代理均可参与 (只需将链接粘贴到你的代理测试框架中即可！) 。还没用过 Alexandria？你的看法同样重要。

[开始访谈](https://www.firecrawl.dev/survey/uilpn?src=docs-alexandria)

请留下你的邮箱，以便获得奖励资格。我们会在每周末审核访谈质量。


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