Core Concepts

Slate

State and runtime context management for AI agents.

Slate is the state and runtime context management layer that sits between your AI agents and storage. It provides a cognitive memory architecture inspired by human cognition.


Memory Architecture

Slate provides four memory types:

Memory TypeInternal ModulePurpose
Working MemoryFluxContext buffer with time-decay attention
Episodic MemoryEchoesLong-term interaction history with vector search
Semantic MemoryNexusKnowledge graph and fact storage
Procedural MemoryReflexWASM runtime for executing agent skills

Installation

Node.js / TypeScript

npm install git+https://github.com/rice-ai-hq/slate.git#subdirectory=clients/node

Python

pip install git+https://github.com/rice-ai-hq/slate.git#subdirectory=clients/python

Connecting to Slate

Both clients use CortexClient to communicate with Slate. You need the server address and an optional auth token.

from slate_client import CortexClient

client = CortexClient(
    address="grpc.your-instance-id.slate.tryrice.com:80",
    token="your-auth-token",
    run_id="my-session"  # Optional, defaults to "default"
)

Working Memory (Flux)

Working Memory manages the agent's immediate context with dynamic decay and attention.

Key Characteristics:

  • Decay: Items decay over time if not accessed, simulating natural forgetting
  • Attention: Items are returned sorted by relevance (Attention Score)
  • High-Velocity: Optimized for rapid read/write cycles

API:

MethodDescription
focus(content)Push information into the agent's attention stream
drift()Retrieve current context sorted by relevance
# Add to working memory
response = client.focus("User is planning a trip to Japan")
print(f"Stored with ID: {response.id}")

client.focus("Budget is around $3000")

# Retrieve context (sorted by relevance)
response = client.drift()
for item in response.items:
    print(f"[{item.relevance:.2f}] {item.content}")

Episodic Memory (Echoes)

Episodic Memory stores the history of interactions as traces. Every action an agent takes can be committed for future learning.

Trace Structure:

ComponentDescription
InputWhat triggered the action
OutcomeThe result of the action
ActionWhat the agent decided to do
ReasoningWhy the agent made that decision

API:

MethodDescription
commit(input, outcome, ...)Record an experience as a trace
reminisce(query)Recall past experiences similar to the query
# Record an interaction
client.commit(
    "What should I pack for Japan?",  # input
    "Suggested layers, umbrella, walking shoes",  # outcome
    action="travel_advice",
    reasoning="Spring weather is variable"
)

# Recall similar past interactions (limit defaults to 5)
response = client.reminisce("packing for Asia trip", limit=3)
for trace in response.traces:
    print(f"Past: {trace.input} -> {trace.outcome}")

Procedural Memory (Reflex)

Procedural Memory executes compiled WebAssembly skills server-side with deterministic, sandboxed execution.

API:

MethodDescription
trigger(skill_name)Execute a server-side WASM skill
result = client.trigger("calculate_tax")

Semantic Memory (Nexus)

Semantic Memory stores invariant facts and knowledge. It maintains a knowledge graph with relationships between concepts.

Use Cases:

  • Product catalogs and specifications
  • Company policies and procedures
  • Domain-specific knowledge bases
  • Reference documentation

Run Separation

Slate supports multi-tenancy through the run_id mechanism. Each run is isolated and all operations are scoped to the current run.

Creating Isolated Sessions

# Each agent has its own memory space
agent1 = CortexClient(address="grpc.your-instance-id.slate.tryrice.com:80", run_id="agent-1")
agent2 = CortexClient(address="grpc.your-instance-id.slate.tryrice.com:80", run_id="agent-2")

# Data from agent1 won't appear in agent2's memory
agent1.focus("Secret info for agent 1")
agent2.drift()  # Returns empty

Shared Memory for Teams

# Multiple agents sharing the same memory
researcher = CortexClient(address="grpc.your-instance-id.slate.tryrice.com:80", run_id="research-team")
writer = CortexClient(address="grpc.your-instance-id.slate.tryrice.com:80", run_id="research-team")

# Both can read and write to the same memory space
researcher.focus("Found relevant paper on topic X")
writer.drift()  # Sees the researcher's context

Cleaning Up

# Delete all data for the current run
client.delete_run()

The Agent Loop

Every cognitive agent follows this pattern:

  1. Perceive: Receive user input
  2. Recall: reminisce(input) - Find similar past experiences
  3. Orient: drift() - Get current context
  4. Decide: Generate a plan using your LLM
  5. Act: Execute tool or generate response
  6. Learn: commit(input, outcome, ...) - Save the result
  7. Update: focus(new_state) - Update working memory
def agent_loop(user_input):
    # Recall past experiences
    past = client.reminisce(user_input, limit=3).traces
    
    # Get current context
    context = client.drift().items
    
    # Generate response with LLM
    response = llm.generate(
        input=user_input,
        context=context,
        examples=past
    )
    
    # Learn from this interaction
    client.commit(
        user_input,  # input
        response,  # outcome
        action="respond",
        reasoning="Generated based on context and past examples"
    )
    
    # Update context
    client.focus(f"User asked: {user_input}")
    client.focus(f"Agent responded: {response}")
    
    return response

Authentication

Slate supports token-based authentication. Get your auth token from the Slate Console.

client = CortexClient(address="grpc.your-instance-id.slate.tryrice.com:80", token="your-token")

Vector Store Backends

Slate supports multiple vector database backends for Episodic and Semantic memory:

ProviderConfiguration
Mock (In-Memory)Default, no config needed
QdrantSet QDRANT_URL
PineconeSet PINECONE_API_KEY and PINECONE_INDEX_HOST
ChromaDBSet CHROMA_URL
RiceDBSet RICEDB_URL

Slate on GitHub

Full source code and examples.