Sign In

@agentskit/rag

Package Overview
Dependencies
Maintainers
1
Versions
33
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@agentskit/rag

Plug-and-play retrieval-augmented generation for AgentsKit.

Source
npmnpm
Version
0.1.2
Version published
Weekly downloads
433
-24.56%
Maintainers
1
Weekly downloads
 
Created
Source

@agentskit/rag

Plug-and-play retrieval-augmented generation: chunk documents, embed them, and retrieve the right context at query time.

Why

  • Your data, your agent — no fine-tuning required; ingest plain text and query with natural language
  • Composable stack — uses any EmbedFn and any VectorMemory from @agentskit/adapters and @agentskit/memory
  • Retriever-readycreateRAG() returns a Retriever you pass to @agentskit/runtime or useChat so context is injected automatically

Install

npm install @agentskit/rag @agentskit/memory @agentskit/adapters

Quick example

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 })

With runtime (retriever)

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).

Next steps

  • Tune chunking with chunkSize, chunkOverlap, or a custom split function on createRAG
  • Swap fileVectorMemory for redisVectorMemory or a custom VectorMemory for production
  • Use geminiEmbedder, ollamaEmbedder, or any (text) => Promise<number[]> as embed

Ecosystem

PackageRole
@agentskit/coreRetriever, VectorMemory, types
@agentskit/memoryVector backends (fileVectorMemory, etc.)
@agentskit/adaptersopenaiEmbedder and other embedders
@agentskit/runtimeretriever integration for agents
@agentskit/reactuseChat + chat UI with the same core types

Docs

Full documentation

Keywords

agentskit

FAQs

Package last updated on 07 Apr 2026

Did you know?

Socket

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.

Install

Related posts