> ## 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.

# 快速开始

本教程介绍如何配置模型并运行一个最小可用的智能体，最终在终端获得模型的回答。

> [!NOTE]
>
> 开始前请先完成[安装](https://docs.veadk.xyz/productions/veadk/archives/1.0.2/zh/get-started/installation.md)，并准备好火山方舟 API Key。本章仅覆盖首次运行的最小路径，部署到 AgentKit、记忆、知识库、多智能体、评测等主题请参见对应章节。

## 配置模型

配置调用模型所需的凭证，以下两种方式二选一。最简单的方式是设置环境变量，仅需提供 API Key。

> [tab] 环境变量
>
> 设置 API Key 后，VeADK 默认使用火山方舟上的豆包模型：
>
> ```bash lines theme={null}
> export MODEL_AGENT_API_KEY="填入火山方舟 API Key"
> ```
>
> 如需指定其它模型，可另外设置 `MODEL_AGENT_NAME`、`MODEL_AGENT_PROVIDER`、`MODEL_AGENT_API_BASE`。

> [tab] 配置文件
>
> 在项目根目录创建 `config.yaml`，VeADK 会自动读取：
>
> ```yaml config.yaml lines theme={null}
> model:
>   agent:
>     provider: openai
>     name: doubao-seed-1-8-251228
>     api_base: https://ark.cn-beijing.volces.com/api/v3/
>     api_key: # 填入火山方舟 API Key
> ```
>
> `provider: openai` 表示采用 OpenAI 兼容协议，`api_base` 指向火山方舟的兼容接口，因此可直接使用豆包等方舟模型。

## 编写第一个智能体

创建 `main.py`：

```python main.py lines theme={null}
from veadk import Agent
import asyncio

agent = Agent()

res = asyncio.run(agent.run("用一句话介绍火山引擎。"))
print(res)
```

`Agent` 持有模型与指令，不传参数时使用 `config.yaml` 中的默认模型；`agent.run(...)` 为异步方法，返回最终的文本回答。

## 运行

```bash lines theme={null}
python main.py
```

终端将打印模型返回的回答。至此，一个最小 VeADK 智能体已完成运行。


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