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

# 火山引擎搜索

## 功能说明

对应工具标识 `vesearch`。

`vesearch` 通过火山引擎的[联网问答 Agent](https://www.volcengine.com/docs/85508/1512748) 进行搜索。该工具从环境变量读取自己的凭证，无需在 `Agent` 上传入 `api_key`。

导入路径：`from veadk.tools.builtin_tools.vesearch import vesearch`

## 环境变量与前提

<Warning>
  附加要求：

  1. 配置用于智能体推理模型的 API Key；
  2. 配置联网问答 Agent 的智能体 ID（在[控制台](https://console.volcengine.com/ask-echo/my-agent)创建智能体后获取），写入环境变量 `TOOL_VESEARCH_ENDPOINT`；
  3. 配置联网问答 Agent 的 API Key，写入环境变量 `TOOL_VESEARCH_API_KEY`。
</Warning>

环境变量：

* `MODEL_AGENT_API_KEY`：智能体推理模型的 API Key
* `TOOL_VESEARCH_ENDPOINT`：联网问答 Agent 的智能体 ID（**必须配置在环境变量中**）
* `TOOL_VESEARCH_API_KEY`：联网问答 Agent 的 API Key

## 使用方法

```python title="examples/tools/vesearch/agent.py" lines theme={null}
import asyncio

from veadk import Agent, Runner
from veadk.memory.short_term_memory import ShortTermMemory
from veadk.tools.builtin_tools.vesearch import vesearch

agent = Agent(
    name="vesearch_agent",
    model_name="doubao-seed-2-1-pro-260628",
    description="An agent that answers questions with veSearch.",
    instruction="You are a helpful assistant. Use the vesearch tool to look things up online.",
    tools=[vesearch],
)

runner = Runner(agent=agent, short_term_memory=ShortTermMemory())


async def main():
    response = await runner.run("杭州今天的天气怎么样？")
    print(response)


if __name__ == "__main__":
    asyncio.run(main())
```
