Volcengine Agent Development KitVolcengine Agent Development Kit
VeADK
介绍
VeADK
介绍
  • 介绍
  • 安装
  • 快速开始
  • 智能体
  • 记忆
  • 工具
  • 知识库
  • 可观测
  • 评测
  • 部署上云
  • 命令行工具VeADK

快速开始

我们提供了一个供您完整体验 VeADK 核心功能的教程(基于 Jupyter Notebook),或者您也可以直接在 Google Colab 中打开。

安装 VeADK

您可参考安装文档进行安装。

配置项

您需要创建一个config.yaml配置文件放在项目根目录。为了运行一个最简 Agent,您只需要在文件中配置写入如下内容:

model:
  agent:
    provider: openai
    name: doubao-seed-1-6-250615
    api_base: https://ark.cn-beijing.volces.com/api/v3/
    api_key: # <-- 在此处填充模型访问的密钥(例如火山方舟的 API KEY)

完整的配置项,可参考这里。

构建 Agent

当你安装 VeADK 并完成配置后,您可以构建一个查询天气的智能体,该智能体配置了内置的模拟查询天气的函数工具get_city_weather:

from veadk import Agent
from veadk.tools.demo_tools import get_city_weather

agent = Agent(tools=[get_city_weather])

执行 Agent

由于某些操作是异步的,因此 Agent 的运行需要借助asyncio库在异步环境中进行。

Agent 的运行有两种方式,第一种是使用 Agent 自带的 run 方法运行:

import asyncio

prompt = "How is the weather like in Beijing? Besides, tell me which tool you invoked."
response = asyncio.run(agent.run(prompt))
print(response)

第二种是使用 Runner 执行:

from veadk import Runner
from veadk.memory.short_term_memory import ShortTermMemory
import asyncio

session_id = "..."
runner = Runner(agent=agent, short_term_memory=ShortTermMemory()) # 使用 Runner 执行智能体

prompt = "How is the weather like in Beijing? Besides, tell me which tool you invoked."
response = asyncio.run(runner.run(messages=prompt, session_id=session_id))
print(response) # The weather in Beijing is Sunny with a temperature of 25°C. The tool invoked is get_city_weather.

Warning

我们在Agent类中提供的run方法仅为了本地测试和开发使用,由于该函数位于一个异步与同步函数共存的运行环境,可能会产生不可预知的异常。

因此不建议在生产环境中使用。

Last Updated:: 8/19/25, 5:22 AM
Contributors: yaozheng-fang
Prev
安装
Next
智能体