English / 中文
Website · GitHub · Issues · Docs
👋 Join our Community
📱 Lark Group · WeChat · Discord · X
In the AI era, data is abundant, but high-quality context is hard to come by. When building AI Agents, developers often face these challenges:
OpenViking is an open-source Context Database designed specifically for AI Agents.
We aim to define a minimalist context interaction paradigm for Agents, allowing developers to completely say goodbye to the hassle of context management. OpenViking abandons the fragmented vector storage model of traditional RAG and innovatively adopts a "file system paradigm" to unify the structured organization of memories, resources, and skills needed by Agents.
With OpenViking, developers can build an Agent's brain just like managing local files:
Before starting with OpenViking, please ensure your environment meets the following requirements:
pip install openviking
curl -fsSL https://raw.githubusercontent.com/volcengine/OpenViking/main/crates/ov_cli/install.sh | bash
Or build from source:
cargo install --git https://github.com/volcengine/OpenViking ov_cli
OpenViking requires the following model capabilities:
OpenViking supports multiple VLM providers:
| Provider | Model | Get API Key |
|---|---|---|
volcengine | doubao | Volcengine Console |
openai | gpt | OpenAI Platform |
anthropic | claude | Anthropic Console |
deepseek | deepseek | DeepSeek Platform |
gemini | gemini | Google AI Studio |
moonshot | kimi | Moonshot Platform |
zhipu | glm | Zhipu Open Platform |
dashscope | qwen | DashScope Console |
minimax | minimax | MiniMax Platform |
openrouter | (any model) | OpenRouter |
vllm | (local model) | — |
💡 Tip: OpenViking uses a Provider Registry for unified model access. The system automatically detects the provider based on model name keywords, so you can switch between providers seamlessly.
Volcengine supports both model names and endpoint IDs. Using model names is recommended for simplicity:
{
"vlm": {
"provider": "volcengine",
"model": "doubao-seed-1-6-240615",
"api_key": "your-api-key",
"api_base" : "https://ark.cn-beijing.volces.com/api/v3",
}
}
You can also use endpoint IDs (found in Volcengine ARK Console):
{
"vlm": {
"provider": "volcengine",
"model": "ep-20241220174930-xxxxx",
"api_key": "your-api-key",
"api_base" : "https://ark.cn-beijing.volces.com/api/v3",
}
}
If you're on Zhipu's coding plan, use the coding API endpoint:
{
"vlm": {
"provider": "zhipu",
"model": "glm-4-plus",
"api_key": "your-api-key",
"api_base": "https://open.bigmodel.cn/api/coding/paas/v4"
}
}
For MiniMax's mainland China platform (minimaxi.com), specify the API base:
{
"vlm": {
"provider": "minimax",
"model": "abab6.5s-chat",
"api_key": "your-api-key",
"api_base": "https://api.minimaxi.com/v1"
}
}
Run OpenViking with your own local models using vLLM:
# Start vLLM server
vllm serve meta-llama/Llama-3.1-8B-Instruct --port 8000
{
"vlm": {
"provider": "vllm",
"model": "meta-llama/Llama-3.1-8B-Instruct",
"api_key": "dummy",
"api_base": "http://localhost:8000/v1"
}
}
Create a configuration file ~/.openviking/ov.conf:
{
"embedding": {
"dense": {
"api_base" : "<api-endpoint>", // API endpoint address
"api_key" : "<your-api-key>", // Model service API Key
"provider" : "<provider-type>", // Provider type: "volcengine" or "openai" (currently supported)
"dimension": 1024, // Vector dimension
"model" : "<model-name>" // Embedding model name (e.g., doubao-embedding-vision-250615 or text-embedding-3-large)
}
},
"vlm": {
"api_base" : "<api-endpoint>", // API endpoint address
"api_key" : "<your-api-key>", // Model service API Key
"provider" : "<provider-type>", // Provider type (volcengine, openai, deepseek, anthropic, etc.)
"model" : "<model-name>" // VLM model name (e.g., doubao-seed-1-8-251228 or gpt-4-vision-preview)
}
}
Note: For embedding models, currently only
volcengine(Doubao) andopenaiproviders are supported. For VLM models, we support multiple providers including volcengine, openai, deepseek, anthropic, gemini, moonshot, zhipu, dashscope, minimax, and more.
👇 Expand to see the configuration example for your model service:
{
"embedding": {
"dense": {
"api_base" : "https://ark.cn-beijing.volces.com/api/v3",
"api_key" : "your-volcengine-api-key",
"provider" : "volcengine",
"dimension": 1024,
"model" : "doubao-embedding-vision-250615"
}
},
"vlm": {
"api_base" : "https://ark.cn-beijing.volces.com/api/v3",
"api_key" : "your-volcengine-api-key",
"provider" : "volcengine",
"model" : "doubao-seed-1-8-251228"
}
}
{
"embedding": {
"dense": {
"api_base" : "https://api.openai.com/v1",
"api_key" : "your-openai-api-key",
"provider" : "openai",
"dimension": 3072,
"model" : "text-embedding-3-large"
}
},
"vlm": {
"api_base" : "https://api.openai.com/v1",
"api_key" : "your-openai-api-key",
"provider" : "openai",
"model" : "gpt-4-vision-preview"
}
}
After creating the configuration file, set the environment variable to point to it (Linux/macOS):
export OPENVIKING_CONFIG_FILE=~/.openviking/ov.conf
On Windows, use one of the following:
PowerShell:
$env:OPENVIKING_CONFIG_FILE = "$HOME/.openviking/ov.conf"
Command Prompt (cmd.exe):
set "OPENVIKING_CONFIG_FILE=%USERPROFILE%\.openviking\ov.conf"
💡 Tip: You can also place the configuration file in other locations, just specify the correct path in the environment variable.
📝 Prerequisite: Ensure you have completed the environment configuration in the previous step.
Now let's run a complete example to experience the core features of OpenViking.
Create example.py:
import openviking as ov
# Initialize OpenViking client with data directory
client = ov.SyncOpenViking(path="./data")
try:
# Initialize the client
client.initialize()
# Add resource (supports URL, file, or directory)
add_result = client.add_resource(
path="https://raw.githubusercontent.com/volcengine/OpenViking/refs/heads/main/README.md"
)
root_uri = add_result['root_uri']
# Explore the resource tree structure
ls_result = client.ls(root_uri)
print(f"Directory structure:\n{ls_result}\n")
# Use glob to find markdown files
glob_result = client.glob(pattern="**/*.md", uri=root_uri)
if glob_result['matches']:
content = client.read(glob_result['matches'][0])
print(f"Content preview: {content[:200]}...\n")
# Wait for semantic processing to complete
print("Wait for semantic processing...")
client.wait_processed()
# Get abstract and overview of the resource
abstract = client.abstract(root_uri)
overview = client.overview(root_uri)
print(f"Abstract:\n{abstract}\n\nOverview:\n{overview}\n")
# Perform semantic search
results = client.find("what is openviking", target_uri=root_uri)
print("Search results:")
for r in results.resources:
print(f" {r.uri} (score: {r.score:.4f})")
# Close the client
client.close()
except Exception as e:
print(f"Error: {e}")
python example.py
Directory structure: ... Content preview: ... Wait for semantic processing... Abstract: ... Overview: ... Search results: viking://resources/... (score: 0.8523) ...
Congratulations! You have successfully run OpenViking 🎉
For production environments, we recommend running OpenViking as a standalone HTTP service to provide persistent, high-performance context support for your AI Agents.
🚀 Deploy OpenViking on Cloud: To ensure optimal storage performance and data security, we recommend deploying on Volcengine Elastic Compute Service (ECS) using the veLinux operating system. We have prepared a detailed step-by-step guide to get you started quickly.
👉 View: Server Deployment & ECS Setup Guide
After running the first example, let's dive into the design philosophy of OpenViking. These five core concepts correspond one-to-one with the solutions mentioned earlier, together building a complete context management system:
We no longer view context as flat text slices but unify them into an abstract virtual filesystem. Whether it's memories, resources, or capabilities, they are mapped to virtual directories under the viking:// protocol, each with a unique URI.
This paradigm gives Agents unprecedented context manipulation capabilities, enabling them to locate, browse, and manipulate information precisely and deterministically through standard commands like ls and find, just like a developer. This transforms context management from vague semantic matching into intuitive, traceable "file operations". Learn more: Viking URI | Context Types
viking:// ├── resources/ # Resources: project docs, repos, web pages, etc. │ ├── my_project/ │ │ ├── docs/ │ │ │ ├── api/ │ │ │ └── tutorials/ │ │ └── src/ │ └── ... ├── user/ # User: personal preferences, habits, etc. │ └── memories/ │ ├── preferences/ │ │ ├── writing_style │ │ └── coding_habits │ └── ... └── agent/ # Agent: skills, instructions, task memories, etc. ├── skills/ │ ├── search_code │ ├── analyze_data │ └── ... ├── memories/ └── instructions/
Stuffing massive amounts of context into a prompt all at once is not only expensive but also prone to exceeding model windows and introducing noise. OpenViking automatically processes context into three levels upon writing:
Learn more: Context Layers
viking://resources/my_project/ ├── .abstract # L0 Layer: Abstract (~100 tokens) - Quick relevance check ├── .overview # L1 Layer: Overview (~2k tokens) - Understand structure and key points ├── docs/ │ ├── .abstract # Each directory has corresponding L0/L1 layers │ ├── .overview │ ├── api/ │ │ ├── .abstract │ │ ├── .overview │ │ ├── auth.md # L2 Layer: Full content - Load on demand │ │ └── endpoints.md │ └── ... └── src/ └── ...
Single vector retrieval struggles with complex query intents. OpenViking has designed an innovative Directory Recursive Retrieval Strategy that deeply integrates multiple retrieval methods:
This "lock high-score directory first, then refine content exploration" strategy not only finds the semantically best-matching fragments but also understands the full context where the information resides, thereby improving the globality and accuracy of retrieval. Learn more: Retrieval Mechanism
OpenViking's organization uses a hierarchical virtual filesystem structure. All context is integrated in a unified format, and each entry corresponds to a unique URI (like a viking:// path), breaking the traditional flat black-box management mode with a clear hierarchy that is easy to understand.
The retrieval process adopts a directory recursive strategy. The trajectory of directory browsing and file positioning for each retrieval is fully preserved, allowing users to clearly observe the root cause of problems and guide the optimization of retrieval logic. Learn more: Retrieval Mechanism
OpenViking has a built-in memory self-iteration loop. At the end of each session, developers can actively trigger the memory extraction mechanism. The system will asynchronously analyze task execution results and user feedback, and automatically update them to the User and Agent memory directories.
This allows the Agent to get "smarter with use" through interactions with the world, achieving self-evolution. Learn more: Session Management
The OpenViking project adopts a clear modular architecture design. The main directory structure is as follows:
OpenViking/ ├── openviking/ # Core source code directory │ ├── core/ # Core modules: client, engine, filesystem, etc. │ ├── models/ # Model integration: VLM and Embedding model encapsulation │ ├── parse/ # Resource parsing: file parsing, detection, OVPack handling │ ├── retrieve/ # Retrieval module: semantic retrieval, directory recursive retrieval │ ├── storage/ # Storage layer: vector DB, filesystem queue, observers │ ├── session/ # Session management: history, memory extraction │ ├── message/ # Message processing: formatting, conversion │ ├── prompts/ # Prompt templates: templates for various tasks │ ├── utils/ # Utilities: config, helpers │ └── bin/ # Command line tools ├── docs/ # Project documentation │ ├── zh/ # Chinese documentation │ ├── en/ # English documentation │ └── images/ # Documentation images ├── examples/ # Usage examples ├── tests/ # Test cases │ ├── client/ # Client tests │ ├── engine/ # Engine tests │ ├── integration/ # Integration tests │ ├── session/ # Session tests │ └── vectordb/ # Vector DB tests ├── src/ # C++ extensions (high-performance index and storage) │ ├── common/ # Common components │ ├── index/ # Index implementation │ └── store/ # Storage implementation ├── third_party/ # Third-party dependencies ├── pyproject.toml # Python project configuration ├── setup.py # Setup script ├── LICENSE # Open source license ├── CONTRIBUTING.md # Contributing guide ├── AGENT.md # Agent development guide └── README.md # Project readme
For more details, please visit our Full Documentation.
OpenViking is an open-source context database initiated and maintained by the ByteDance Volcengine Viking Team.
The Viking team focuses on unstructured information processing and intelligent retrieval, accumulating rich commercial practical experience in context engineering technology:
For more details, please see: About Us
OpenViking is still in its early stages, and there are many areas for improvement and exploration. We sincerely invite every developer passionate about AI Agent technology:
Let's work together to define and build the future of AI Agent context management. The journey has begun, looking forward to your participation!
This project is licensed under the Apache License 2.0 - see the LICENSE file for details.