Agent Memory

This page presents the concrete Oracle AI Agent Memory implementation.

Oracle Agent Memory

Note: OracleAgentMemory.delete_thread() is the supported path for thread-scoped cascading cleanup. It removes the thread together with associated messages, durable memories, and managed vector or chunk data. This is broader than OracleThread.delete_message(), which deletes only the raw message row.

class oracleagentmemory.core.OracleAgentMemory

Bases: IAgentMemory

Agent-memory client backed by Oracle DB or a caller-provided store.

Create a memory client.

Examples

from oracleagentmemory.core import OracleAgentMemory
client = OracleAgentMemory(
    connection=db_pool,
    embedder=embedder,
    llm=llm,
)
read_only_client = OracleAgentMemory(
    connection=db_pool,
    embedder=embedder,
    extract_memories=False,
)

method add_agent

Add an agent profile record to the store.

Notes

Agent profile records are stored in the client-level store and are intentionally unscoped. The returned record identifier is the same public identifier the application uses as agent_id.

Examples

from oracleagentmemory.core import OracleAgentMemory
client = OracleAgentMemory(
    connection=db_pool,
    embedder=embedder,
    llm=llm,
)
client.add_agent("a1", "Support assistant")
'a1'

method add_memory

Add a memory in the memory system, attributed to the indicated user, agent and thread.

Examples

from oracleagentmemory.core import OracleAgentMemory
client = OracleAgentMemory(
    connection=db_pool,
    embedder=embedder,
    llm=llm,
)
memory_id = client.add_memory("User likes pizza", memory_id="mem-1")
memory_id
'mem-1'

method add_user

Add a user profile record to the store.

Notes

User profile records are stored in the client-level store and are intentionally unscoped. The returned record identifier is the same public identifier the application uses as user_id.

Examples

from oracleagentmemory.core import OracleAgentMemory
client = OracleAgentMemory(
    connection=db_pool,
    embedder=embedder,
    llm=llm,
)
client.add_user("u1", "Prefers concise answers.")
'u1'

method create_thread

Create and register a thread.

Examples

from oracleagentmemory.core import OracleAgentMemory
client = OracleAgentMemory(
    connection=db_pool,
    embedder=embedder,
    llm=llm,
)
thread = client.create_thread(thread_id="c1", user_id="u1")
thread.thread_id
'c1'

method delete_agent

Delete an agent profile record by identifier.

Notes

Cascading deletes are planned and executed inside the backing store so the profile delete and all scoped child deletes happen in one store operation.

Examples

from oracleagentmemory.core import OracleAgentMemory
client = OracleAgentMemory(
    connection=db_pool,
    embedder=embedder,
    llm=llm,
)
client.add_agent("a-delete", "Support assistant")
'a-delete'
client.delete_agent("a-delete")
1

method delete_memory

Delete a memory-like record (e.g., a memory, fact, preference, or guideline) by identifier.

Examples

client = OracleAgentMemory(
    connection=db_pool,
    embedder=embedder,
    llm=llm,
)
memory_id = client.add_memory("Temporary memory", memory_id="mem-delete")
client.delete_memory(memory_id)
1

method delete_thread

Delete all records associated with a thread identifier.

Notes

Use this operation when you need retention-complete removal of a thread. The backing store deletes the thread together with associated thread-scoped messages, durable memories, and managed vector or chunk rows. This differs from OracleThread.delete_message(), which removes only the raw message record and does not cascade to derived memories created from that message.

Examples

from oracleagentmemory.core import OracleAgentMemory
client = OracleAgentMemory(
    connection=db_pool,
    embedder=embedder,
    llm=llm,
)
thread = client.create_thread(thread_id="c-delete")
client.delete_thread(thread.thread_id)
1

method delete_user

Delete a user profile record by identifier.

Notes

Cascading deletes are planned and executed inside the backing store so the profile delete and all scoped child deletes happen in one store operation.

Examples

from oracleagentmemory.core import OracleAgentMemory
client = OracleAgentMemory(
    connection=db_pool,
    embedder=embedder,
    llm=llm,
)
client.add_user("u-delete", "Prefers concise answers.")
'u-delete'
client.delete_user("u-delete")
1

method get_thread

Retrieve a previously created thread.

Notes

Explicit per-call overrides take precedence. When runtime overrides are omitted, reopened threads use persisted runtime config when available before falling back to SDK defaults.

Examples

from oracleagentmemory.core import OracleAgentMemory
client = OracleAgentMemory(
    connection=db_pool,
    embedder=embedder,
    llm=llm,
)
created = client.create_thread(thread_id="c1", user_id="u1")
loaded = client.get_thread("c1")
loaded.user_id
'u1'