OpenViking 是火山引擎开源的 Agent 上下文数据库,28k 星数的热门项目。它将 Agent 运行中的记忆、知识和技能统一存储管理,解决了 Agent 长期运行中上下文丢失和知识碎片化的问题。与 Codebase Memory MCP 专注于代码记忆不同,OpenViking 提供了更通用的上下文管理框架。
| 模块 | 功能说明 | 存储类型 |
|---|---|---|
| 记忆存储 | 短期工作记忆 + 长期语义记忆 | 向量 + 图谱 |
| 知识管理 | 结构化和非结构化知识统一存储 | 文档 + 向量 |
| 技能注册 | Agent 技能的注册、发现和调度 | 元数据 |
| 上下文检索 | 多模态检索:语义 + 关键词 + 图谱 | 混合索引 |
| 时间衰减 | 自动管理记忆的时效性和重要性 | 时间戳权重 |
| 多 Agent 共享 | 支持多个 Agent 共享同一上下文库 | 命名空间隔离 |
# pip 安装
pip install openviking
# Docker 部署(推荐生产环境)
docker run --name openviking \
-p 9080:9080 \
-e VIKING_STORAGE_BACKEND=rocksdb \
-e VIKING_VECTOR_DIMENSION=1536 \
-d openviking/server:latest
# Docker Compose 完整部署
git clone https://github.com/volcengine/openviking.git
cd openviking
docker-compose up -d
# 验证服务
curl http://localhost:9080/health
from openviking import ContextDB
# 初始化上下文数据库
db = ContextDB(
endpoint="http://localhost:9080",
namespace="my-agent"
)
# 存储记忆
db.memory.store(
content="用户偏好使用 Python 3.12 和 FastAPI",
memory_type="long_term",
importance=0.8,
tags=["preference", "tech_stack"]
)
# 存储知识
db.knowledge.store(
title="FastAPI 依赖注入",
content="FastAPI 使用 Depends() 实现依赖注入...",
source="official-docs",
metadata={"version": "0.100+"}
)
# 注册技能
db.skill.register(
name="code_review",
description="执行代码审查",
handler="skills.code_review.run",
inputs={"code": "string", "language": "string"},
outputs={"report": "string"}
)
# 检索上下文
context = db.retrieve(
query="用户喜欢什么技术栈?",
top_k=5,
memory_weight=0.6,
knowledge_weight=0.4
)
for item in context:
print(f"[{item.type}] {item.content} (score: {item.score:.2f})")
# 多 Agent 共享
db.share_namespace("team-agent", agents=["agent-1", "agent-2"])
| 方案 | 记忆管理 | 知识图谱 | 技能注册 | 多Agent | 性能 |
|---|---|---|---|---|---|
| OpenViking | ✅ 完整 | ✅ 内置 | ✅ | ✅ | 高(Rust核心) |
| Mem0 | ✅ | ⚠️ 有限 | ❌ | ⚠️ | 中 |
| ChromaDB | ⚠️ 仅向量 | ❌ | ❌ | ❌ | 高 |
| Zep | ✅ | ⚠️ | ❌ | ✅ | 中 |
OpenViking 作为火山引擎开源的 Agent 上下文数据库,28k 星数印证了其在 Agent 基础设施领域的重要地位。其统一记忆、知识和技能管理的设计理念,为构建长期运行的 Agent 系统提供了坚实的数据层基础。AGPL-3.0 协议需要注意,对于需要闭源商业使用的场景需购买商业授权。如果你的 Agent 项目面临上下文管理混乱的问题,OpenViking 值得作为底层基础设施来考虑。
OpenViking 是火山引擎开源的 Agent 上下文数据库,28k 星数的热门项目。它将 Agent 运行中的记忆、知识和技能统一存储管理,解决了 Agent 长期运行中上下文丢失和知识碎片化的问题。与 Codebase Memory MCP 专注于代码记忆不同,OpenViking 提供了更通用的上下文管理框架
Semantica 知识管理指南