Python client library for Oracle AI Database Agent Memory
Project description
Oracle AI Agent Memory
Persistent memory for enterprise AI agents on Oracle AI Database.
Oracle AI Agent Memory helps agents retain context across interactions, compact active conversations, and retrieve durable user, agent, and thread memories when they matter. It is designed for Python applications that need persistent memory backed by Oracle AI Database.
Get Started
Install the package:
pip install oracleagentmemory
Do you need a local Oracle AI Database for development? See how to run Oracle AI Database locally: https://docs.oracle.com/en/database/oracle/agent-memory/26.4/agmea/run-locally.html
Create a memory client, store a short conversation, and search it back:
from oracleagentmemory.apis.searchscope import SearchScope
from oracleagentmemory.core import OracleAgentMemory
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)
messages = [
{
"role": "user",
"content": "Orange juice has become my favorite breakfast drink lately. What can I pair it with?",
},
{
"role": "assistant",
"content": "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.")
results = memory.search(query="orange juice", scope=SearchScope(user_id="user_123"))
for result in results:
print(f"- [{result.record.record_type}] {result.content}")
OracleAgentMemory uses your Oracle Database connection or pool as the persistence layer, your embedding model for retrieval, and an optional LLM for memory extraction, summaries, and context cards.
LongMemEval Results
| Benchmark | Score | Correct |
|---|---|---|
| LongMemEval | 94.4 | 472 / 500 |
| Knowledge Update | 94.0 | 73 / 78 |
| Multi-session Reasoning | 88.0 | 117 / 133 |
| Temporal Reasoning | 98.0 | 130 / 133 |
| Single-session User | 97.0 | 68 / 70 |
| Single-session Assistant | 100.0 | 56 / 56 |
| Preference | 93.0 | 28 / 30 |
Configuration note:
LongMemEval full 500-question evaluation. Answering with GPT-5.5 using xhigh reasoning effort. Mean answer LLM total tokens: 29,042; mean thinking tokens: 1,178.
Why Oracle AI Agent Memory?
Oracle AI Agent Memory is built for teams that want persistent agent memory on Oracle AI Database. It helps applications move beyond single-turn prompts by storing conversation history, durable memories, and prompt-ready short-term context in Oracle AI Database.
It gives agents a consistent way to:
- remember useful information across sessions;
- keep active threads compact and context-rich;
- retrieve memories by user, agent, and thread scope;
- use LLM-backed extraction when automatic memory formation is useful;
- write explicit memories when deterministic application control is preferred;
- integrate memory into existing Python agent applications.
Core Concepts
Threads
A thread represents an ongoing conversation or task. Threads can store user and assistant messages, return recent messages, and produce short-term context for an agent prompt.
thread = memory.create_thread(user_id="user_123")
thread.add_messages([
{"role": "user", "content": "Remember that I like morning meetings."},
{"role": "assistant", "content": "I will keep that in mind."},
])
Durable Memories
A durable memory is information intended to survive beyond the active thread. Applications can add durable memories directly.
thread.add_memory("The user prefers morning meetings.")
When an LLM is configured and memory extraction is enabled, Oracle AI Agent Memory can also extract durable memories from thread messages.
Search Scope
Search is scoped explicitly so applications can control which memories are eligible for retrieval.
results = memory.search(
query="When does the user prefer meetings?",
scope=SearchScope(user_id="user_123"),
)
Context Cards
For longer conversations, get_context_card() creates prompt-ready short-term context with a summary, relevant durable records, retrieval topics, and recent messages.
context = thread.get_context_card()
Use context cards when a model needs continuity without receiving the full conversation transcript.
Security and Deployment Notes
Oracle AI Agent Memory uses the database connection, model providers, credentials, and network configuration supplied by the integrating application. For production deployments:
- use encrypted database connections and secure model-provider endpoints;
- keep secrets out of source code and checked-in configuration;
- apply end-user authentication and authorization before memory operations;
- pass correct memory scope values for every request;
- bound message sizes, retrieval sizes, and provider usage for your workload;
- review LLM-backed extraction and summarization carefully before using them with sensitive data.
License
Oracle AI Agent Memory is dual-licensed under:
- Apache License 2.0
- Universal Permissive License (UPL) 1.0
You may choose either license.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distributions
Built Distributions
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file oracleagentmemory-26.4.0-cp314-none-any.whl.
File metadata
- Download URL: oracleagentmemory-26.4.0-cp314-none-any.whl
- Upload date:
- Size: 262.8 kB
- Tags: CPython 3.14
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.14.3
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
992fbfaa373da756a4449ff37a0e6286fe3a5dfb56ba19029825f5bf919129fa
|
|
| MD5 |
a67a89ada191f1c96fb5306c27bfd791
|
|
| BLAKE2b-256 |
8b1dbda24412cdcc1b64fa8f78737ed433300ff95b6d30877769e1bd734899e9
|
File details
Details for the file oracleagentmemory-26.4.0-cp313-none-any.whl.
File metadata
- Download URL: oracleagentmemory-26.4.0-cp313-none-any.whl
- Upload date:
- Size: 239.0 kB
- Tags: CPython 3.13
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.14.3
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
c77f20e57b9c9c2e3aba9e947d867ebe61f9838d58992dc0bd9b2adc9cd0a49c
|
|
| MD5 |
062ae43d2562a4e55353670f3ca370e9
|
|
| BLAKE2b-256 |
dd52fee39627371900960f899f2f8b9a467030b0736c740fd5e6f7949300cc2e
|
File details
Details for the file oracleagentmemory-26.4.0-cp312-none-any.whl.
File metadata
- Download URL: oracleagentmemory-26.4.0-cp312-none-any.whl
- Upload date:
- Size: 238.2 kB
- Tags: CPython 3.12
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.14.3
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
fafa2fd23055f8f292a670e881e3a039a161a84431eab89bb9e42bf6bb66477a
|
|
| MD5 |
0c05869cba9c71a3ec51afdd7c145650
|
|
| BLAKE2b-256 |
dd1a129910872cc44dfbb42609bf39b87fcdcc868c8d261d99ac1389d282eb94
|
File details
Details for the file oracleagentmemory-26.4.0-cp311-none-any.whl.
File metadata
- Download URL: oracleagentmemory-26.4.0-cp311-none-any.whl
- Upload date:
- Size: 247.4 kB
- Tags: CPython 3.11
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.14.3
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
da03c65358db34cabf5fc2a371d09b0a0864dfca99ad078e4acb1f42fb2d6257
|
|
| MD5 |
11fe2b81c935bbf4ba8d59aeb66f4f85
|
|
| BLAKE2b-256 |
db0c8d7009d2abfa5ae4c868e5888c14369932e94aa409c26be49f3ea6674263
|
File details
Details for the file oracleagentmemory-26.4.0-cp310-none-any.whl.
File metadata
- Download URL: oracleagentmemory-26.4.0-cp310-none-any.whl
- Upload date:
- Size: 175.2 kB
- Tags: CPython 3.10
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.14.3
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
817de49fddfa8d7f8c25e0af80d5114b245526fb933be792972cf52b94108886
|
|
| MD5 |
6aaba726ad64c93fa3b47829fef19e38
|
|
| BLAKE2b-256 |
5d7ecb98ac8832b309523dfc0bcdfc756ac56c42680612698f398cab741b5c88
|