AI Agents
Agent memory
Provider-agnostic memory store for agents — in-memory, D1, MongoDB-style adapters.
@fluxy-chat/agent includes a provider-agnostic memory API for long-running agents: save facts, search semantically, and inject context into prompts.
Quick start (in-memory)
import {
InMemoryMemoryStore,
createMemoryTools,
} from "@fluxy-chat/agent";
const store = new InMemoryMemoryStore();
const memoryTools = createMemoryTools({ store, defaultUserId: "user_123" });
// Tools: memory_save, memory_search, memory_list, memory_deleteStore interface
Implement AIMemoryStore for D1, MongoDB, Mem0, or Anthropic memory backends:
interface AIMemoryStore {
save(entry): Promise<AIMemoryEntry>;
search(query): Promise<AIMemoryEntry[]>;
get(id): Promise<AIMemoryEntry | null>;
list(options?): Promise<AIMemoryEntry[]>;
delete(id): Promise<boolean>;
clear(userId?): Promise<void>;
}Agent loop integration
Pass memory tools into your agent and let the model call memory_save / memory_search:
import { runAgentLoop } from "@fluxy-chat/agent";
await runAgentLoop({
model,
tools: { ...memoryTools, ...otherTools },
messages,
});