Threads

This page presents the concrete Oracle thread handle together with the developer-facing message helper type.

Oracle Thread

class oracleagentmemory.core.OracleThread

Bases: IThread

Thread backed by an Oracle store.

This implementation embeds and stores both thread messages and manually added memories, then supports similarity search over all stored records.

Notes

Create a new thread handle.

Examples

from oracleagentmemory.core import OracleAgentMemory
db_pool = ...
client = OracleAgentMemory(connection=db_pool, embedder=embedder)
thread = client.create_thread(
    thread_id="c1",
    llm=llm,
    enable_context_summary=True,
)
len(thread.add_messages([{"role": "user", "content": "I love pizza."}]))
1

method add_memory

Add a manual memory entry and index it.

Examples

thread.add_memory("Remember this preference", memory_id="mem-thread-docs")
'mem-thread-docs'

method add_messages

Add messages to the thread and index them.

Examples

len(thread.add_messages([{"role": "user", "content": "Thread message from docs"}]))
1

method add_messages_async (async)

Asynchronously add messages to the thread and index them.

method delete_memory

Delete a memory record from this exact thread by identifier.

Examples

thread.delete_memory("456")
0

method delete_message

Delete a message record from this exact thread by identifier.

Notes

Successful deletion clears derived thread-summary state so later summary and context-card calls rebuild from the remaining transcript. Derived memories are not deleted automatically because extracted memories do not currently persist per-message provenance.

Examples

thread.delete_message("123")
0

method get_context_card

Return an XML-like context card for the thread.

Prefer get_context_card_async when an LLM-backed implementation may perform remote network I/O.

Notes

This uses the thread’s default search scope with exact_thread_match=False, so relevant memories from other threads for the same user/agent may be included.

Examples

thread.add_memory("User likes pizza", memory_id="mem-context-docs")
'mem-context-docs'
len(thread.add_messages([{"role": "user", "content": "Tell me about pizza"}]))
1
"User likes pizza" in thread.get_context_card()
True

method get_context_card_async (async)

Asynchronously return an XML-like context card for the thread.

method get_messages

Return stored messages for this thread.

Examples

len(thread.add_messages([{"role": "user", "content": "Stored message example"}]))
1
messages = thread.get_messages()
messages[-1].content
'Stored message example'

method get_summary

Return a best-effort summary of the thread.

Prefer get_summary_async when an LLM-backed implementation may perform remote network I/O.

Examples

len(thread.add_messages([{"role": "assistant", "content": "Summary source message"}]))
1
summary = thread.get_summary()
len(summary) >= 1
True

method get_summary_async (async)

Asynchronously return a best-effort summary of the thread.

Messages

class oracleagentmemory.apis.thread.Message

Bases: object