npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

@crewai-ts/rag

v0.2.1

Published

RAG, knowledge, memory, and file-ingestion features for CrewAI TypeScript.

Downloads

325

Readme

@crewai-ts/rag

npm version license types

Memory, Knowledge, vector-store, and PDF text-extraction features for CrewAI TypeScript.

This package provides Memory and MemoryScope for cross-execution recall, Knowledge source types for prompt-time retrieval, embedding functions, and Qdrant / ChromaDB client adapters for building retrieval-augmented generation workflows. PDF text extraction is included by default; vector-store integration is opt-in.

Unofficial project. This is a community port of CrewAI and is not affiliated with, endorsed by, or maintained by crewAI, Inc. See License for the upstream MIT notice.

Install

npm install @crewai-ts/core @crewai-ts/rag
# or
pnpm add @crewai-ts/core @crewai-ts/rag

Requirements:

  • Node.js 22 or later
  • @crewai-ts/core 0.2.0 or later

Memory

Store and recall information across agent executions. Memory is attached to a Crew via the memory option; agent-level memory is also available through new Agent({ memory }).

import { Crew, Process, Task } from "@crewai-ts/core";
import { Memory } from "@crewai-ts/rag";

const memory = new Memory();
memory.remember("CrewAI supports sequential crews", {
  scope: "/research",
  categories: ["fact"],
});

const recalled = memory.recall("sequential crews", {
  scope: "/research",
  limit: 5,
});

const crew = new Crew({
  agents: [researcher],
  tasks: [task],
  process: Process.sequential,
  memory,
});

Knowledge

Inject knowledge sources into agent and crew prompts. Each Knowledge source contributes relevant snippets to the task prompt as additional context.

StringKnowledgeSource accepts either a plain string or an options object. The string form is the most ergonomic for inline content:

import { Agent, Crew, Task } from "@crewai-ts/core";
import {
  CSVKnowledgeSource,
  JSONKnowledgeSource,
  StringKnowledgeSource,
  TextFileKnowledgeSource,
} from "@crewai-ts/rag";

const crew = new Crew({
  agents: [researcher],
  tasks: [
    new Task({
      description: "Explain the Nest integration",
      expectedOutput: "Integration guidance",
      agent: researcher,
    }),
  ],
  knowledgeSources: [
    new StringKnowledgeSource("Nest should consume crewai-ts as a normal TypeScript library."),
    new StringKnowledgeSource({
      content: "The API service uses NestJS modules, providers, and controllers.",
      metadata: { source: "architecture-notes" },
    }),
    new TextFileKnowledgeSource("docs/notes.txt"),
    new JSONKnowledgeSource("data/facts.json"),
    new CSVKnowledgeSource("data/records.csv"),
  ],
});

crew.resetMemories("knowledge");

Vector Stores

This package ships client adapters for Qdrant and ChromaDB. The clients wrap the existing EmbeddingFunction plumbing and let you perform collection operations, batching, and locked writes against a remote store.

import { ChromaDBClient, QdrantClient } from "@crewai-ts/rag";

const qdrant = new QdrantClient(existingQdrantClient, {
  embeddingFunction: myEmbeddingFunction,
  defaultLimit: 10,
  defaultScoreThreshold: 0.7,
  defaultBatchSize: 100,
  lockName: "qdrant-research",
});

const chroma = new ChromaDBClient(existingChromaClient, {
  embeddingFunction: myEmbeddingFunction,
  defaultLimit: 5,
  defaultScoreThreshold: 0.6,
  defaultBatchSize: 100,
});

QdrantClient and ChromaDBClient are thin async-friendly adapters — operations like acreate_collection, aadd, aquery, and adelete return Promises and integrate with the runNamedLock helper for process-safe writes. They expect you to bring your own @qdrant/js-client-rest or chromadb client (this package does not bundle a transport).

PDF Text Extraction

defaultPDFTextExtractorAsync extracts plain text from a PDF buffer. It uses pdf-parse internally and accepts a Buffer:

import { readFileSync } from "node:fs";
import { defaultPDFTextExtractorAsync } from "@crewai-ts/rag";

const pdfBuffer = readFileSync("docs/report.pdf");
const text = await defaultPDFTextExtractorAsync(pdfBuffer);

If you have a Uint8Array instead, wrap it with Buffer.from(bytes) first.

Exports

  • Memory, MemoryScope, MemorySlice — memory storage and recall
  • createMemoryTools(memory) — recall / save tools injected into crews
  • Knowledge, StringKnowledgeSource, TextFileKnowledgeSource, JSONKnowledgeSource, CSVKnowledgeSource — knowledge sources
  • QdrantClient, ChromaDBClient — vector-store client adapters
  • QdrantEmbeddingFunctionWrapper, ChromaEmbeddingFunctionWrapper — embedding function adapters
  • BaseRecord, Embedding, Embeddings, EmbeddingFunction, AsyncEmbeddingFunction, QueryEmbedding — vector store types
  • defaultRagEmbeddingFunction — the default embedding function
  • defaultPDFTextExtractorAsync — PDF text extraction

Related Packages

  • @crewai-ts/core — agents, tasks, crews, tools, hooks, security, checkpoints
  • @crewai-ts/flow — stateful Flow orchestration
  • @crewai-ts/nestjs — NestJS DI integration
  • @crewai-ts/cli — crewai-ts CLI

License

MIT

This project is an unofficial TypeScript port of CrewAI (Copyright © crewAI, Inc.), which is distributed under the MIT License. It is not affiliated with or endorsed by crewAI, Inc. As required by the MIT License, the original copyright and permission notice are retained in LICENSE.