Skip to main content
Memory is a persistent key-value store scoped per user and team. You store a fact once, and on an opted-in request ForceAI injects the caller’s memories as system context, so GPT, Claude, and Gemini all recall them without the client resending them every prompt. It is read-only at inference time: the model consumes memory; writing is done through the API or the dashboard
Upstream LiteLLM ships the memory store as CRUD only, with no consumer. ForceAI adds the injection hook, so this is the piece that makes an agent actually use memory

Manage memories

Open the dashboard Memory page to create, search, edit, and delete entries, or use the API. Each entry has a key, a value, optional metadata, and is scoped to the caller’s user and team:
Other operations: GET /v1/memory (list, with key_prefix search and pagination), GET /v1/memory/{key}, PUT /v1/memory/{key} (upsert), DELETE /v1/memory/{key}. A caller only sees its own user-scoped and team-scoped entries

Turn on injection for a request

Opt a request in with metadata.forceai_memory: true (or set FORCEAI_MEMORY_ENABLED on the gateway to make it the default):
With the memory above stored, the model answers “Chartreuse”; without opting in, it does not know. Add metadata.forceai_memory_prefix: "agent:sales" to inject only the memories under a key namespace

How selection works

The hook loads the caller’s user and team memories, newest first, and injects them as one system message for that turn. To keep the prompt bounded it takes a prefix within a count cap and a token budget, always keeping the newest memory. Selection is intentionally simple in this version; a relevance-ranked variant is a planned follow-up

See what a request used

Open the request in Logs and expand it. The Memory panel shows how many memories were available in scope, how many were injected, the token cost, and the exact keys the model received. The same is stamped into spend_logs_metadata.forceai_memory:

Scope and safety

Injection never crosses the user or team boundary; a request only ever sees memories the caller could see through the API. The hook fails open, so a store hiccup leaves the request untouched rather than blocking it, and it runs after the guardrail, so injected memory content is still policy-checked
Memory is injected as system context the model can read; do not store secrets you would not want a model to see in its prompt. Injection only happens on requests that opt in, so requests without metadata.forceai_memory are untouched