Self-evolving Context Database for AI Agents. Unify Agent Memory, Knowledge RAG and Skills.
Python agent-contextagent-memoryagent-pluginsagentic-ragcontext-databasedsh-pluginknowledge-basememorymemory-managementself-evolvingvector-database
feat(dot): Doc for agent setup (#1774)
DuTao48d0bcd8e15b
diff --git a/bot/vikingbot/openviking_mount/ov_server.py b/bot/vikingbot/openviking_mount/ov_server.pyindex c8f73bed8..5369f2fd7 100644--- a/bot/vikingbot/openviking_mount/ov_server.py+++ b/bot/vikingbot/openviking_mount/ov_server.py@@ -173,10 +173,10 @@ class VikingClient:result = await self.read_content(uri=uri, level="read")return result- async def search(self, query: str, target_uri: Optional[str] = "") -> Dict[str, Any]:+ async def search(self, query: str, target_uri: Optional[str] = "", limit: int = 10) -> Dict[str, Any]:# session = self.client.session()- result = await self.client.search(query, target_uri=target_uri)+ result = await self.client.search(query, target_uri=target_uri, limit=limit)# 将 FindResult 对象转换为 JSON mapreturn {diff --git a/docs/en/getting-started/04-setup-for-agent.md b/docs/en/getting-started/04-setup-for-agent.mdnew file mode 100644index 000000000..9026109e1--- /dev/null+++ b/docs/en/getting-started/04-setup-for-agent.md@@ -0,0 +1,426 @@+# OpenViking Setup SOP (For Agent)++## Goal++Help the user install, configure, validate, and start OpenViking with the smallest viable path.++## General Principles++- Default to the normal end-user installation path; do not default to source builds+- Default to prebuilt packages; do not assume Go / Rust / C++ / CMake are required+- If configuration is uncertain, ask the user first; do not guess provider, model, api_base, api_key, or workspace+- Only move to the source-build path when installation clearly falls back to local compilation, or when the user explicitly asks for a source install++## SOP++### 1. Choose the path++First determine which category the user belongs to.++#### A. Standard minimal install+Use this path if any of the following is true:+- The user just wants OpenViking installed and running+- The user just wants to try or integrate OpenViking+- The user is not asking for source-level development+- The user is not asking to modify low-level native components++Execution path:+1. Install the Python package+2. Ask for model configuration+3. Generate `~/.openviking/ov.conf`+4. Run `openviking-server doctor`+5. Start `openviking-server`++#### B. Local-model install (Ollama)+Use this path if any of the following is true:+- The user explicitly wants local models+- The user explicitly wants Ollama+- The user does not want to fill in many model settings manually++Execution path:+1. Run `openviking-server init`+2. Run `openviking-server doctor`+3. Start `openviking-server`++#### C. Docker install+Use this path if any of the following is true:+- The user explicitly wants to install or run with Docker+- The user does not want to install the Python package directly on the host+- The user wants configuration and data persisted via a mounted volume++Execution path:+1. Confirm whether the user already has an `ov.conf`+2. If not, confirm model configuration first or guide them to run `openviking-server init` inside the container+3. Start the container with the image or `docker-compose.yml`+4. Verify `/health`++#### D. Windows install+Use this path if any of the following is true:+- The user is on Windows+- The user asks for Windows installation steps++Execution path:+1. Prefer the prebuilt-wheel path from the standard minimal install flow+2. Configure `OPENVIKING_CONFIG_FILE` with Windows shell syntax+3. Run `openviking-server doctor`+4. Start `openviking-server`+5. Only enter the Windows local-build path if wheels are unavailable or installation fails++#### E. Source build+Only use this path if one of the following is true:+- The user explicitly asks for a source install+- Installation fails and the error clearly indicates local compilation is required+- The current platform has no prebuilt wheel+- The user explicitly wants to modify or rebuild low-level native components++Only then explain the required toolchain:+- Go 1.22++- Rust 1.91.1++- A C++ compiler+- CMake++### 2. Ask questions++If the user has not provided a complete model configuration, ask first. Do not write the config file yet.++#### Required questions++1. Which model provider do you want to use?+ - `openai`+ - `azure`+ - `volcengine`+ - `openai-codex`+ - `ollama`++2. Have you already decided on:+ - the embedding model name+ - the VLM model name+ - the API key / auth method++3. Which directory should `storage.workspace` use?++#### Follow-up questions by provider++##### openai+- embedding model name+- VLM model name+- whether to use `https://api.openai.com/v1`+- whether the API key is ready++##### azure+- embedding deployment name+- VLM deployment name+- Azure API Base+- Azure API Key+- whether to use the default `api_version = 2025-01-01-preview`++##### volcengine+- embedding model name+- VLM model name+- whether to use `https://ark.cn-beijing.volces.com/api/v3`+- whether the API key is ready++##### openai-codex+- whether the user wants to complete Codex OAuth via `openviking-server init`+- VLM model name+- which provider and model to use for embedding++##### ollama+- whether the user is okay with running `openviking-server init` directly+- whether Ollama is already installed+- which local embedding / VLM models they want to use++#### Extra required questions for Docker++If the user chooses Docker, also confirm:+- whether they want `docker run` or `docker compose`+- whether the host already has `~/.openviking/ov.conf`+- whether they want to mount host `~/.openviking` to container `/app/.openviking`+- whether they want to inject the full JSON config through `OPENVIKING_CONF_CONTENT`++#### Extra required questions for Windows++If the user is on Windows, also confirm:+- whether they use PowerShell or cmd.exe+- whether they only want a prebuilt-wheel install+- if a local build becomes necessary, whether CMake and MinGW are already installed++### 3. Generate the config++Only write `~/.openviking/ov.conf` after the user has confirmed all required values.++#### Minimal config shape++```json+{+ "storage": {+ "workspace": "..."+ },+ "embedding": {+ "dense": {+ "provider": "...",+ "api_base": "...",+ "api_key": "...",+ "model": "..."+ }+ },+ "vlm": {+ "provider": "...",+ "api_base": "...",+ "api_key": "...",+ "model": "..."+ }+}+```++#### Optional fields++Only add these when the provider requires them, when the README examples explicitly include them, or when the user explicitly asks for them:+- `dimension`+- `api_version`+- `max_concurrent`+- `temperature`+- `max_retries`++#### Do not do these things++- Do not fill in fake API keys+- Do not fill in unconfirmed paths+- Do not copy README comments into the JSON file+- Do not guess model names or private API endpoints++### 4. Run commands++#### Path A: Standard minimal install++```bash+pip install openviking --upgrade --force-reinstall+```++After the user confirms the configuration, write `~/.openviking/ov.conf`, then run:++```bash+openviking-server doctor+openviking-server+```++#### Path B: Local-model install (Ollama)++```bash+openviking-server init+openviking-server doctor+openviking-server+```++#### Path C: Docker install++##### Option 1: Run the published image directly++If the user already has a local config directory, prefer:++```bash+docker run --rm \+ -p 1933:1933 \+ -p 8020:8020 \+ -v ~/.openviking:/app/.openviking \+ ghcr.io/volcengine/openviking:latest+```++Notes:+- The default config path inside the container is `/app/.openviking/ov.conf`+- Inside the container, `HOME=/app`+- Prefer mounting host `~/.openviking` to container `/app/.openviking` so config, CLI config, and workspace data persist++##### Option 2: Use `docker-compose.yml`++If the user prefers compose, the repo already includes an example with:+- image: `ghcr.io/volcengine/openviking:latest`+- ports: `1933:1933`, `8020:8020`+- volume: `~/.openviking:/app/.openviking`++In that case, have the user run this from the repo root:++```bash+docker compose up -d+```++##### Option 3: Initialize config inside the container++If the user does not yet have `ov.conf`, there are two options:++1. Generate it on the host first and mount it into the container+2. Start the container, then run:++```bash+docker exec -it openviking openviking-server init+```++The Dockerfile also supports injecting the full JSON config via `OPENVIKING_CONF_CONTENT` on first start. Only use that if the user explicitly wants it and all config values have already been confirmed.++##### Docker validation++After startup, verify:++```bash+curl http://localhost:1933/health+```++#### Path D: Windows install++Prefer the prebuilt-wheel path first:++```bat+pip install openviking --upgrade --force-reinstall+```++After the config file is ready, set environment variables using the user’s shell.++##### PowerShell++```powershell+$env:OPENVIKING_CONFIG_FILE = "$HOME/.openviking/ov.conf"+```++##### cmd.exe++```bat+set "OPENVIKING_CONFIG_FILE=%USERPROFILE%\.openviking\ov.conf"+```++Then run:++```bat+openviking-server doctor+openviking-server+```++If the user also wants CLI config:++##### PowerShell++```powershell+$env:OPENVIKING_CLI_CONFIG_FILE = "$HOME/.openviking/ovcli.conf"+```++##### cmd.exe++```bat+set "OPENVIKING_CLI_CONFIG_FILE=%USERPROFILE%\.openviking\ovcli.conf"+```++#### Path E: Source build++Only after you have confirmed that the source-build path is necessary should you ask the user to prepare Go / Rust / C++ / CMake.++### 5. Triage++#### Case 1: Config file is missing, the path is wrong, or JSON cannot be parsed++Check first:+- whether `~/.openviking/ov.conf` exists+- whether an environment variable or `--config` points to the wrong path+- whether the config file is valid JSON++Handling rule:+- fix the config path or JSON syntax first+- then rerun `openviking-server doctor`++#### Case 2: Model configuration is incomplete++Typical signs:+- missing embedding or VLM config+- missing `provider` / `model` / `api_key`+- `openai-codex` is configured only for VLM, while embedding is still missing++Handling rule:+- fill in the minimal required config first+- do not guess model names or keys+- if the provider is `openai-codex`, remind the user that it mainly covers the VLM side and embedding still needs separate confirmation++#### Case 3: Model service is unreachable or auth is not usable++Check first:+- whether API Base is correct+- whether the API key / auth method is correct+- if using `openai-codex`, whether OAuth has been completed via `openviking-server init`+- if using Ollama, whether the service is actually running++Handling rule:+- fix provider config and auth state first+- for Ollama, prefer recommending:++```bash+openviking-server init+```++- then rerun:++```bash+openviking-server doctor+```++#### Case 4: Local dependency or packaged artifact is unavailable++Typical signs:+- the native engine module cannot be imported+- AGFS / RAGFS-related bindings are unavailable+- packaged artifacts are missing after installation++Handling rule:+- first try a standard reinstall:++```bash+pip install openviking --upgrade --force-reinstall+```++- if it still fails, then decide whether to move to the source-build path+- do not immediately require the full local build toolchain++#### Case 5: Installation falls into local compilation++Confirm first whether this is because:+- the current platform has no compatible wheel+- the user is already doing a source install+- prebuilt artifacts are unavailable++Handling rule:+- only after confirming the source-build path should you add Go / Rust / C++ / CMake+- on Windows, local compilation usually means CMake and MinGW become relevant first+- do not present source-build dependencies as the default install prerequisites++#### Case 6: Windows installation fails++Check in this order:+1. whether the current Python version / architecture matches a prebuilt wheel+2. whether installation actually fell into source compilation+3. whether environment variables were set correctly for PowerShell or cmd.exe+4. if local compilation is happening, whether CMake / MinGW are missing++Handling rule:+- fix wheel, path, and environment variable issues first+- only add build dependencies if local compilation is clearly required++#### Case 7: Docker starts but OpenViking is unusable++Check first:+- whether `~/.openviking` is correctly mounted to `/app/.openviking`+- whether `/app/.openviking/ov.conf` exists inside the container+- whether model configuration is complete+- whether `curl http://localhost:1933/health` succeeds+- whether the container still needs `openviking-server init`++Handling rule:+- fix volume mounts and config first+- then validate provider, model, and auth settings++#### Case 8: The user does not know which models to choose++Do not write the config yet.++Guidance rules:+- if the user already has an account with a specific cloud provider, prefer that provider first+- if the user wants local execution, prefer Ollama + `openviking-server init`+- if the user wants `openai-codex`, remind them that it mainly solves the VLM side and embedding still needs to be configured separately++## Additional reference+- [OpenViking GitHub repository](https://github.com/volcengine/OpenViking)diff --git a/docs/zh/getting-started/04-setup-for-agent.md b/docs/zh/getting-started/04-setup-for-agent.mdnew file mode 100644index 000000000..3a620d4a4--- /dev/null+++ b/docs/zh/getting-started/04-setup-for-agent.md@@ -0,0 +1,426 @@+# OpenViking 安装 SOP(For Agent)++## 目标++帮助用户以最小路径完成 OpenViking 安装、配置、自检和启动。++## 总原则++- 默认走普通用户安装路径,不默认走源码构建+- 默认使用预编译包,不默认要求 Go / Rust / C++ / CMake+- 配置不确定时必须先问用户,不要替用户猜 provider、model、api_base、api_key、workspace+- 只有在安装失败并明确指向本地编译,或用户主动要求源码安装时,才进入源码构建路径++## SOP++### 1. 判断路径++先判断用户属于哪一类:++#### A. 普通最小安装+满足任一情况即可进入:+- 用户只是想安装并跑起来+- 用户只是想体验或接入 OpenViking+- 用户没有要求源码开发+- 用户没有要求修改底层原生组件++执行路径:+1. 安装 Python 包+2. 询问模型配置+3. 生成 `~/.openviking/ov.conf`+4. 运行 `openviking-server doctor`+5. 启动 `openviking-server`++#### B. 本地模型安装(Ollama)+满足任一情况即可进入:+- 用户明确说要本地模型+- 用户明确说要 Ollama+- 用户不想手填大量模型参数++执行路径:+1. 运行 `openviking-server init`+2. 运行 `openviking-server doctor`+3. 启动 `openviking-server`++#### C. Docker 安装+满足任一情况即可进入:+- 用户明确说要用 Docker 安装或运行+- 用户不想在本机直接安装 Python 包+- 用户想把配置和数据通过 volume 挂载持久化++执行路径:+1. 确认用户是否已有现成 `ov.conf`+2. 如果没有,先确认模型配置或引导在容器内运行 `openviking-server init`+3. 使用镜像或 `docker-compose.yml` 启动容器+4. 验证 `/health`++#### D. Windows 安装+满足任一情况即可进入:+- 用户当前在 Windows 环境+- 用户要求 Windows 安装步骤++执行路径:+1. 优先按普通最小安装路径走预编译 wheel+2. 使用 Windows 的环境变量写法配置 `OPENVIKING_CONFIG_FILE`+3. 运行 `openviking-server doctor`+4. 启动 `openviking-server`+5. 只有在 wheel 不可用或安装失败时,才进入 Windows 本地编译路径++#### E. 源码构建+只有以下情况才进入:+- 用户明确要求源码安装+- 安装失败且错误信息明确要求本地编译+- 当前平台没有预编译 wheel+- 用户明确要修改或重编底层原生组件++进入后再说明需要:+- Go 1.22++- Rust 1.91.1++- C++ 编译器+- CMake++### 2. 提问++如果用户没有给出完整模型配置,先问,不要直接写配置文件。++#### 必问项++1. 你准备使用哪种模型提供商?+ - `openai`+ - `azure`+ - `volcengine`+ - `openai-codex`+ - `ollama`++2. 你是否已经确定:+ - embedding 模型名+ - VLM 模型名+ - API Key / 鉴权方式++3. `storage.workspace` 想放在哪个目录?++#### 按 provider 继续追问++##### openai+- embedding 模型名+- VLM 模型名+- 是否使用 `https://api.openai.com/v1`+- API Key 是否已准备好++##### azure+- embedding deployment name+- VLM deployment name+- Azure API Base+- Azure API Key+- 是否使用默认 `api_version = 2025-01-01-preview`++##### volcengine+- embedding 模型名+- VLM 模型名+- 是否使用 `https://ark.cn-beijing.volces.com/api/v3`+- API Key 是否已准备好++##### openai-codex+- 是否希望通过 `openviking-server init` 完成 Codex OAuth+- VLM 模型名+- embedding 使用哪个 provider 和模型++##### ollama+- 是否接受直接运行 `openviking-server init`+- 是否已经安装 Ollama+- 希望使用哪些本地 embedding / VLM 模型++#### Docker 额外必问项++如果用户选择 Docker,还要继续确认:+- 用户是想用 `docker run` 还是 `docker compose`+- 本机是否已有 `~/.openviking/ov.conf`+- 是否要把宿主机 `~/.openviking` 挂载到容器 `/app/.openviking`+- 是否要直接通过环境变量 `OPENVIKING_CONF_CONTENT` 注入完整 JSON 配置++#### Windows 额外必问项++如果用户在 Windows,还要继续确认:+- 用户使用的是 PowerShell 还是 cmd.exe+- 用户是否只接受预编译 wheel 安装+- 如果需要本地编译,是否已安装 CMake 和 MinGW++### 3. 生成配置++只有在用户确认完必要信息后,才能写 `~/.openviking/ov.conf`。++#### 最小配置结构++```json+{+ "storage": {+ "workspace": "..."+ },+ "embedding": {+ "dense": {+ "provider": "...",+ "api_base": "...",+ "api_key": "...",+ "model": "..."+ }+ },+ "vlm": {+ "provider": "...",+ "api_base": "...",+ "api_key": "...",+ "model": "..."+ }+}+```++#### 可选字段++只有在 provider 需要、README 示例明确包含、或用户明确要求时,才加入:+- `dimension`+- `api_version`+- `max_concurrent`+- `temperature`+- `max_retries`++#### 不要做的事++- 不要填假密钥+- 不要填用户未确认的路径+- 不要把 README 注释复制进 JSON+- 不要替用户猜模型名或私有 API 地址++### 4. 执行命令++#### 路径 A:普通最小安装++```bash+pip install openviking --upgrade --force-reinstall+```++用户确认配置后写入 `~/.openviking/ov.conf`,然后执行:++```bash+openviking-server doctor+openviking-server+```++#### 路径 B:本地模型安装(Ollama)++```bash+openviking-server init+openviking-server doctor+openviking-server+```++#### 路径 C:Docker 安装++##### 方案 1:使用现成镜像直接运行++如果用户已有本机配置目录,优先建议:++```bash+docker run --rm \+ -p 1933:1933 \+ -p 8020:8020 \+ -v ~/.openviking:/app/.openviking \+ ghcr.io/volcengine/openviking:latest+```++说明:+- 容器内默认配置路径是 `/app/.openviking/ov.conf`+- 容器内 `HOME=/app`+- 建议把宿主机 `~/.openviking` 挂载到容器 `/app/.openviking` 持久化配置、CLI 配置和 workspace 数据++##### 方案 2:使用 `docker-compose.yml`++如果用户希望使用 compose,仓库里已有示例:+- 镜像:`ghcr.io/volcengine/openviking:latest`+- 端口:`1933:1933`、`8020:8020`+- volume:`~/.openviking:/app/.openviking`++此时直接让用户基于仓库根目录执行:++```bash+docker compose up -d+```++##### 方案 3:容器内初始化配置++如果用户还没有 `ov.conf`,可以二选一:++1. 先在宿主机生成并挂载进容器+2. 启动容器后进入容器内执行:++```bash+docker exec -it openviking openviking-server init+```++Dockerfile 还支持在首次启动时通过 `OPENVIKING_CONF_CONTENT` 注入完整 JSON;如果用户明确想这样做,可以采用,但前提仍是配置值已确认。++##### Docker 验证++启动后验证:++```bash+curl http://localhost:1933/health+```++#### 路径 D:Windows 安装++优先按预编译 wheel 路径执行:++```bat+pip install openviking --upgrade --force-reinstall+```++配置文件写好后,按用户 shell 设置环境变量。++##### PowerShell++```powershell+$env:OPENVIKING_CONFIG_FILE = "$HOME/.openviking/ov.conf"+```++##### cmd.exe++```bat+set "OPENVIKING_CONFIG_FILE=%USERPROFILE%\.openviking\ov.conf"+```++然后执行:++```bat+openviking-server doctor+openviking-server+```++如果用户还要配置 CLI 文件:++##### PowerShell++```powershell+$env:OPENVIKING_CLI_CONFIG_FILE = "$HOME/.openviking/ovcli.conf"+```++##### cmd.exe++```bat+set "OPENVIKING_CLI_CONFIG_FILE=%USERPROFILE%\.openviking\ovcli.conf"+```++#### 路径 E:源码构建++只有进入源码构建路径后,才向用户说明并准备 Go / Rust / C++ / CMake。++### 5. 失败分流++#### 情况 1:配置文件缺失、路径错误或 JSON 无法解析++优先检查:+- `~/.openviking/ov.conf` 是否存在+- 是否通过环境变量或 `--config` 指向了错误路径+- 配置文件是否是合法 JSON++处理原则:+- 先修正配置文件路径或 JSON 语法+- 再重新运行 `openviking-server doctor`++#### 情况 2:模型配置不完整++典型表现:+- 缺少 embedding 或 VLM 配置+- 缺少 `provider` / `model` / `api_key`+- `openai-codex` 只配了 VLM,但 embedding 没配++处理原则:+- 先补齐最小配置+- 不要替用户猜模型名或密钥+- 如果是 `openai-codex`,提醒用户它主要解决 VLM,embedding 仍需单独确认++#### 情况 3:模型服务不可连通或鉴权不可用++优先检查:+- API Base 是否正确+- API Key / 鉴权方式是否正确+- 如果是 `openai-codex`,是否已经通过 `openviking-server init` 完成 OAuth+- 如果是 Ollama,服务是否已启动++处理原则:+- 先修正 provider 配置和鉴权状态+- 对 Ollama 优先建议:++```bash+openviking-server init+```++- 然后重新运行:++```bash+openviking-server doctor+```++#### 情况 4:本地依赖或打包产物不可用++典型表现:+- 原生引擎模块无法导入+- AGFS / RAGFS 相关绑定不可用+- 安装后缺少打包产物++处理原则:+- 先执行一次标准重装:++```bash+pip install openviking --upgrade --force-reinstall+```++- 如果仍失败,再判断是否需要进入源码构建路径+- 不要一开始就默认要求用户安装整套本地构建工具链++#### 情况 5:安装过程进入源码编译++优先确认是否属于:+- 当前平台没有对应 wheel+- 用户本来就在走源码安装+- 预编译产物缺失++处理原则:+- 只有确认进入源码构建路径后,才补充 Go / Rust / C++ / CMake+- Windows 本地编译优先补 CMake 和 MinGW+- 不要把源码构建依赖当作普通安装默认前置++#### 情况 6:Windows 安装失败++优先按这个顺序判断:+1. 当前 Python / 架构是否命中了预编译 wheel+2. 是否实际进入了源码编译路径+3. 环境变量是否按 PowerShell 或 cmd.exe 正确设置+4. 如果进入本地编译,是否缺少 CMake / MinGW++处理原则:+- 优先修正 wheel、路径和环境变量问题+- 只有明确进入本地编译路径时,才补装构建依赖++#### 情况 7:Docker 启动后不可用++优先检查:+- `~/.openviking` 是否正确挂载到 `/app/.openviking`+- 容器内是否存在 `/app/.openviking/ov.conf`+- 模型配置是否完整+- `curl http://localhost:1933/health` 是否返回正常+- 是否需要进入容器执行 `openviking-server init`++处理原则:+- 先修正 volume 挂载和配置文件+- 再检查 provider、模型和鉴权配置++#### 情况 8:用户不知道怎么选模型++先不要写配置。++引导规则:+- 用户已有某家云服务账号,就优先沿用该 provider+- 用户想本地运行,就优先建议 Ollama + `openviking-server init`+- 用户想用 `openai-codex`,提醒它主要解决 VLM,embedding 仍需单独确认++## 其他详细参考+- [OpenViking 官方GitHub 仓库](https://github.com/volcengine/OpenViking)