seekdb — AI-Agent Database CLI with Documentation
This skill lets AI Agents operate seekdb via seekdb-cli commands and look up seekdb documentation when needed.
Quick orientation: Start with seekdb ai-guide to get a full JSON self-description of the CLI. Then run commands directly — no setup needed.
Part 1: seekdb-cli Operations
INLINECODE2 is purpose-built for AI Agents. All output is structured JSON, all operations are stateless, and built-in safety guardrails prevent accidental data loss.
seekdb Deployment
seekdb supports two modes. Use this section to guide users to the right deployment path based on their OS and scenario.
Embedded Mode
seekdb runs as a library inside the application — no server process required. Install via pyseekdb:
CODEBLOCK0
Supported platforms: Linux (glibc ≥ 2.28), macOS 15+ · Architectures: x86_64, aarch64
Windows and older macOS versions do not support embedded mode. Use server mode instead.
Server Mode
A persistent seekdb process, connectable via MySQL client or seekdb-cli (remote DSN). Choose by OS:
| OS | Recommended method | Quick start |
|---|
| Linux (CentOS/RHEL/Anolis/openEuler) | Package manager (RPM) | INLINECODE4 |
| Linux (Debian/Ubuntu) |
Package manager (DEB) |
sudo apt update && sudo apt install seekdb |
| macOS 15+ | Homebrew |
brew tap oceanbase/seekdb && brew install seekdb |
| Any OS with Docker | Docker |
docker run -d -p 2881:2881 oceanbase/seekdb |
| Windows / macOS (GUI) | OceanBase Desktop | Download from
oceanbase.ai/download |
Connect after server mode deployment (default port 2881, user root, empty password):
CODEBLOCK1
Minimum requirements: 1 CPU core, 2 GB RAM, SSD storage.
For full deployment details, see the deployment docs.
Prerequisites
Check if seekdb-cli is installed:
CODEBLOCK2
If not installed, choose the method that matches your environment:
Recommended — pipx (works globally without polluting system Python):
CODEBLOCK3
Alternative — pip (when inside a project venv or on systems without PEP 668):
CODEBLOCK4
Note for Ubuntu 23.04+ / Debian 12+: Direct pip install at the system level is blocked by PEP 668.
Use pipx instead — it creates an isolated environment while keeping the seekdb command globally available on your PATH.
Connection
seekdb-cli auto-discovers the connection (env var, .env, ~/.seekdb/config.env, or default ~/.seekdb/seekdb.db). No setup needed — just run commands directly.
If the user provides a specific DSN, pass it via --dsn (must appear before the subcommand):
CODEBLOCK5
DSN formats:
- - Remote: INLINECODE16
- Embedded:
embedded:<path>[?database=<db>] (default database: test)
Get a Full CLI Guide (run first)
CODEBLOCK6
Returns a structured JSON document with every command, parameter, workflow, safety rules, and output format. Run this once at the start of any seekdb task to orient yourself.
Recommended Workflows
SQL Database Exploration
CODEBLOCK7
Vector Collection Workflow
CODEBLOCK8
AI Model Setup Workflow
CODEBLOCK9
Command Reference
seekdb sql
Execute SQL statements. Default is read-only mode.
CODEBLOCK10
Output format:
CODEBLOCK11
seekdb schema tables
CODEBLOCK12
CODEBLOCK13
seekdb schema describe
CODEBLOCK14
CODEBLOCK15
seekdb schema dump
CODEBLOCK16
Returns all CREATE TABLE DDL statements.
seekdb table profile
Generate statistical summary of a table without returning raw data. Helps understand data distribution before writing SQL.
CODEBLOCK17
CODEBLOCK18
seekdb relations infer
Infer JOIN relationships between tables by analyzing column name patterns (e.g., user_id → users.id) and type compatibility.
CODEBLOCK19
CODEBLOCK20
seekdb collection list
CODEBLOCK21
CODEBLOCK22
seekdb collection create
CODEBLOCK23
Options: --dimension / -d (default: 384), --distance cosine | l2 | ip (default: cosine).
seekdb collection delete
CODEBLOCK24
seekdb collection info
CODEBLOCK25
CODEBLOCK26
INLINECODE25 and distance are included when available from the collection metadata.
seekdb query
Search a collection using hybrid (default), semantic (vector), or fulltext mode.
CODEBLOCK27
CODEBLOCK28
seekdb get
Retrieve documents from a collection by IDs or metadata filter.
CODEBLOCK29
seekdb add
Add data to a collection. Exactly one source is required: --file, --stdin, or --data. The collection is auto-created if it does not exist.
CODEBLOCK30
Record format: Each record may have id (optional), document/text/content (text to vectorize), and any other fields become metadata. If embedding is present, it is used directly.
seekdb export
Export collection data to a file.
CODEBLOCK31
Options: --output (required), --limit / -n (default: 10000).
seekdb ai model list
List AI models registered in the database (from DBA_OB_AI_MODELS / DBMSAISERVICE). Works in both remote and embedded mode.
CODEBLOCK32
CODEBLOCK33
seekdb ai model create
Register an AI model via DBMS_AI_SERVICE.CREATE_AI_MODEL. Create an endpoint separately to use it for completion.
CODEBLOCK34
Types: completion, dense_embedding, rerank.
seekdb ai model delete
Drop an AI model. Drop any endpoints that use it first.
CODEBLOCK35
seekdb ai model endpoint create / delete
Create or drop an endpoint that binds an AI model to a URL and API key (so the database can call the model).
CODEBLOCK36
Supported --provider values:
| Provider | Vendor |
|---|
| INLINECODE44 | SiliconFlow (OpenAI-compatible) |
| INLINECODE45 |
OpenAI |
|
deepseek | DeepSeek (OpenAI-compatible) |
|
aliyun-openAI | Alibaba Cloud (OpenAI-compatible) |
|
aliyun-dashscope | Alibaba Cloud DashScope |
|
hunyuan-openAI | Tencent Hunyuan (OpenAI-compatible) |
Common --url values (use the specific interface URL, not the base URL):
| Vendor | completion | embedding | rerank |
|---|
| SiliconFlow | INLINECODE51 | INLINECODE52 | INLINECODE53 |
| DeepSeek |
https://api.deepseek.com/chat/completions | — | — |
| Alibaba (OpenAI) |
https://dashscope.aliyuncs.com/compatible-mode/v1/chat/completions |
https://dashscope.aliyuncs.com/compatible-mode/v1/embeddings | — |
| Tencent Hunyuan |
https://api.hunyuan.cloud.tencent.com/v1/chat/completions |
https://api.hunyuan.cloud.tencent.com/v1/embeddings | — |
seekdb ai complete
Run text completion using the database AI_COMPLETE function. Requires a registered completion model and an endpoint. Supported in both remote and embedded mode.
CODEBLOCK37
CODEBLOCK38
seekdb ai-guide
Output a structured JSON guide for AI Agents containing all commands, parameters, workflow, and safety rules. Execute once to learn the full CLI.
CODEBLOCK39
seekdb status
CODEBLOCK40
Returns CLI version, server version, database name, and connectivity.
Safety Features
Row Protection
Queries without LIMIT are automatically probed. If result exceeds 100 rows, execution is blocked:
CODEBLOCK41
Action: Add an explicit LIMIT clause and retry.
Write Protection
Write operations (INSERT/UPDATE/DELETE) are blocked by default:
CODEBLOCK42
Action: Add --write flag to enable write operations.
Even with --write, these are always blocked:
- -
DELETE / UPDATE without WHERE clause - INLINECODE67 /
TRUNCATE statements
Error Auto-Correction
On SQL errors, the CLI automatically attaches schema hints:
Column not found → returns the table's column list and indexes:
CODEBLOCK43
Table not found → returns available table names:
CODEBLOCK44
Action: Use the schema info to correct the SQL and retry.
Large Field Truncation
TEXT/BLOB fields are truncated to 200 characters by default, with original length noted:
CODEBLOCK45
Use --no-truncate to get full content when needed.
Sensitive Field Masking
Columns matching sensitive patterns are automatically masked:
| Pattern | Example Output |
|---|
| phone/mobile/tel | INLINECODE70 |
| email |
z***@gmail.com |
| password/secret/token |
****** |
| id_card/ssn |
110***********1234 |
Output Formats
Default is JSON. Switch with --format / -f:
CODEBLOCK46
All formats now work with non-row data (e.g., schema tables, collection list). CSV and JSONL will auto-detect list-of-dict data in the data field.
Exit Codes
Business error (SQL error, connection error, etc.) |
| 2 | Usage error (missing arguments, invalid options) |
Operation Logging
All commands are logged to ~/.seekdb/sql-history.jsonl (seekdb-cli SQL execution history) for audit:
CODEBLOCK47
Part 2: Documentation Lookup
Use documentation lookup when you need to understand a seekdb concept, look up SQL syntax, find configuration details, or answer user questions about seekdb.
Tip: For live database state (tables, schemas, data), run CLI commands directly. For concepts, syntax, and how-to guidance, search the docs.
When to Use Documentation Lookup
- - Need to understand a seekdb concept (vector search, hybrid search, HNSW index, etc.)
- Need SQL or PL syntax reference not answerable by
seekdb schema commands - Need deployment, configuration, or integration guidance
- CLI returned an error and you need to understand why from the docs
Path Resolution
- 1. Read this SKILL.md to get its absolute path and extract the parent directory as INLINECODE81
- Catalog: INLINECODE82
If missing locally, load from: INLINECODE83
Documentation Workflow
Step 1: Search Catalog
Search the catalog file for lines containing the query keywords. Each line is one JSON object with path, description, and branch.
CODEBLOCK48
Step 2: Match Query
- - Extract
path, description, and branch from search results - Select entries whose descriptions best match the query semantically
- Consider multiple matches for comprehensive answers
Step 3: Fetch Document
Fetch the document from the public docs URL:
- - URL: INLINECODE90
- INLINECODE91 and
[path] come from the catalog entry (e.g., V1.0.0, V1.1.0)
Example
CODEBLOCK49
See references/doc-examples.md for more workflow examples.
If the information you need cannot be found in the catalog or the CLI output, visit the official seekdb documentation at oceanbase.ai/docs for the most complete and up-to-date reference.
seekdb — AI-Agent数据库CLI及文档
此技能允许AI Agent通过seekdb-cli命令操作seekdb,并在需要时查阅seekdb文档。
快速入门:首先运行seekdb ai-guide获取CLI的完整JSON自描述信息,然后直接运行命令——无需任何配置。
第一部分:seekdb-cli操作
seekdb-cli专为AI Agent设计。所有输出均为结构化JSON,所有操作均为无状态,内置安全防护机制可防止意外数据丢失。
seekdb部署
seekdb支持两种模式。根据用户的操作系统和场景,使用本节内容引导用户选择正确的部署路径。
嵌入式模式
seekdb作为库在应用程序内部运行——无需服务器进程。通过pyseekdb安装:
bash
pip install -U pyseekdb
支持平台:Linux (glibc ≥ 2.28)、macOS 15+ · 架构:x86_64、aarch64
Windows和较旧版本的macOS不支持嵌入式模式。请使用服务器模式。
服务器模式
持久化的seekdb进程,可通过MySQL客户端或seekdb-cli(远程DSN)连接。按操作系统选择:
| 操作系统 | 推荐方法 | 快速开始 |
|---|
| Linux (CentOS/RHEL/Anolis/openEuler) | 包管理器 (RPM) | curl -fsSL https://obportal.s3.ap-southeast-1.amazonaws.com/download-center/opensource/seekdb/seekdb_install.sh \ | sudo bash |
| Linux (Debian/Ubuntu) |
包管理器 (DEB) | sudo apt update && sudo apt install seekdb |
| macOS 15+ | Homebrew | brew tap oceanbase/seekdb && brew install seekdb |
| 支持Docker的任何操作系统 | Docker | docker run -d -p 2881:2881 oceanbase/seekdb |
| Windows / macOS (GUI) | OceanBase Desktop | 从
oceanbase.ai/download 下载 |
服务器模式部署后连接(默认端口2881,用户root,空密码):
bash
mysql -h127.0.0.1 -uroot -P2881 -A -Dtest
或通过seekdb-cli:
seekdb --dsn seekdb://root:@127.0.0.1:2881/test status
最低要求:1个CPU核心、2GB内存、SSD存储。
有关完整部署详情,请参阅部署文档。
前置条件
检查是否已安装seekdb-cli:
bash
seekdb --version
如果未安装,选择适合您环境的方法:
推荐 — pipx(全局工作,不污染系统Python环境):
bash
如有需要,先安装pipx(Ubuntu/Debian)
sudo apt install pipx && pipx ensurepath
然后安装seekdb-cli
pipx install seekdb-cli
备选 — pip(在项目虚拟环境内或没有PEP 668限制的系统上):
bash
pip install seekdb-cli
注意:对于Ubuntu 23.04+ / Debian 12+: 系统级直接pip install被PEP 668阻止。
请改用pipx——它会创建一个隔离环境,同时将seekdb命令保留在全局PATH中。
连接
seekdb-cli自动发现连接(环境变量、.env、~/.seekdb/config.env或默认的~/.seekdb/seekdb.db)。无需配置——直接运行命令即可。
如果用户提供了特定的DSN,通过--dsn传递(必须出现在子命令之前):
bash
远程模式
seekdb --dsn seekdb://user:pass@host:port/db schema tables
嵌入式模式(本地数据库文件)
seekdb --dsn embedded:./seekdb.db status
seekdb --dsn embedded:~/.seekdb/seekdb.db?database=mydb sql SELECT 1
DSN格式:
- - 远程: seekdb://user:pass@host:port/db
- 嵌入式: embedded:<路径>[?database=<数据库>](默认数据库:test)
获取完整CLI指南(首先运行)
bash
seekdb ai-guide
返回一个结构化JSON文档,包含每个命令、参数、工作流程、安全规则和输出格式。在任何seekdb任务开始时运行一次以熟悉环境。
推荐工作流程
SQL数据库探索
- 1. seekdb schema tables → 列出所有表(名称、列数、行数)
- seekdb schema describe <表名> → 获取列名、类型、索引、注释
- seekdb table profile <表名> → 数据统计(空值比例、唯一值、最小/最大值、最常出现的值)
- seekdb relations infer → 推断表之间的JOIN关系
- seekdb sql SELECT ... LIMIT N → 执行带显式LIMIT的SQL
向量集合工作流程
- 1. seekdb collection list → 列出所有集合
- seekdb collection info <名称> → 集合详情和文档预览
- seekdb query <集合> --text ... → 混合搜索(默认:语义+全文)
- seekdb add <集合> --data ... → 添加新文档
AI模型设置工作流程
- 1. seekdb ai model list → 检查已注册的模型
- seekdb ai model create <名称> --type <类型> --model <模型名称>
- seekdb ai model endpoint create <端点> <模型> --url --access-key <密钥>
- seekdb ai complete <提示> --model <名称> → 测试补全
命令参考
seekdb sql
执行SQL语句。默认为只读模式。
bash
读取查询
seekdb sql SELECT id, name FROM users LIMIT 10
从文件读取
seekdb sql --file query.sql
从标准输入读取
echo SELECT 1 | seekdb sql --stdin
在输出中包含表结构
seekdb sql SELECT * FROM orders LIMIT 5 --with-schema
禁用大字段截断
seekdb sql SELECT content FROM articles LIMIT 1 --no-truncate
写操作(需要--write标志)
seekdb sql --write INSERT INTO users (name) VALUES (Alice)
seekdb sql --write UPDATE users SET name = Bob WHERE id = 1
seekdb sql --write DELETE FROM users WHERE id = 3
输出格式:
json
{ok: true, columns: [id, name], rows: [{id: 1, name: Alice}], affected: 0, time_ms: 12}
seekdb schema tables
bash
seekdb schema tables
json
{ok: true, data: [{name: users, columns: 5, rows: 1200}, {name: orders, columns: 8, rows: 50000}]}
seekdb schema describe
bash
seekdb schema describe orders
json
{ok: true, data: {table: orders, comment: 订单表, columns: [{name: id, type: int, comment: 订单ID}, {name: status, type: varchar(20), comment: 0=待付款, 1=已付款}], indexes: [PRIMARY(id), idx_status(status)]}}
seekdb schema dump
bash
seekdb schema dump
返回所有CREATE TABLE DDL语句。
seekdb table profile
生成表的统计摘要,不返回原始数据。有助于在编写SQL之前了解数据分布。
bash
seekdb table profile <表名>
json
{ok: true, data: {
table: orders,
row_count: 50000,
columns: [
{name: id, type: int, null_ratio: 0, distinct: 50000, min: 1, max: 50000},
{name: userid, type: int, nullratio: 0, distinct: 1200, min: 1, max: 1500},
{name: amount, type: decimal(10,2),