Skip to main content

Documentation Index

Fetch the complete documentation index at: https://docs.litellm-agent-platform.ai/llms.txt

Use this file to discover all available pages before exploring further.

Memory is a per-agent key/value store of text notes that persist across sessions. At the start of each session, the harness reads all active memories for the agent and injects them into the working context so the agent doesn’t need to rediscover information it already knows. You can add memories manually via the API, or the agent can write them itself during a session.

Create a memory

curl -X POST https://your-lap-deployment/api/v1/managed_agents/agents/{agent_id}/memory \
  -H "Authorization: Bearer $MASTER_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "text": "Always use 2-space indentation in this codebase.",
    "tags": ["coding-conventions"],
    "type": "preference",
    "priority": 10
  }'

Memory fields

FieldTypeRequiredDescription
textstringYesThe note content injected into the agent’s context
tagsstring[]NoUp to 8 labels used for filtering (e.g. "coding-conventions", "security")
typestringNoFree-form category string (e.g. "preference", "fact")
priorityintegerNoHigher values surface first when memories are ranked at session start
source"agent" | "slack" | "ui"NoSet by the handler; defaults to "ui" for API callers
The response is an ApiMemory object:
{
  "id": "mem_01abc...",
  "agent_id": "agt_01abc...",
  "text": "Always use 2-space indentation in this codebase.",
  "tags": ["coding-conventions"],
  "type": "preference",
  "priority": 10,
  "disabled": false,
  "times_applied": 0,
  "last_applied_at": null,
  "source": "ui",
  "source_user_id": null,
  "source_session_id": null,
  "source_thread_ts": null,
  "created_at": "2024-01-15T10:00:00.000Z",
  "updated_at": "2024-01-15T10:00:00.000Z"
}

List memories

curl "https://your-lap-deployment/api/v1/managed_agents/agents/{agent_id}/memory" \
  -H "Authorization: Bearer $MASTER_KEY"
You can narrow results with query parameters:
ParameterDescription
qCase-insensitive substring search on text
tagFilter to memories whose tags array includes this value
# Search by text
curl "https://your-lap-deployment/api/v1/managed_agents/agents/{agent_id}/memory?q=indentation" \
  -H "Authorization: Bearer $MASTER_KEY"

# Filter by tag
curl "https://your-lap-deployment/api/v1/managed_agents/agents/{agent_id}/memory?tag=coding-conventions" \
  -H "Authorization: Bearer $MASTER_KEY"
Every GET request bumps times_applied and last_applied_at on the returned rows. This is intentional — the harness uses this endpoint for its search_memory tool, and the platform tracks usage to help you identify which memories the agent relies on most.

Update a memory

Use PATCH to update individual fields. Only the fields you include are changed:
curl -X PATCH \
  "https://your-lap-deployment/api/v1/managed_agents/agents/{agent_id}/memory/{memory_id}" \
  -H "Authorization: Bearer $MASTER_KEY" \
  -H "Content-Type: application/json" \
  -d '{ "text": "Always use 4-space indentation in this codebase." }'

Disable a memory

Set disabled: true to suppress a memory without deleting it. Disabled memories are hidden from prompt pre-load and search but kept in the database for audit purposes:
curl -X PATCH \
  "https://your-lap-deployment/api/v1/managed_agents/agents/{agent_id}/memory/{memory_id}" \
  -H "Authorization: Bearer $MASTER_KEY" \
  -H "Content-Type: application/json" \
  -d '{ "disabled": true }'
Re-enable it by setting "disabled": false.

Delete a memory

curl -X DELETE \
  "https://your-lap-deployment/api/v1/managed_agents/agents/{agent_id}/memory/{memory_id}" \
  -H "Authorization: Bearer $MASTER_KEY"
Returns 204 No Content. Hard-deletes the row permanently.
Prefer disabling a memory over deleting it. Disabled memories can be re-enabled and provide a history of what the agent has been told. Deleted memories are gone for good.

Memory sources

Memories can come from three sources:

ui

Created via the API or platform dashboard by a human operator. The default for API callers.

agent

Written by the agent itself during a session using the save_memory tool.

slack

Forwarded by the Slack integration when a message includes a remember: directive.

Example: adding coding conventions

BASE="https://your-lap-deployment"
KEY="$MASTER_KEY"
AGENT_ID="agt_01abc..."

# Add several memories for a coding agent
curl -s -X POST "$BASE/api/v1/managed_agents/agents/$AGENT_ID/memory" \
  -H "Authorization: Bearer $KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "text": "This repo uses TypeScript strict mode. All functions must have explicit return types.",
    "tags": ["typescript", "coding-conventions"],
    "type": "rule",
    "priority": 20
  }'

curl -s -X POST "$BASE/api/v1/managed_agents/agents/$AGENT_ID/memory" \
  -H "Authorization: Bearer $KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "text": "Tests live in __tests__/ next to the source file. Use vitest, not jest.",
    "tags": ["testing", "coding-conventions"],
    "type": "rule",
    "priority": 15
  }'

curl -s -X POST "$BASE/api/v1/managed_agents/agents/$AGENT_ID/memory" \
  -H "Authorization: Bearer $KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "text": "The main branch is protected. Always open a PR — never push directly.",
    "tags": ["git-workflow"],
    "type": "rule",
    "priority": 10
  }'
At the start of the next session, all three memories are injected into the agent’s context automatically.