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

# 构建 E.V.I.

> 通过自定义角色、技能和工具，将 Theo 嵌入你的产品。

E.V.I.（Embedded Virtual Intelligence，嵌入式虚拟智能）是嵌入在你产品中的 Theo。你的用户将与你自有品牌的 AI 交互，而背后由 Theo 的编排引擎驱动。

## 你将构建什么

```
Your Application (CRM, dashboard, app)
  └── Your UI (chat, sidebar, actions)
        └── @hitheo/sdk (evi instance)
              └── Theo API (api.hitheo.ai)
                    └── Classify → Skills → Route → Agent Loop → Response
```

## 第一级：仅自定义角色

```typescript theme={null}
const evi = theo.evi({
  persona: "You are Kai, a friendly coding assistant for DevHub.",
});

const res = await evi.complete({
  prompt: "Why is my useEffect running twice?",
});
```

## 第二级：角色 + 技能

```typescript theme={null}
const evi = theo.evi({
  persona: "You are Atlas, an operations assistant for AcmeCorp.",
  skills: ["inventory-check", "data-extraction"],
});
```

## 第三级：角色 + 技能 + 内联工具

```typescript theme={null}
const evi = theo.evi({
  persona: "You are Nova, the AI assistant for WarehouseOS.",
  skills: ["data-extraction"],
  tools: [
    {
      name: "check_inventory",
      description: "Look up stock levels for a SKU",
      input_schema: {
        type: "object",
        properties: { sku: { type: "string" } },
        required: ["sku"],
      },
    },
  ],
});
```

## 流式

```typescript theme={null}
const stream = evi.stream({ prompt: "Generate inventory report" });
for await (const event of stream) {
  if (event.type === "token") process.stdout.write(event.token!);
}
```

## 最佳实践

* **角色**：明确说明 E.V.I. 不应该做什么（例如"绝不提及 Theo"）
* **技能**：只安装你的使用场景真正需要的技能
* **工具**：保持描述清晰——模型会读取这些描述来判断何时调用
* **成本**：对简单查询使用 `mode: "fast"`


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