This guide will walk you through setting up Slate and connecting your first agent.
Once logged in to the dashboard:
my-agent-memory).Your instance will be ready in a few seconds.
After your instance is created, you will see a connection card.
grpc.your-instance-id.slate.tryrice.com:80Slate provides SDKs for Node.js/TypeScript and Python.
npm install git+https://github.com/rice-ai-hq/slate.git#subdirectory=clients/node
pip install git+https://github.com/rice-ai-hq/slate.git#subdirectory=clients/python
import { CortexClient } from "slate-client";
const client = new CortexClient(
"grpc.your-instance-id.slate.tryrice.com:80",
"your-secret-token",
"my-session" // Optional run_id for session isolation
);
// Test connection with a simple focus operation
await client.focus("Hello, Slate!");
const items = await client.drift();
console.log("Connected! Items in Working Memory:", items.length);
from slate_client import CortexClient
client = CortexClient(
address="grpc.your-instance-id.slate.tryrice.com:80",
token="your-secret-token",
run_id="my-session" # Optional run_id for session isolation
)
# Test connection with a simple focus operation
client.focus("Hello, Slate!")
items = client.drift()
print(f"Connected! Items in Working Memory: {len(items.items)}")
Now that you are connected, you are ready to build!
Let's build a simple note-taking assistant that remembers what you tell it and learns from interactions. This example shows all four memory types in action.
Build an agent that can:
import { CortexClient } from "slate-client";
const client = new CortexClient(
"grpc.your-instance-id.slate.tryrice.com:80",
"your-token",
"travel-agent" // run_id for session isolation
);
// 1. WORKING MEMORY: Store current session context
await client.focus("User is planning a trip to Japan");
await client.focus("Budget is around $3000");
await client.focus("Interested in temples and food");
// Retrieve current context (sorted by relevance)
const context = await client.drift();
console.log("Current context:", context);
// 2. EPISODIC MEMORY: Learn from interactions
// Record a successful interaction
await client.commit(
"What should I pack for Japan in spring?", // Input
"Suggested layers, umbrella, comfortable walking shoes", // Outcome
{
action: "travel_advice",
reasoning: "Spring weather is variable, lots of walking expected"
}
);
// Later, recall similar past interactions
const pastAdvice = await client.reminisce("packing for Asia trip", 3);
console.log("Similar past advice:", pastAdvice);
// 3. Use past experience to improve responses
// The agent now knows what worked before
from slate_client import CortexClient
client = CortexClient(
address="grpc.your-instance-id.slate.tryrice.com:80",
token="your-token",
run_id="travel-agent" # run_id for session isolation
)
# 1. WORKING MEMORY: Store current session context
client.focus("User is planning a trip to Japan")
client.focus("Budget is around $3000")
client.focus("Interested in temples and food")
# Retrieve current context (sorted by relevance)
context = client.drift()
print("Current context:", context.items)
# 2. EPISODIC MEMORY: Learn from interactions
# Record a successful interaction
client.commit(
"What should I pack for Japan in spring?", # input
"Suggested layers, umbrella, comfortable walking shoes", # outcome
action="travel_advice",
reasoning="Spring weather is variable, lots of walking expected"
)
# Later, recall similar past interactions
past_advice = client.reminisce("packing for Asia trip", limit=3)
print("Similar past advice:", past_advice.traces)
# 3. Use past experience to improve responses
# The agent now knows what worked before
drift(), it returned items sorted by relevance.reminisce(), it found similar past experiences using semantic search.Every cognitive agent follows this pattern:
User Input
↓
Recall past experiences (reminisce)
↓
Get current context (drift)
↓
Make decision (your LLM)
↓
Take action
↓
Learn from result (commit)
↓
Update context (focus)
That's it. This simple loop is the foundation of every learning agent you'll build with Rice.