에이전트 메모리 시작하기
이 문서에서는 에이전트 메모리 설치 및 사용자 컨텍스트 저장 및 검색을 비롯한 기본 메모리 작업 수행 과정을 안내합니다.
필수 조건
다음과 같은 작업을 수행할 수 있습니다.
- Oracle AI Database 액세스(Run Oracle AI Database Locally 참조)
- Python 3.10 이상
SDK 설치
에이전트 메모리를 설치하려면 다음을 실행합니다.
pip install "oracleagentmemory==26.4.0"
pip를 사용하여 설치하면 지원되는 플랫폼에서 사전 구축된 바이너리 휠이 풀링됩니다.
메모리 인스턴스 초기화
임베더, LLM 및 데이터베이스 접속을 구성하여 OracleAgentMemory 인스턴스를 생성합니다.
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)
메모리 항목 저장
스레드를 만들고, 메시지를 추가하고, 사용자에 대한 메모리 항목을 저장하는 것부터 시작합니다.
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.")
메모리 항목 검색
사용자 범위의 질의를 사용하여 메모리를 검색합니다.
results = memory.search(query="orange juice", scope=SearchScope(user_id="user_123"))
for result in results:
print(f"- [{result.record.record_type}] {result.content}")
출력:
-[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.
주: 표시된 출력은 그림입니다. 이후 버전은 추가 결과 유형, 필드 또는 순서를 반환할 수 있습니다.
모델 호환성
2026년 4월 현재 다음 LLM(Large Language Models) 및 임베딩 모델은 oracleagentmemory과 호환됩니다.
LLM
다음 LLM(대형 언어 모델)이 호환되는 것으로 확인되었습니다.
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/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
임베딩
다음 임베딩 모델이 호환되는 것으로 확인되었습니다.
호스트_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