需先配置 BETTER_AUTH_SECRET、GITHUB_CLIENT_ID、GITHUB_CLIENT_SECRET 环境变量才能启动;本地开发需自备 AI_GATEWAY_API_KEY,Vercel 上才自动用 OIDC;知识源需在 /admin 后台添加并手动触发同步后才可检索
knowledge-agent-template
vercel-labsMIT活跃维护基于文件系统和知识库的 AI Agent 模板,让智能体随时读取你的知识库内容,保持回答最新,适合快速搭建聊天机器人。
Open source file-system and knowledge based agent template. Build AI agents that stay up to date with your knowledge base
git clone https://github.com/vercel-labs/knowledge-agent-template.git
cd knowledge-agent-template
bun install
cp apps/app/.env.example apps/app/.env
bun run devREADME 未说明本地硬件要求;运行依赖 Vercel Sandbox 作为隔离执行环境,模型通过 Vercel AI SDK 接入
基于文件系统的知识库 AI Agent 模板,用 grep/find/cat 检索,无需向量库
基于文件系统和知识库的 AI Agent 模板,让智能体随时读取你的知识库内容,保持回答最新,适合快速搭建聊天机器人。
核心能力
- 在隔离沙箱内用 grep、find、cat 检索知识源
- 无需 embedding 模型与向量数据库,结果确定可解释
- 同一 Agent 可部署为网页聊天、GitHub Bot、Discord Bot
- 内置管理后台,含用量统计、错误日志与源同步控制
- 按问题复杂度自动路由到便宜或强力的模型
容易踩的坑
暂无 release 数据(可能没有发版,或尚未同步)。
用户点评
登录用户的真实使用记录,可按版本和硬件筛选还没有人点评。第一个说出真实体验的人最有价值。
Open source file-system and knowledge based agent template. Build AI agents that stay up to date with your knowledge base — grep, find, and cat across your sources, no embeddings, no vector DB. Plug any source (GitHub repos, YouTube transcripts, custom APIs) and deploy as a chat app, a GitHub bot, a Discord bot, or all at once.
Features
File-Based Search — No Embeddings Needed
No vector database. No chunking pipeline. No embedding model. Agents use grep, find, and cat inside isolated sandboxes to search across all your sources. Results are deterministic, explainable, and instant. Zero infrastructure overhead.
Multi-Platform Bots — One Agent, Everywhere
Write your agent once, deploy it on the web chat, GitHub Issues, Discord - and soon Slack, Linear, and more. Powered by pluggable adapters via the Chat SDK. Adding a new platform is a single adapter file.
Built-in Admin Panel
Full admin interface out of the box: usage stats, error logs, user management, source configuration, and content sync controls. No need for external dashboards or third-party monitoring.
AI-Powered Admin Agent
Ask your app about itself. "What errors happened in the last 24 hours?", "Show token usage by model", "Which endpoints are slowest?" — the admin agent has access to internal tools like query_stats, query_errors, run_sql, and chart to answer operational questions in natural language.
Smart Complexity Router
Every incoming question is classified by complexity (trivial → complex) and routed to the right model. Simple questions go to fast, cheap models. Hard questions go to powerful ones. Cost optimization happens automatically, no manual rules to maintain.
Real-Time Tool Visualization
The chat UI shows what the agent is doing in real time: which files it's reading, which commands it's running, and how long each step takes. No black box.
Shareable Conversations
Share any conversation with a single click. Generates a public read-only link with full metadata — author, title, and the complete exchange.
Shared Sandbox Pool
Sandboxes are pooled across users and conversations. When a chat starts, it connects to an already-running sandbox instead of creating a new one — startup in under 100ms. If none is available, a pre-built snapshot spins one up in 1–3s. Because a sandbox is shared, agents reach it through a parsed command policy that permits only read-only commands — nothing that can write a file or spawn a process — so multiple agents search the same up-to-date content without duplicating resources or affecting each other.
Architecture
┌─────────────────────────────────────────────────────────────────┐
│ Your AI Application │
│ (Discord bot, GitHub bot, etc.) │
└─────────────────────────────────┬───────────────────────────────┘
│
▼
┌─────────────────────────────────────────────────────────────────┐
│ @savoir/sdk │
│ AI SDK compatible tools (bash, bash_batch) │
└─────────────────────────────────┬───────────────────────────────┘
│ API calls
▼
┌─────────────────────────────────────────────────────────────────┐
│ apps/app │
│ (Unified Nuxt Application) │
│ ┌─────────────┐ ┌──────────────┐ ┌────────────────────────┐ │
│ │ Sandbox │ │ Content │ │ Vercel Workflows │ │
│ │ Manager │ │ Sync │ │ (scheduled sync) │ │
│ └──────┬──────┘ └──────┬───────┘ └────────────────────────┘ │
└─────────┼────────────────┼──────────────────────────────────────┘
│ │
▼ ▼
┌────────────┐ ┌─────────────┐
│ Vercel │ │ GitHub │
│ Sandbox │ │ Snapshot │
│ │ │ Repo │
└────────────┘ └─────────────┘
Packages
| Package | Description |
|---|---|
@savoir/sdk | AI SDK compatible tools for agents |
@savoir/agent | Agent core: router, prompts, tools, types |
apps/app | Unified Nuxt app (chat UI + API + bots) |
Quick Start
Using the SDK
import { generateText } from 'ai'
import { createSavoir } from '@savoir/sdk'
const savoir = createSavoir({
apiUrl: process.env.SAVOIR_API_URL!,
apiKey: process.env.SAVOIR_API_KEY,
})
const { text } = await generateText({
model: yourModel, // any AI SDK compatible model
tools: savoir.tools, // bash and bash_batch tools
maxSteps: 10,
prompt: 'How do I configure authentication?',
})
console.log(text)
Deploy to Vercel
Self-hosting
# Clone the repository
git clone https://github.com/vercel-labs/knowledge-agent-template.git
cd knowledge-agent-template
# Install dependencies
bun install
# Configure environment variables
cp apps/app/.env.example apps/app/.env
# Edit .env with your configuration
# Start the app
bun run dev
Required environment variables:
# Authentication
BETTER_AUTH_SECRET=your-secret # Secret for signing sessions/tokens
GITHUB_CLIENT_ID=... # GitHub OAuth app client ID
GITHUB_CLIENT_SECRET=... # GitHub OAuth app client secret
# AI (optional — only needed for local dev, Vercel uses OIDC automatically)
# AI_GATEWAY_API_KEY=... # Vercel AI Gateway API key
# Sandbox
# NUXT_GITHUB_SNAPSHOT_REPO=org/repo # Optional default (can be set from admin sandbox UI)
# NUXT_GITHUB_TOKEN=ghp_... # Optional fallback override (GitHub App is the default path)
See ENVIRONMENT.md for the full list of environment variables.
Customization
Knowledge Agent Template is designed as a reusable template. See the Customization Guide for how to:
- Rename your instance (name, icon, description)
- Add content sources (GitHub repos, YouTube channels, custom)
- Add custom AI tools
- Add bot adapters (Slack, Linear, etc.)
- Customize AI prompts
- Theme the UI
- Deploy to production
AI-assisted customization: The project includes local skills in .agents/skills/ (add-tool, add-source, add-bot-adapter, rename-project). You can delegate these tasks to an AI agent — e.g. "Follow the rename-project skill to rename this to MyDocs" — instead of doing them manually.
Configuration
Sources are managed through the admin interface at /admin. You can add GitHub repositories and YouTube channels as knowledge sources, then trigger a sync from the UI.
Sources can also be listed programmatically via the SDK (savoir.client.getSources()).
See SOURCES.md for detailed source configuration options.
How It Works
For the full technical deep-dive, see Architecture.
- Sources in Database: Sources are stored in SQLite via NuxtHub, managed through the admin interface
- Content Aggregation: Sources (GitHub repos, YouTube transcripts, custom APIs, etc.) are synced to a snapshot repository via Vercel Workflow
- Sandbox Creation: When an agent needs to search, the API creates/recovers a Vercel Sandbox with the snapshot repo cloned
- File-based Search: The SDK
bashandbash_batchtools execute grep/find/cat commands in the sandbox to search and read content - AI Integration: Tools are compatible with the Vercel AI SDK for seamless integration with any LLM
Bots
Knowledge Agent Template includes built-in bot integrations powered by the Vercel Chat SDK:
- GitHub Bot: Responds to mentions in GitHub issues and PRs. Uses a GitHub App for authentication and webhooks.
- Discord Bot: Responds to mentions and continues conversations in threads. Uses the Discord API.
Both bots use the same AI agent and knowledge base as the chat interface. Want to add your own? See Adding a Bot Adapter.
Development
# Install dependencies
bun install
# Start the app in dev mode
bun run dev
# Build all packages
bun run build
# Run tests
bun run test
# Lint and fix
bun run lint:fix
Built With
- Nuxt - Full-stack Vue framework
- Nuxt UI - UI component library
- NuxtHub - Database, KV, and blob storage
- Vercel AI SDK - AI model integration and tool system
- Vercel Sandbox - Isolated execution environment
- Vercel Workflow - Durable workflow execution
- Better Auth - Authentication framework
- Drizzle ORM - Type-safe database queries
- Vercel Chat SDK - Bot framework for GitHub and Discord
Contributing
See CONTRIBUTING.md for how to get involved. To report a security vulnerability, see SECURITY.md.