Skip to content

Repository files navigation

@basegrid-io/core

npm versionLicense

The official Node.js SDK for BaseGrid — persistent memory infrastructure for AI agents.

Sub-200ms memory retrieval. Hybrid semantic search. Built for production.


Installation

npm install @basegrid-io/core

Quick Start

import{BaseGrid}from'@basegrid-io/core';constclient=newBaseGrid({apiKey: process.env.BASEGRID_API_KEY});// Store a memoryawaitclient.memory.store({agentId: 'support-bot',content: 'User prefers concise answers and dislikes jargon',});// Recall relevant memoriesconstmemories=awaitclient.memory.recall({agentId: 'support-bot',query: 'communication preferences',limit: 5,});console.log(memories);

Usage with AI Frameworks

With Vercel AI SDK

import{BaseGrid}from'@basegrid-io/core';import{openai}from'@ai-sdk/openai';import{generateText}from'ai';constmemory=newBaseGrid({apiKey: process.env.BASEGRID_API_KEY});// Retrieve context before generatingconstmemories=awaitmemory.recall({agentId: 'assistant',query: userMessage});constcontext=memories.map(m=>m.content).join('\n');const{ text }=awaitgenerateText({model: openai('gpt-4o'),prompt: `Context from memory:\n${context}\n\nUser: ${userMessage}`,});// Store the interactionawaitmemory.store({agentId: 'assistant',content: `User asked: ${userMessage}`});

With LangChain

import{BaseGrid}from'@basegrid-io/core';constmemory=newBaseGrid({apiKey: process.env.BASEGRID_API_KEY});// Use as a memory layer in your chainconstrelevantMemories=awaitmemory.recall({agentId: 'langchain-agent',query: input,});

API Reference

client.memory.store(options)

awaitclient.memory.store({agentId: string,// Required: namespace for this agentcontent: string,// Required: the memory contentmetadata?: object,// Optional: key-value metadataimportance?: number,// Optional: 0-1 (default: 0.5)});

client.memory.recall(options)

constmemories=awaitclient.memory.recall({agentId: string,// Required: namespace to searchquery: string,// Required: semantic search querylimit?: number,// Optional: max results (default: 5)});

client.memory.list(options)

constmemories=awaitclient.memory.list({agentId: string,// Requiredlimit?: number,// Optional: (default: 10)});

client.memory.forget(memoryId: string)

awaitclient.memory.forget('memory_id_here');

Configuration

constclient=newBaseGrid({apiKey: process.env.BASEGRID_API_KEY,// RequiredbaseUrl?: string,// Optional: default https://api.basegrid.iotimeout?: number,// Optional: ms (default: 10000)});

Pricing

PlanMemoriesAPI Calls/MonthPrice
Free Trial500K1,000Free for 2 months
Pro Starter500K5M$49/month
Pro Plus2M20M$79/month
Scale10M50M$199/month

Self-hosting available on Scale plan. Get your key at basegrid.io


Requirements


Other SDKs


Contributing

See CONTRIBUTING.md

License

Apache 2.0 — see LICENSE

Built by BaseGrid · Docs · Discord

About

Official SDKs for BaseGrid — memory infrastructure for AI agents (Node.js, Python, Go)

Topics

Resources

Contributing

Stars

1 star

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages