0Pricing
AI Agents with LangChain & Autonomous Workflows · 강의

엔터티 및 요약 메모리 전략

원시 버퍼를 넘어 이름이 지정된 엔터티와 누적 요약을 추적하여, 토큰 예산을 폭발시키지 않고 긴 대화에서도 중요한 사실을 에이전트가 기억하도록 합니다.

엔터티 및 요약 메모리 전략은(는) CoddyKit의 무료 AI Agents with LangChain & Autonomous Workflows 강의입니다. 이것은 4개 중 4번째 강의입니다. 아래에서 전체 강의를 무료로 읽을 수 있으며, 내장 코드 에디터와 24/7 AI 튜터와 함께 브라우저에서 직접 실습할 수 있습니다. 이 강의는 AI Agents with LangChain & Autonomous Workflows 학습 경로의 일부이며, 진행 상황이 웹과 CoddyKit 앱에 동기화됩니다. AI Agents with LangChain & Autonomous Workflows 강의에는 총 4개의 강의가 포함되어 있습니다.

이 강의의 일부는 아직 번역되지 않았으며 영어로 표시됩니다.

Why Buffers Are Not Enough

A plain buffer stores every message verbatim. In long chats this quickly exceeds the model context window and wastes tokens on irrelevant chatter.

Two smarter strategies fix this: summary memory compresses the past, and entity memory tracks specific facts about people and things.

What Is Summary Memory?

Summary memory uses an LLM to keep a running, condensed summary of the conversation. Instead of replaying 50 turns, the agent reads a few sentences capturing the gist.

  • Keeps token usage roughly constant
  • Preserves long-term context
  • Loses fine-grained wording

ConversationSummaryMemory

LangChain's ConversationSummaryMemory calls the LLM after each turn to update the summary. You pass it the same model the agent uses.

from langchain.memory import ConversationSummaryMemory
from langchain_openai import ChatOpenAI

llm = ChatOpenAI(model='gpt-4o-mini')
memory = ConversationSummaryMemory(llm=llm)

Saving and Reading the Summary

As turns happen you save context; reading the variables returns the compressed history rather than raw turns.

memory.save_context(
    {'input': 'My name is Ana and I love hiking.'},
    {'output': 'Nice to meet you, Ana!'}
)
print(memory.load_memory_variables({}))

Summary Buffer: Best of Both

ConversationSummaryBufferMemory keeps recent turns verbatim AND summarizes older ones once a token limit is crossed. Recent context stays sharp while old context is compressed.

from langchain.memory import ConversationSummaryBufferMemory

memory = ConversationSummaryBufferMemory(
    llm=llm,
    max_token_limit=200
)

What Is Entity Memory?

Entity memory extracts named things — people, projects, places — and stores a fact sheet for each. When an entity reappears, the agent recalls exactly what it knows.

This is ideal for personal assistants that must remember user preferences.

ConversationEntityMemory

The entity memory uses the LLM to detect entities and maintain a per-entity store.

from langchain.memory import ConversationEntityMemory

memory = ConversationEntityMemory(llm=llm)
memory.save_context(
    {'input': 'Deepak is leading the Mars project.'},
    {'output': 'Got it.'}
)

Inspecting the Entity Store

Each entity accumulates facts. Asking about an entity loads only its relevant summary into the prompt.

vars = memory.load_memory_variables(
    {'input': 'What is Deepak working on?'}
)
print(vars['entities'])

Choosing a Strategy

Pick based on the use case:

  • Buffer: short, exact conversations
  • Summary: long chats where the gist matters
  • Summary Buffer: long chats needing recent precision
  • Entity: assistants tracking facts about specific subjects

Cost and Latency Trade-offs

Summary and entity memory make extra LLM calls on every turn to update their state. That adds cost and latency.

Use cheaper, faster models for the memory-update step than for the main agent reasoning when possible.

Combining Memories

For sophisticated agents you can combine memories with CombinedMemory, e.g. a summary for flow plus entity memory for facts. Just ensure their output keys do not collide.

from langchain.memory import CombinedMemory

memory = CombinedMemory(memories=[summary_mem, entity_mem])

Quick Check

Test your understanding of advanced memory strategies.

Recap

You learned memory strategies beyond raw buffers:

  • Summary memory compresses history with the LLM
  • Summary buffer keeps recent turns exact and summarizes the rest
  • Entity memory tracks facts about named subjects
  • Each adds LLM calls — balance cost vs. recall
  • Combine memories for richer agents

Choosing the right strategy keeps agents both knowledgeable and efficient.

자주 묻는 질문

“엔터티 및 요약 메모리 전략” 강의는 무료인가요?

네 — “엔터티 및 요약 메모리 전략” 전체 내용을 이 웹사이트에서 무료로 읽을 수 있습니다. 인터랙티브하게 실습하려면(내장 코드 에디터와 24/7 AI 튜터), CoddyKit PRO로 업그레이드하면 AI Agents with LangChain & Autonomous Workflows 강의 전체를 잠금 해제할 수 있습니다. AI Agents with LangChain & Autonomous Workflows 강의에는 총 4개의 강의가 포함되어 있습니다.

“엔터티 및 요약 메모리 전략”에서 뭘 배우나요?

원시 버퍼를 넘어 이름이 지정된 엔터티와 누적 요약을 추적하여, 토큰 예산을 폭발시키지 않고 긴 대화에서도 중요한 사실을 에이전트가 기억하도록 합니다. 브라우저에서 직접 실행하는 실습 코드로 AI Agents with LangChain & Autonomous Workflows을(를) 배우며, 24/7 AI 튜터가 강의를 진행하면서 질문에 답변해줍니다.

AI Agents with LangChain & Autonomous Workflows을(를) 시작하는 데 경험이 필요한가요?

사전 경험은 필요하지 않습니다. CoddyKit의 AI Agents with LangChain & Autonomous Workflows은(는) 초급자부터 고급 학습자까지를 위해 구성되어 있으므로, 여기서 시작하거나 처음부터 시작할 수 있으며 자신의 속도대로 진행할 수 있습니다. 이것은 4개 중 4번째 강의입니다.

“엔터티 및 요약 메모리 전략” 강의는 얼마나 걸리나요?

대부분의 CoddyKit 강의는 약 5~10분이 소요됩니다. 각 강의는 간결하고 인터랙티브하여 꾸준한 진행이 가능하며, 웹과 앱에서 중단한 부분부터 바로 시작할 수 있습니다.

이 AI Agents with LangChain & Autonomous Workflows 강의에서 코드를 작성하고 실행할 수 있나요?

네. 모든 AI Agents with LangChain & Autonomous Workflows 강의에는 내장 코드 에디터가 포함되어 있으므로, 브라우저에서 바로 실제 코드를 작성하고 실행한 후 즉시 AI 피드백을 받을 수 있습니다 — 로컬 설정이 필요 없습니다.

이 강의의 모든 강의

  1. 에이전트 메모리 개념
  2. 대화 버퍼 메모리
  3. 고급 메모리 솔루션
  4. 엔터티 및 요약 메모리 전략
← AI Agents with LangChain & Autonomous Workflows(으)로 돌아가기