埋め込みなしで知識エージェントを構築する
Vercel はベクトルデータベースや埋め込みモデルに依存しない、ファイルシステムベースの新しい知識エージェントアーキテクチャをオープンソース化し、デバッグ容易性とコスト削減を実現した。
キーポイント
従来の RAG アーキテクチャの課題
ベクトルデータベースと埋め込みモデルに依存する従来型のアプローチは、特定の値の取得が苦手であり、なぜ間違ったチャンクが選定されたのかを特定するのが困難な「サイレント・フェイラー」のリスクがある。
ファイルシステムベースの新アプローチ
Vercel Sandbox 内で grep や find などの Bash コマンドを実行し、ファイルを直接読み取ることで、検索プロセスを透明で決定論的なものに変える手法を採用している。
コスト削減と品質向上の実証
この新アーキテクチャを用いた販売電話要約エージェントでは、1 通あたりのコストが約$1.00から$0.25に低下し、出力の質も向上したことが報告されている。
デバッグプロセスの劇的改善
ベクトルスコアの調整を暗黙的に試行錯誤するのではなく、実際のファイルパスやコマンド実行履歴を追跡できるため、問題解決までの時間を数分レベルに短縮できる。
埋め込みなしのファイルシステムアプローチ
LLM はコードベースの操作に既に精通しているため、ベクトルデータベースや埋め込みパイプラインを維持する必要なく、既存のファイルシステムと Bash コマンドを活用して知識エージェントを構築できます。
単一エージェントによる全プラットフォーム統合
Chat SDK を使用することで、Slack、Discord、GitHub など複数のプラットフォームにまたがるユーザーやデータを一つの知識ベースとエージェントで統一的に管理・処理することが可能です。
AI パワーに基づくコスト最適化と管理
質問の複雑度に応じて安価なモデルと高性能なモデルを自動振り分け、さらに AI 自体がログや統計データを分析してエージェントのデバッグを行う統合管理機能が備わっています。
影響分析・編集コメントを表示
影響分析
このアプローチは、RAG(検索拡張生成)の主流であるベクトルデータベース依存からの脱却を示唆しており、特に構造化データや特定の事実情報の取得において、従来の手法が抱える「ブラックボックス化」問題を解決する重要な転換点となる。開発現場においては、複雑なチューニング作業を排除し、コスト効率と信頼性を同時に高める実用的なパラダイムシフトをもたらす可能性がある。
編集コメント
ベクトル検索の限界を打破する、実用性の高い代替案が提示された。特にデバッグの容易さとコスト削減効果は、現場開発者が直面する課題に直結しており、今後のエージェント設計における重要な選択肢の一つとなるだろう。
ほとんどの知識エージェントは同じ方法で始まります。ベクトルデータベースを選び、チャンキングパイプラインを構築します。埋め込みモデルを選択し、検索パラメータを調整します。
数週間後、あなたのエージェントが質問に誤って答えたとき、どのチャンクを取得したのか、なぜそのチャンクが最高スコアだったのか、まったく見当がつかないことがあります。
私たちは、社内およびVercel上でエージェントを構築するチームで、このパターンを繰り返し目にしてきました。埋め込みスタックは意味的類似性には有効ですが、構造化データから特定の値を取り出す必要がある場合には不十分です。この失敗は静かに起こります。エージェントは自信を持って間違ったチャンクを返し、質問から回答に至る経路を追跡することができません。
そこで私たちは別の方法を試みました。ベクトルパイプラインをファイルシステムに置き換え、エージェントにbashを利用させたのです。私たちの営業電話要約エージェントは、1通話あたりのコストが約1.00ドルから約0.25ドルに下がり、出力品質も向上しました。エージェントは、既に熟知していることを実行していたのです。つまり、ファイルを読み、grepを実行し、ディレクトリを移動することです。
そこで私たちは、このアーキテクチャの本番環境対応版をVercel上に構築した「Knowledge Agent Template」をオープンソース化しました。
テンプレートの機能
Knowledge Agent Templateは、フォーク、カスタマイズ、デプロイが可能な、オープンソースのファイルシステムベースのエージェントです。GitHubリポジトリ、YouTubeトランスクリプト、カスタムAPIなど、あらゆるソースを接続できます。Webチャットアプリ、GitHubボット、Discordボットとして、あるいはこれら3つすべてを同時に展開できます。
このテンプレートはVercel Sandbox、AI SDK、Chat SDK上に構築されています。ワンクリックでVercelにデプロイし、ソースを設定するだけで、質問への回答を開始できます。
Vercel Sandboxによるファイルベース検索
ベクトルデータベースは不要。チャンキングパイプラインは不要。埋め込みモデルは不要。
あなたのエージェントは、分離されたVercel Sandbox内でgrep、find、catを使用します。
仕組みは以下の通りです:
- 管理インターフェースを通じてソースを追加すると、それらはPostgresに保存されます
- コンテンツはVercel Workflowを介してスナップショットリポジトリに同期されます
- エージェントが検索を必要とするとき、Vercel Sandboxがスナップショットを読み込みます
- エージェントのbashおよびbash_batchツールがファイルシステムコマンドを実行します
- エージェントが参照情報をオプションとして添えて回答を返します
結果は決定的で、説明可能で、高速です。エージェントが間違った答えを返したときは、トレースを開いて確認できます。例えば、grep -r "pricing" docs/を実行し、docs/plans/enterprise.mdを読み、間違ったセクションを参照したことが分かります。ファイルを修正するか、エージェントの検索戦略を調整します。デバッグの一連の流れは数分で完了します。
これをベクトル検索と比較してみてください。エージェントが不適切なチャンクを返した場合、どのチャンクを取得したかを特定し、なぜそれが0.82のスコアで、正しいチャンクが0.79だったのかを解明する必要があります。問題はチャンキングの境界、埋め込みモデル、類似性しきい値にある可能性があります。ファイルシステム検索では、なぜそのチャンクが選ばれたかを推測する必要はなく、暗中模索で検索スコアを調整することもありません。あなたがデバッグするのはパイプラインではなく、質問そのものなのです。
埋め込み(embeddings) | ファイルシステム
--- | ---
ブラックボックスなスコアリング | 透明性のあるコマンド
デバッグが困難 | 実際のファイルを調査可能
調整が必要 | すぐに動作する
LLMは既にファイルシステムを理解しています。膨大な量のコードでトレーニングされており、ディレクトリの移動、ファイルのgrep、複雑なコードベースにわたる状態管理を行っています。エージェントがコードに対するファイルシステム操作に優れているなら、あらゆるものに対して優れているはずです。これが、ファイルシステムとbashアプローチの背後にある洞察です。
あなたはモデルに新しいスキルを教えているのではありません。モデルが最も得意とするスキルを活用しているのです。維持管理する埋め込みパイプラインも、スケーリングするベクトルDBも必要ありません。ソースを追加し、同期し、検索するだけです。
Chat SDK: 単一のエージェント、あらゆるプラットフォーム
あなたのエージェントには、単一の知識ベース、単一のコードベース、単一の信頼できる情報源があります。しかし、エンジニアはSlackに散らばり、コミュニティはDiscordに広がり、バグレポートはGitHubに埋もれているかもしれません。これら3つすべてを理解する単一のエージェントがあれば理想的です。
Chat SDKは、あなたの知識エージェントをユーザーがいるあらゆるプラットフォームに接続します。必要なアダプターをインポートし、それぞれを同じエージェントパイプラインに向けるだけで、あなたのエージェントはChat SDKがサポートするあらゆるプラットフォームで稼働します。
Chat SDK Knowledge Agentの例
各アダプターは、認証、イベント形式、メッセージングなど、プラットフォーム固有の処理を担当します。一方、エージェント自体は変更されません。ボットが言及されると、プラットフォームに関係なくonNewMentionが発火します。エージェントはメッセージテキストを受け取り、同じファイルシステムを基盤とするパイプラインを通じて応答をストリーミングし、スレッドに返信を投稿します。
このテンプレートには、GitHubとDiscordのアダプターが標準で同梱されています。また、Chat SDKはすでにSlack、Microsoft Teams、Google Chatなどをサポートしています。公式およびコミュニティ製アダプターの完全なリストについては、アダプターディレクトリを参照してください。
AI SDKとの深い統合
savoir/sdkパッケージは、あらゆるAI SDK駆動のエージェントやアプリをあなたの知識ベースに接続するツールを提供します。ツールをインポートし、クライアントをあなたのインスタンスURLに向け、そのツールをエージェントに渡して接続を確立します。
SDKの機能を拡張して公開する予定がある場合は、パッケージ名を@savoir/sdkから独自の名前に変更してください。
このテンプレートには、スマート複雑度ルーターも含まれています。すべての受信質問は複雑度によって分類され、適切なモデルにルーティングされます。単純な質問は高速で低コストなモデルへ、難しい質問は高性能なモデルへ送られます。手動ルールなしで、コスト最適化が自動的に行われます。
Vercel AI Gatewayを介して、あらゆるAI SDKモデルプロバイダーと互換性があります。
組み込みの管理ツール
このテンプレートには、使用統計、エラーログ、ユーザー管理、ソース設定、コンテンツ同期コントロールを含む、完全な管理インターフェースが備わっています。外部の可観測性ツールは必要ありません。
さらに、AI駆動の管理エージェントも内蔵されています。「過去24時間に発生したエラーは何か」や「ユーザーがよく尋ねる質問は何か」といった質問をすることができます。管理エージェントは、内部ツール(query_stats、query_errors、run_sql、chart)を使用して直接回答を提供します。エージェントを使ってエージェントをデバッグするのです。
始めましょう
動作する知識エージェントを構築するために、ベクトルデータベース、埋め込みモデル、チャンキングパイプラインは必要ありません。必要なのは、ファイルシステム、bash、そしてあなたのエージェントをユーザーが既にいる場所に配置する方法です。これらが基本要素です。
Knowledge Agent Templateはこれらを組み合わせるので、あなたはエージェントがどのように洞察を得るかではなく、エージェントが何を知っているかに集中できます。
原文を表示
Most knowledge agents start the same way. You pick a vector database, then build a chunking pipeline. You choose an embedding model, then tune retrieval parameters.
Weeks later, your agent answers a question incorrectly, and you have no idea which chunk it retrieved or why that chunk scored highest.
We kept seeing this pattern internally and for teams building agents on Vercel. The embedding stack works for semantic similarity, but it falls short when you need a specific value from structured data. The failure mode is silent: the agent confidently returns the wrong chunk, and you can't trace the path from question to answer.
That's why we tried something different. We replaced our vector pipeline with a filesystem and gave the agent bash. Our sales call summarization agent went from ~$1.00 to ~$0.25 per call, and the output quality improved. The agent was doing what it already knew how to do: read files, run grep, and navigate directories.
So we open-sourced the Knowledge Agent Template, a production-ready version of this architecture built on Vercel.
What the template does
The Knowledge Agent Template is an open source, file-system-based agent you can fork, customize, and deploy. Plug any source: GitHub repos, YouTube transcripts, custom APIs. Ship it as a web chat app, a GitHub bot, a Discord bot, or all three at once.
The template is built on Vercel Sandbox, AI SDK, and Chat SDK. Deploy to Vercel in a single click, configure your sources, and start answering questions.
File-based search with Vercel Sandbox
No vector database. No chunking pipeline. No embedding model.
Your agent uses grep, find, and cat inside of isolated Vercel Sandboxes.
Here's how it works:
You add sources through the admin interface, and they're stored in Postgres
Content syncs to a snapshot repository via Vercel Workflow
When the agent needs to search, a Vercel Sandbox loads the snapshot
The agent's bash and bash_batch tools execute file-system commands
The agent returns an answer with optional references
Results are deterministic, explainable, and fast. When the agent gives a wrong answer, you open the trace and see: it ran grep -r "pricing" docs/, read docs/plans/enterprise.md, and pulled the wrong section. You fix the file or adjust the agent's search strategy. The whole debugging loop takes minutes.
Compare that to vectors. If the agent returns a bad chunk, you have to determine which chunk it retrieved, then figure out why it scored 0.82 and the correct one scored 0.79. The problem could be the chunking boundary, the embedding model, or the similarity threshold. With filesystem search, there is no guessing why it picked that chunk and no tuning retrieval scores in the dark. You're debugging a question, not a pipeline.
Embeddings
Filesystem
Black-box scoring
Transparent commands
Hard to debug
Inspect actual files
Requires tuning
Works out of the box
LLMs already understand filesystems. They've been trained on massive amounts of code: navigating directories, grepping through files, managing state across complex codebases. If agents excel at filesystem operations for code, they excel at them for anything. That's the insight behind the filesystem and bash approach.
You're not teaching the model a new skill; you're using the one it's best at. No embedding pipeline to maintain or vector DB to scale. Add a source, sync, and search.
Chat SDK: one agent, every platform
Your agent has one knowledge base, one codebase, and one source of truth. Yet your engineers are scattered across Slack, your community spread across Discord, your bug reports buried in GitHub. A single agent that understands all three.
Chat SDK connects your knowledge agent to every platform your users are on. Import the adapters you need, point each one to the same agent pipeline, and your agent is live in any Chat SDK-supported platform.
Chat SDK Knowledge Agent example
Each adapter handles platform-specific concerns (e.g., authentication, event formats, messaging) while the agent itself stays unchanged. onNewMention fires whenever the bot is mentioned, regardless of platform. The agent receives the message text, streams a response through the same filesystem-backed pipeline, and posts back to the thread.
The template ships with GitHub and Discord adapters out of the box, and Chat SDK already supports Slack, Microsoft Teams, Google Chat, and more. See the adapter directory for a full list of official and community adapters.
Deep integration with AI SDK
The @savoir/sdk package provides tools that connect any AI SDK-powered agent or app to your knowledge base. Import the tools, point the client to your instance URL, and pass the tools to your agent to establish the connection.
If you plan to extend the SDK's capabilities and publish it, customize the package name from @savoir/sdk to your own.
The template also includes a smart complexity router. Every incoming question is classified by complexity and routed to the right model. Simple questions go to fast, cheap models. Hard questions go to powerful ones. Cost optimization happens automatically, with no manual rules.
Compatible with any AI SDK model provider via Vercel AI Gateway.
Built-in admin tools
The template includes a full admin interface: usage stats, error logs, user management, source configuration, and content sync controls. No external observability needed.
There's also an AI-powered admin agent. You can ask it questions like: "what errors occurred in the last 24 hours", or "what are the common questions users ask". It will use internal tools (query_stats, query_errors, run_sql, and chart) to provide answers directly. You debug your agent with an agent.
Get started
You don't need a vector database, an embedding model, or a chunking pipeline to build a working knowledge agent. You need a filesystem, bash, and a way to put your agent where your users already are. Those are the primitives.
The Knowledge Agent Template wires them together so you can focus on what your agent knows rather than how it retrieves insights.
Read more
関連記事
今日のまとめ
AI日報で今日の重要ニュースをまとめ読み