0Pricing
AI Agents with LangChain & Autonomous Workflows · Ders

Varlık ve Özet Belleği Stratejileri

Ham arabelleklerin ötesine geçin: adlandırılmış varlıkları ve güncellenen özetleri izleyerek aracıların uzun konuşmalarda önemli gerçekleri hatırlamasını sağlayın; belirteç bütçesini de aşmayın.

Varlık ve Özet Belleği Stratejileri, CoddyKit'te ücretsiz bir AI Agents with LangChain & Autonomous Workflows dersidir. Bu, 4 dersinin 4. dersidir. Aşağıdan dersin tamamını ücretsiz okuyabilir, sonra tarayıcıda yerleşik kod editörü ve 7/24 yapay zeka koçu ile uygulamalı olarak pratik yapabilirsin. Bu, AI Agents with LangChain & Autonomous Workflows öğrenme yolunun bir parçasıdır ve ilerlemeniz web ve CoddyKit uygulaması arasında senkronize olur. AI Agents with LangChain & Autonomous Workflows kursu toplamda 4 dersten oluşur.

Bu dersin bazı bölümleri henüz çevrilmemiş olup İngilizce olarak gösterilmektedir.

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.

Sıkça Sorulan Sorular

“Varlık ve Özet Belleği Stratejileri” dersi ücretsiz mi?

Evet — “Varlık ve Özet Belleği Stratejileri” dersin tüm metni burada web'de ücretsiz olarak okunabilir. Etkileşimli olarak pratik yapmak (yerleşik kod editörü ve 7/24 yapay zeka koçu) ve AI Agents with LangChain & Autonomous Workflows kursunun geri kalanını açmak için CoddyKit PRO'ya yükselt. AI Agents with LangChain & Autonomous Workflows kursu toplamda 4 dersten oluşur.

“Varlık ve Özet Belleği Stratejileri” dersinde ne öğreneceğim?

Ham arabelleklerin ötesine geçin: adlandırılmış varlıkları ve güncellenen özetleri izleyerek aracıların uzun konuşmalarda önemli gerçekleri hatırlamasını sağlayın; belirteç bütçesini de aşmayın. AI Agents with LangChain & Autonomous Workflows ile uygulamalı kodu tarayıcıda doğrudan çalıştırarak pratik yaparsın ve 7/24 yapay zeka koçu dersi çalışırken sorularını yanıtlar.

AI Agents with LangChain & Autonomous Workflows öğrenmeye başlamak için deneyim gerekli mi?

Önceden deneyim gerekmez. CoddyKit'te AI Agents with LangChain & Autonomous Workflows, başlangıçtan ileri seviyeye kadar yapılandırıldığı için buradan başlayabilir veya başından başlayıp kendi hızında ilerleme yapabilirsin. Bu, 4 dersinin 4. dersidir.

“Varlık ve Özet Belleği Stratejileri” dersi ne kadar sürer?

Çoğu CoddyKit dersi yaklaşık 5–10 dakika sürer. Her biri kısa ve etkileşimli olduğu için sabit ilerleme yaparsın ve web ile uygulama arasında tam olarak bıraktığın yerden devam edebilirsin.

Bu AI Agents with LangChain & Autonomous Workflows dersinde kod yazıp çalıştırabilir miyim?

Evet. Her AI Agents with LangChain & Autonomous Workflows dersi yerleşik bir kod editörü içerir, bu sayede tarayıcıda gerçek kod yazıp çalıştırabilir ve anlık yapay zeka geri bildirimi alırsın — yerel kurulum gerekli değildir.

Bu kursun tüm dersleri

  1. Aracı Belleği Kavramları
  2. Konuşma Tampon Belleği
  3. Gelişmiş Bellek Çözümleri
  4. Varlık ve Özet Belleği Stratejileri
← AI Agents with LangChain & Autonomous Workflows Sayfasına Dön