Big News: Socket raises $60M Series C at a $1B valuation to secure software supply chains for AI-driven development.Announcement
Sign In

@ridit/ai

Package Overview
Dependencies
Maintainers
1
Versions
14
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@ridit/ai

Your agents, in minutes.

Source
npmnpm
Version
0.1.4
Version published
Weekly downloads
213
491.67%
Maintainers
1
Weekly downloads
 
Created
Source

@ridit/ai

your agents, in minutes.

build AI agents that remember things, use tools, persist sessions, and work in teams. works with any model. no magic, no black boxes. just agents.

install

npm install @ridit/ai
# or
bun add @ridit/ai

what it does

  • any model — anthropic, openai, groq, google, ollama, openrouter
  • memory — inject context into any session
  • sessions — persist to disk or localStorage.
  • compaction — context too long? it summarizes itself. automatically.
  • tools — files, bash, memory, sub-agents, and more

quick start

import { buildProvider, runLLM } from "@ridit/ai";
import { FileWriteTool, ThinkTool } from "@ridit/ai/tools";

const provider = buildProvider({
  provider: "anthropic",
  model: "claude-sonnet-4-20250514",
  apiKey: process.env.ANTHROPIC_API_KEY,
});

const { text, session } = await runLLM({
  prompt: "create a hello world python script",
  provider,
  tools: { ThinkTool, FileWriteTool },
});

console.log(text);

that's it. agent runs, uses tools, returns text and the session.

providers

import { buildProvider } from "@ridit/ai";

buildProvider({
  provider: "anthropic",
  model: "claude-sonnet-4-20250514",
  apiKey: "...",
});
buildProvider({ provider: "openai", model: "gpt-4o", apiKey: "..." });
buildProvider({
  provider: "groq",
  model: "llama-3.3-70b-versatile",
  apiKey: "...",
});
buildProvider({ provider: "google", model: "gemini-2.0-flash", apiKey: "..." });
buildProvider({ provider: "ollama", model: "llama3.2" }); // no key needed
buildProvider({
  provider: "openrouter",
  model: "meta-llama/llama-3.3-70b-instruct",
  apiKey: "...",
});

sessions

sessions are opt-in. no storage passed = runs in memory, nothing saved. your call.

node

import { createFileStore } from "@ridit/ai/utils";

const store = createFileStore({ sessionsDir: "./sessions" });

const { session } = await runLLM({ prompt: "hey", provider, store });

// resume later
const { text } = await runLLM({
  prompt: "what did i say before?",
  provider,
  session,
  storage,
});

browser

const storage = {
  async save(session) {
    localStorage.setItem(session.id, JSON.stringify(session));
  },
  async load(id) {
    const s = localStorage.getItem(id);
    return s ? JSON.parse(s) : null;
  },
  async list() {
    return [];
  },
};

const { text, session } = await runLLM({ prompt: "hi", provider, storage });

bring your own adapter. redis, supabase, sqlite — whatever you want.

tools

import {
  BashTool, // run shell commands
  FileReadTool, // read files
  FileWriteTool, // write files
  FileEditTool, // patch files
  GlobTool, // find files by pattern
  GrepTool, // search inside files
  ThinkTool, // internal reasoning step
  MemoryReadTool,
  MemoryWriteTool,
  MemoryEditTool,
  RecallTool, // semantic memory recall
} from "@ridit/ai/tools";

Create yours too!

compaction

when sessions get long, @ridit/ai summarizes the history and compacts it automatically before the next call. you don't have to think about it.

system prompts

const { text } = await runLLM({
  prompt: "review this PR",
  provider,
  system: "you are a senior typescript engineer. be direct. no fluff.",
});

api

buildProvider(config)

fieldtyperequired
provider"anthropic" | "openai" | "groq" | "google" | "ollama" | "openrouter"
modelstring
apiKeystringfor hosted providers
baseURLstringfor ollama / custom endpoints

runLLM(options)

fieldtypedescription
promptstringuser message
providerLanguageModelfrom buildProvider()
systemstringsystem prompt
toolsobjecttool map
sessionSessionresume a session
storageSessionStoragepersistence adapter
memoryContentstringmemory to inject
stepsnumbermax agentic steps (default: 100)
onToolCallfunctionintercept before tool runs
onToolResultfunctionobserve tool output
abortSignalAbortSignalcancel in-flight requests

built with

Vercel AI SDK — model routing, tool calling, streaming

history

@ridit/ai started as the core of Milo — a terminal AI agent/pet. after building out memory, sessions, compaction, and multi-agent support there, it made sense to pull it out into a proper framework anyone could use.

if you want to see what you can build with it, go look at Milo.

license

MIT © Ridit Jangra

made with 💕

FAQs

Package last updated on 30 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