
Company News
Free Business Plan Upgrades for Open Source Maintainers
Open source maintainers are under more pressure than ever. We're raising our open source program from the Team plan to the Business plan, free.
@agentskit/rag
Advanced tools
Plug-and-play retrieval-augmented generation: chunk documents, embed them, and retrieve the right context at query time.
Tags: ai · agents · llm · agentskit · rag · retrieval · vector-search · embeddings · ai-agents · semantic-search · knowledge-base
@agentskit/rag is the retrieval layer: load documents, chunk them, embed them, rerank results, and feed precise context back to agents.
Docs: package guide · agent handoff
EmbedFn and any VectorMemory from @agentskit/adapters and @agentskit/memory; swap either layer without touching RAG logiccreateRAG() returns a Retriever you pass to @agentskit/runtime or useChat so context is injected automaticallychunkSize, chunkOverlap, or a custom split function — three knobs that cover 95% of use casesnpm install @agentskit/rag @agentskit/memory @agentskit/adapters
import { createRAG } from '@agentskit/rag'
import { openaiEmbedder } from '@agentskit/adapters'
import { fileVectorMemory } from '@agentskit/memory'
const rag = createRAG({
embed: openaiEmbedder({ apiKey: process.env.OPENAI_API_KEY! }),
store: fileVectorMemory({ path: './vectors' }),
})
await rag.ingest([
{ id: 'doc-1', content: 'AgentsKit is a JavaScript agent toolkit...' },
])
const docs = await rag.search('How does AgentsKit work?', { topK: 5 })
Pass the RAG instance as retriever so the runtime injects retrieved context into the task:
import { createRuntime } from '@agentskit/runtime'
import { openai } from '@agentskit/adapters'
const runtime = createRuntime({
adapter: openai({ apiKey: process.env.OPENAI_API_KEY!, model: 'gpt-4o' }),
retriever: rag,
})
const result = await runtime.run('Explain the AgentsKit architecture based on ingested docs')
console.log(result.content)
You can also call rag.retrieve({ query, messages }) to satisfy the core Retriever contract (for example from a custom controller).
createRAG({ embed, store }) — single entry point for ingest + retrieve.rag.ingest(docs) — chunk, embed, and store documents.rag.search(query, { topK }) — semantic similarity search.rag.retrieve({ query, messages }) — Retriever contract v1 for runtime/controller injection.chunkSize, chunkOverlap, custom split.EmbedFn and any VectorMemory.createRerankedRetriever (Cohere Rerank, BGE, BM25 default), createHybridRetriever (vector + BM25 blend), standalone bm25Score. Recipe.loadUrl, loadGitHubFile, loadGitHubTree, loadNotionPage, loadConfluencePage, loadGoogleDriveFile, loadPdf (BYO parser). Recipe.| Package | Role |
|---|---|
| @agentskit/core | Retriever, VectorMemory, types |
| @agentskit/memory | Vector backends (fileVectorMemory, etc.) |
| @agentskit/adapters | openaiEmbedder and other embedders |
| @agentskit/runtime | retriever integration for agents |
| @agentskit/react | useChat + chat UI with the same core types |
MIT — see LICENSE.
FAQs
Plug-and-play retrieval-augmented generation for AgentsKit.
The npm package @agentskit/rag receives a total of 153 weekly downloads. As such, @agentskit/rag popularity was classified as not popular.
We found that @agentskit/rag demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Company News
Open source maintainers are under more pressure than ever. We're raising our open source program from the Team plan to the Business plan, free.

Security News
The supply chain control that delays freshly published gems now covers lockfile generation and gem vendoring in Ruby projects.

Security News
During a UK cyber test, a Mythos 5 agent used sockpuppets, social engineering, and prompt injection to try to get a maintainer to merge malware.