> For the complete documentation index, see [llms.txt](https://developers.oxylabs.io/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://developers.oxylabs.io/integrations/cn/ai-studio-integrations/hermes-agent.md).

# Hermes Agent

[**Hermes 代理**](https://github.com/NousResearch/hermes-agent) 是一个可插拔的代理框架，通过可替换的后端集成网页搜索和提取。该 `hermes-web-oxylabs` 插件注册了 [**Oxylabs AI Studio**](https://aistudio.oxylabs.io/) 作为可用后端之一，直接调用 AI Studio 的 REST API（无需厂商 SDK）为代理提供：

* 排序后的网页搜索结果 – 标题、URL、描述
* 将页面数据整理为 Markdown，供研究、比较和后续推理使用
* 提供最新网页上下文，以获得更准确的答案

## 要求

* [Hermes 代理](https://github.com/NousResearch/hermes-agent) 通过以下方式安装 `hermes` CLI
* Oxylabs AI Studio [API key](https://aistudio.oxylabs.io/api-key) （AI Studio 使用单个 API key，没有单独的用户名/密码）

## 设置

{% stepper %}
{% step %}

### 安装插件

将 Oxylabs 注册为 Hermes 可用于搜索和提取的网页提供方：

```bash
hermes plugins install oxylabs/hermes-web-oxylabs --enable
```

{% endstep %}

{% step %}

### 设置你的 API key

```bash
export OXYLABS_API_KEY="your-api-key-here"
```

或者将其添加到 Hermes `.env` 文件，而不是你的 shell 配置：

```bash
# ~/.hermes/.env
OXYLABS_API_KEY=your-api-key-here
```

{% endstep %}

{% step %}

### 选择实现方式

将 Oxylabs 设为 **搜索**, **提取**，或 **两者**.

#### **网页搜索**

```bash
hermes config set web.search_backend oxylabs
```

对于请求 10 条或更少结果的查询，插件会调用 AI Studio 的 `/search/instant` 端点，并直接返回结果。对于更大的结果集，它会提交到 `/search/run` 并轮询直到完成。

{% hint style="info" %}
**搜索** 仅返回列表项（标题、URL、描述），页面内容通过 [提取](#web-extraction).
{% endhint %}

#### **网页提取**

```bash
hermes config set web.extract_backend oxylabs
```

每个 URL 都提交到 AI Studio 的 `/scrape` 端点，并轮询直到完成（每个 URL 最多 60 秒）。&#x20;

一批 URL 并发处理，单个 URL 失败不会阻塞整批，并会返回一个 `错误` 字段而不是内容。

#### 搜索 + 提取（完整后端）

如果你希望 Oxylabs 同时处理 **搜索** 和 **提取**，请设置共享 `后端` 键，而不是上面的两个：

```yaml
web:
  backend: "oxylabs"
```

{% endstep %}

{% step %}

### 重启 Hermes

后端和 API key 的变更仅在会话开始时读取。启动新会话或重启当前会话：

```bash
hermes restart
```

{% endstep %}

{% step %}

### 验证

运行一个需要当前网页上下文的任务（例如请求读取某个特定 URL）。如果响应包含搜索结果或页面内容，则集成成功。

如果 `OXYLABS_API_KEY is not configured 返回错误，说明密钥未被加载。` 返回到 [步骤 2](#set-your-api-key)，然后再重启一次。

{% hint style="info" %}
一旦将 Oxylabs 选为 `后端`后端，缺失的密钥只会返回错误，而不会回退到其他提供商。
{% endhint %}
{% endstep %}
{% endstepper %}

### 覆盖端点（可选）

Hermes `web_extract` 工具支持通过以下方式覆盖 API 基础 URL：

```bash
export OXYLABS_API_URL="https://your-custom-endpoint"
```

用于测试或自托管部署。默认值： `https://api-aistudio.oxylabs.io`.

{% hint style="info" %}
更多高级功能与 Oxylabs AI Studio （`格式`, `render_javascript`, `geo_location`）这些目前不受 Hermes 调度器支持，未来可能提供。
{% endhint %}

## 更多资源

请参阅我们的 [GitHub 仓库](https://github.com/oxylabs/hermes-web-oxylabs) 以获取完整代码参考。


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter, and the optional `goal` query parameter:

```
GET https://developers.oxylabs.io/integrations/cn/ai-studio-integrations/hermes-agent.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
