Get Started with Agent Memory
This article guides you through installing Agent Memory and performing basic memory operations, including storing and retrieving user context.
Prerequisites
Ensure that you have:
- Access to the Oracle AI Database (see Run Oracle AI Database Locally)
- Python 3.10 or later
Install the SDK
To install Agent Memory, run:
pip install "oracleagentmemory==26.4.0"
Installing with pip pulls prebuilt binary wheels on supported platforms.
Initialize the Memory Instance
Create an OracleAgentMemory instance by configuring the embedder, LLM, and database connection.
from oracleagentmemory.core.oracleagentmemory import OracleAgentMemory
from oracleagentmemory.apis.searchscope import SearchScope
from oracleagentmemory.core.embedders.embedder import Embedder
from oracleagentmemory.core.llms.llm import Llm
embedder = Embedder(model="YOUR_EMBEDDING_MODEL")
llm = Llm(model="YOUR_LLM")
db_pool = ... #an oracledb connection or connection pool
memory = OracleAgentMemory(connection=db_pool, embedder=embedder, llm=llm)
Store Memory Entries
Start by creating a thread, adding messages, and storing a memory entry for the user.
messages = [
{
"role": "user",
"content": (
"Orange juice has become my favorite breakfast drink lately, "
"what can I pair it with?"
),
},
{
"role": "assistant",
"content": (
"Nice! Orange juice goes great with something savory. "
"Try eggs and toast, avocado toast, or a breakfast sandwich."
),
},
]
thread = memory.create_thread(user_id="user_123")
#add_messages will add messages to the DB and extract memories automatically
thread.add_messages(messages)
#add_memory adds memory to the DB
thread.add_memory("The user likes orange juice with breakfast.")
Retrieve Memory Entries
Search memories using a user-scoped query.
results = memory.search(query="orange juice", scope=SearchScope(user_id="user_123"))
for result in results:
print(f"- [{result.record.record_type}] {result.content}")
Output:
-[memory] The user likes orange juice with breakfast.
-[message] Orange juice has become my favorite breakfast drink lately, what can I pair it with?
-[message] Nice! Orange juice goes great with something savory.
Try eggs and toast,avocado toast, or a breakfast sandwich.
Note: The output shown is illustrative. Future versions may return additional result types, fields, or ordering.
Model Compatibility
As of April 2026, the following Large Language Models (LLMs) and Embedding Models are compatible
with oracleagentmemory.
LLMs
The following Large Language Models (LLMs) have been confirmed to be compatible.
vllm
openai/google/gemma-4-26B-A4B-itopenai/openai/gpt-oss-120b
oci
oci/google.gemini-2.5-flashoci/google.gemini-2.5-flash-liteoci/google.gemini-2.5-prooci/xai.grok-3oci/xai.grok-3-fastoci/xai.grok-3-minioci/xai.grok-3-mini-fastoci/xai.grok-4oci/xai.grok-4-1-fast-non-reasoningoci/xai.grok-4-1-fast-reasoningoci/xai.grok-4-fast-non-reasoningoci/xai.grok-4-fast-reasoningoci/xai.grok-4.20-non-reasoningoci/xai.grok-4.20-reasoningoci/xai.grok-code-fast-1oci/cohere.command-latestoci/cohere.command-a-03-2025oci/cohere.command-a-reasoning-08-2025oci/cohere.command-a-vision-07-2025oci/cohere.command-a-translate-08-2025oci/cohere.command-plus-latestoci/cohere.cohere.command-r-08-2024oci/cohere.command-r-plus-08-2024
gemini
gemini/gemini-3.1-flash-lite-previewgemini/gemini-3-flash-previewgemini/gemini-3.1-pro-preview
anthropic
anthropic/claude-opus-4-7anthropic/claude-opus-4-6anthropic/claude-sonnet-4-6anthropic/claude-haiku-4-5
openai
openai/gpt-4.1openai/gpt-4.1-miniopenai/gpt-4oopenai/gpt-5openai/gpt-5-miniopenai/gpt-5.1openai/gpt-5.2openai/gpt-5.4openai/gpt-5.4-mini
Embeddings
The following Embedding Models have been confirmed to be compatible.
hosted_vllm
hosted_vllm/Snowflake/snowflake-arctic-embed-l-v2.0
oci
oci/cohere.embed-english-v3.0oci/cohere.embed-english-light-v3.0oci/cohere.embed-multilingual-v3.0oci/cohere.embed-v4.0
gemini
gemini/gemini-embedding-001gemini/gemini-embedding-2-preview
openai
openai/text-embedding-3-largeopenai/text-embedding-3-small