Getting Started

Introduction

Node.js/TypeScript SDK for Rice. Unified Client for Storage and State.

Rice SDKs

Official SDKs for Rice (Node.js/TypeScript and Python). The SDKs provide a unified Client to access both Storage and State services.

Installation

npm install rice-node-sdk

Quick Start

import { Client } from "rice-node-sdk";

// Initialize client (loads config from rice.config.js and .env)
const client = new Client();
await client.connect();

// --- Storage ---
// Insert data
await client.storage.insert(
  "unique-node-id",
  "This is a piece of information stored in Rice Storage.",
  { category: "example", value: 123 },
);

// Search for similar data
const results = await client.storage.search("information stored", 1, 5);
console.log(results);

// --- State (AI Agent Memory) ---
// Focus on a context/task
await client.state.focus("User is asking about weather");

// Store a long-term memory (commit)
await client.state.commit(
  "The user prefers metric units for temperature.",
  "User preference noted.",
  { source: "conversation" },
);

// Recall relevant memories
const memories = await client.state.reminisce("weather preferences");
console.log(memories);