Memory Skills
WebAgents provides two layers of memory: short-term memory for conversation context, and platform memory for persistent storage with access control.
Short-Term Memory
ShortTermMemorySkill maintains conversation context within a session. It keeps a rolling window of recent messages and injects them into the LLM context automatically.
// Coming soon — track at https://github.com/robutlerai/webagents/issues
// `core/memory` is currently Python-only. In TypeScript, conversation
// state is managed by the runtime via `ContextStorageSkill` + the LLM
// providers' message history. See ../platform/memory.md for persistent
// storage which IS available in TypeScript.Configuration
| Parameter | Type | Default | Description |
|---|---|---|---|
max_messages | int | 50 | Maximum messages to retain in the rolling window |
Short-term memory is ephemeral — it exists only for the lifetime of the agent process. For persistent storage across sessions, use the platform Memory skill.
Persistent Memory (Platform)
The Memory Skill provides durable, UUID-based storage with access control, grants, full-text search, and encryption. It supports both portal-backed (PostgreSQL) and local (SQLite) backends.
Key capabilities:
- Store-based model — Data keyed by
(store_id, owner_id, namespace, key), with stores for agents, chats, and users. - Access grants — Share stores between agents at
search,read, orreadwritelevels. - Full-text search — PostgreSQL
tsvector(portal) or FTS5 (local). - In-context vs not-in-context — Control whether the LLM can see an entry.
- Encryption — Client-side encrypted entries stored as opaque blobs.
import { BaseAgent } from 'webagents';
import { RobutlerMemorySkill } from 'webagents/skills/storage';
const agent = new BaseAgent({
name: 'persistent-agent',
model: 'openai/gpt-4o',
skills: [
new RobutlerMemorySkill({ agentId: 'my-agent-uuid' }),
],
});See Memory Skill for the full reference — tool actions, access control cascade, store concepts, and configuration.
Choosing a Memory Strategy
| Need | Skill | Backend |
|---|---|---|
| Conversation context within a session | ShortTermMemorySkill (Python) | In-memory |
| Persistent key-value across sessions | MemorySkill / RobutlerMemorySkill | Portal (PostgreSQL) |
| Persistent key-value, self-hosted | LocalMemorySkill | SQLite |
| Cross-agent shared memory | MemorySkill with grants | Portal |
| Skill-internal secrets (API keys, tokens) | MemorySkill with in_context=false | Portal or SQLite |
Using Memory in Custom Skills
import { Skill, tool } from 'webagents';
import type { RobutlerMemorySkill } from 'webagents/skills/storage';
class NoteSkill extends Skill {
readonly name = 'notes';
@tool({ description: 'Save a note to persistent memory' })
async saveNote(params: { title: string; content: string }): Promise<string> {
const memory = this.agent!.skills.find(
(s) => s.name === 'memory',
) as RobutlerMemorySkill;
await memory.setInternal(this.agent!.name, params.title, params.content);
return `Saved: ${params.title}`;
}
@tool({ description: 'Search saved notes' })
async searchNotes(params: { query: string }): Promise<string> {
const memory = this.agent!.skills.find(
(s) => s.name === 'memory',
) as RobutlerMemorySkill;
const results = await memory.search(params.query);
return JSON.stringify(results);
}
}