SlideShare a Scribd company logo
4
Most read
5
Most read
10
Most read
Context Engineering for AI Agents
By - Tamanna
NextGen_Outlier 1
What is Context Engineering?
Definition: Designing the information ecosystem for AI agents to perform tasks effectively.
Unlike prompt engineering, it’s a systems-level approach.
Goal: Provide the right info, in the right format, at the right time.
Analogy: Like giving a chef the ingredients and recipe for a perfect dish.
NextGen_Outlier 2
Why is it Hard for AI Agents?
Limited Context Window: Finite token space (e.g., 8k, 32k tokens).
Dynamic Tasks: Multi-step workflows need different context per step.
Memory Management: Agents lack inherent memory, unlike humans.
Tool Overload: Selecting relevant tools without confusion.
Balancing Relevance: Too much or too little context causes issues.
NextGen_Outlier 3
Types of Context
Type Description
System Instructions Rules defining behavior (e.g., "Act as a support agent").
User Prompt Immediate task (e.g., "Draft an email").
Conversation History Past messages in the session.
Long-Term Memory User preferences or facts (e.g., "Prefers formal tone").
Retrieved Information External data via RAG or APIs.
Tool Responses Outputs from tools (e.g., "Free at 3 PM").
NextGen_Outlier 4
Types of Memory
Memory Type Description
Semantic General facts/preferences (e.g., "Favorite color: blue").
Episodic Specific past interactions (e.g., "Liked pasta recipe").
Procedural Task rules (e.g., "Check calendar before email").
Example: Storing "User prefers formal tone" as semantic memory.
NextGen_Outlier 5
Context Engineering Strategies
Write: Save context outside the window (e.g., scratchpad).
Select: Retrieve relevant data using RAG or embeddings.
Compress: Summarize history to fit token limits.
Isolate: Sandbox irrelevant data to avoid confusion.
Example: Summarize chat as "User discussed project X, prefers agile."
NextGen_Outlier 6
What is LangGraph?
A low-level framework for stateful AI agents.
Key Features:
Controllable workflows with nodes and edges.
Memory management (short/long-term).
Tool integration and human-in-the-loop support.
Ideal for context engineering due to fine-grained control.
NextGen_Outlier 7
LangGraph Workflow
Nodes: Tasks (e.g., fetch context, call LLM).
Edges: Flow between tasks.
State: Dynamic context (messages, memory).
Example Workflow:
User query → Fetch context → Call LLM → Store memory → Respond.
NextGen_Outlier 8
LangGraph Example: Email Agent
from langgraph.graph import StateGraph
from langchain_anthropic import ChatAnthropic
# Define state
class AgentState(TypedDict):
messages: list[AnyMessage]
preferences: dict
memory_summary: str
# Initialize LLM
llm = ChatAnthropic(model="claude-3-7-sonnet-latest")
# Nodes
def fetch_context_node(state: AgentState):
state["preferences"] = {"tone": "formal"}
return state
def llm_node(state: AgentState):
response = llm.invoke(state["messages"])
state["messages"].append(response)
return state
# Build graph
builder = StateGraph(AgentState)
builder.add_node("fetch_context", fetch_context_node)
builder.add_node("llm", llm_node)
builder.add_edge("fetch_context", "llm")
graph = builder.compile()
NextGen_Outlier 9
Getting Started with LangGraph
Install:
pip install langgraph langchain langchain-anthropic
Set API Key:
export ANTHROPIC_API_KEY="your-api-key"
Use LangMem for long-term memory (optional).
NextGen_Outlier 10
Practical Tips
Use RAG for efficient memory retrieval.
Summarize long histories to save tokens.
Namespace memories by user or app.
Reflect on feedback to improve procedural memory.
Test with small context windows first.
NextGen_Outlier 11
Conclusion
Context engineering is key to intelligent AI agents.
Manage context with Write, Select, Compress, Isolate.
Use LangGraph for controllable workflows.
Next Steps: Try LangGraph with your own agent project!
NextGen_Outlier 12
Thank You!!
NextGen_Outlier 13

More Related Content

PDF
Building Connected Agents: An Overview of Google's ADK and A2A Protocol
PDF
MemGPT: Introduction to Memory Augmented Chat
PDF
Customizing LLMs
PPT
A Practical Event Driven Model
PPT
Requirements presentation
PPTX
Agentic Automation Journey Series Day 2 – Prompt Engineering for UiPath Agents
PDF
Context Engineering vs. Prompt Engineering, A Comprehensive Guide.pdf
PDF
Designing for Concurrency
Building Connected Agents: An Overview of Google's ADK and A2A Protocol
MemGPT: Introduction to Memory Augmented Chat
Customizing LLMs
A Practical Event Driven Model
Requirements presentation
Agentic Automation Journey Series Day 2 – Prompt Engineering for UiPath Agents
Context Engineering vs. Prompt Engineering, A Comprehensive Guide.pdf
Designing for Concurrency

Similar to Context Engineering for AI Agents, approaches, memories.pdf (20)

PPT
Xml processing-by-asfak
PDF
Building data "Py-pelines"
PPTX
Akka Microservices Architecture And Design
PDF
Object- Relational Persistence in Smalltalk
PDF
A Programmatic View and Implementation of XML
PDF
Lambda Architecture and open source technology stack for real time big data
PPT
Lec1
PDF
"Chat with your private data using Llama3 and LLPhant in PHP", Enrico Zimuel
PPTX
Breaking down the AI magic of ChatGPT: A technologist's lens to its powerful ...
PPTX
Internship (7)gfytfyugiujhoiipobjhvyuhjkb jh
PPTX
Internship (7)szgsdgszdssagsagzsvszszvsvszfvsz
PPT
Introduction to database management system
PDF
MLFlow: Platform for Complete Machine Learning Lifecycle
PPT
PPTX
Unit 1
PPT
Database Management Systems (DBMS)
PPTX
XPDays Ukraine: Legacy
PDF
Kono.IntelCraft.Weekly.AI.LLM.Landscape.2024.02.28.pdf
Xml processing-by-asfak
Building data "Py-pelines"
Akka Microservices Architecture And Design
Object- Relational Persistence in Smalltalk
A Programmatic View and Implementation of XML
Lambda Architecture and open source technology stack for real time big data
Lec1
"Chat with your private data using Llama3 and LLPhant in PHP", Enrico Zimuel
Breaking down the AI magic of ChatGPT: A technologist's lens to its powerful ...
Internship (7)gfytfyugiujhoiipobjhvyuhjkb jh
Internship (7)szgsdgszdssagsagzsvszszvsvszfvsz
Introduction to database management system
MLFlow: Platform for Complete Machine Learning Lifecycle
Unit 1
Database Management Systems (DBMS)
XPDays Ukraine: Legacy
Kono.IntelCraft.Weekly.AI.LLM.Landscape.2024.02.28.pdf
Ad

More from Tamanna (13)

PDF
Building Production-Ready AI Agents with LangGraph.pdf
PDF
Web Scraping with Google Gemini 2.0 .pdf
PDF
How to Connect Your On-Premises Site to AWS Using Site-to-Site VPN.pdf
PDF
Choosing the Right Database for Indexing.pdf
PDF
Data Chunking Strategies for RAG in 2025.pdf
PDF
Simplifying Document Processing with Docling for AI Applications.pdf
PDF
The Best NVIDIA GPUs for LLM Inference in 2025.pdf
PDF
Optimizing Large Language Models with vLLM and Related Tools.pdf
PPTX
Building Powerful Agentic AI with Google ADK, MCP, RAG, and Ollama.pptx
PDF
NVIDIA Triton Inference Server, a game-changing platform for deploying AI mod...
PPTX
Understanding Large Language Model Hallucinations: Exploring Causes, Detectio...
PPTX
Understanding LLM Temperature: A comprehensive Guide
PDF
Knowledge based System
Building Production-Ready AI Agents with LangGraph.pdf
Web Scraping with Google Gemini 2.0 .pdf
How to Connect Your On-Premises Site to AWS Using Site-to-Site VPN.pdf
Choosing the Right Database for Indexing.pdf
Data Chunking Strategies for RAG in 2025.pdf
Simplifying Document Processing with Docling for AI Applications.pdf
The Best NVIDIA GPUs for LLM Inference in 2025.pdf
Optimizing Large Language Models with vLLM and Related Tools.pdf
Building Powerful Agentic AI with Google ADK, MCP, RAG, and Ollama.pptx
NVIDIA Triton Inference Server, a game-changing platform for deploying AI mod...
Understanding Large Language Model Hallucinations: Exploring Causes, Detectio...
Understanding LLM Temperature: A comprehensive Guide
Knowledge based System
Ad

Recently uploaded (20)

PPT
Predictive modeling basics in data cleaning process
PDF
annual-report-2024-2025 original latest.
PDF
168300704-gasification-ppt.pdfhghhhsjsjhsuxush
PDF
Data Engineering Interview Questions & Answers Cloud Data Stacks (AWS, Azure,...
PPTX
importance of Data-Visualization-in-Data-Science. for mba studnts
PDF
Introduction to Data Science and Data Analysis
PPT
ISS -ESG Data flows What is ESG and HowHow
PPTX
New ISO 27001_2022 standard and the changes
PPTX
mbdjdhjjodule 5-1 rhfhhfjtjjhafbrhfnfbbfnb
PDF
Capcut Pro Crack For PC Latest Version {Fully Unlocked 2025}
PPTX
modul_python (1).pptx for professional and student
PPTX
IBA_Chapter_11_Slides_Final_Accessible.pptx
PDF
Business Analytics and business intelligence.pdf
PPTX
Market Analysis -202507- Wind-Solar+Hybrid+Street+Lights+for+the+North+Amer...
PPTX
Qualitative Qantitative and Mixed Methods.pptx
PPTX
01_intro xxxxxxxxxxfffffffffffaaaaaaaaaaafg
PDF
Introduction to the R Programming Language
PPTX
Pilar Kemerdekaan dan Identi Bangsa.pptx
PDF
Optimise Shopper Experiences with a Strong Data Estate.pdf
DOCX
Factor Analysis Word Document Presentation
Predictive modeling basics in data cleaning process
annual-report-2024-2025 original latest.
168300704-gasification-ppt.pdfhghhhsjsjhsuxush
Data Engineering Interview Questions & Answers Cloud Data Stacks (AWS, Azure,...
importance of Data-Visualization-in-Data-Science. for mba studnts
Introduction to Data Science and Data Analysis
ISS -ESG Data flows What is ESG and HowHow
New ISO 27001_2022 standard and the changes
mbdjdhjjodule 5-1 rhfhhfjtjjhafbrhfnfbbfnb
Capcut Pro Crack For PC Latest Version {Fully Unlocked 2025}
modul_python (1).pptx for professional and student
IBA_Chapter_11_Slides_Final_Accessible.pptx
Business Analytics and business intelligence.pdf
Market Analysis -202507- Wind-Solar+Hybrid+Street+Lights+for+the+North+Amer...
Qualitative Qantitative and Mixed Methods.pptx
01_intro xxxxxxxxxxfffffffffffaaaaaaaaaaafg
Introduction to the R Programming Language
Pilar Kemerdekaan dan Identi Bangsa.pptx
Optimise Shopper Experiences with a Strong Data Estate.pdf
Factor Analysis Word Document Presentation

Context Engineering for AI Agents, approaches, memories.pdf

  • 1. Context Engineering for AI Agents By - Tamanna NextGen_Outlier 1
  • 2. What is Context Engineering? Definition: Designing the information ecosystem for AI agents to perform tasks effectively. Unlike prompt engineering, it’s a systems-level approach. Goal: Provide the right info, in the right format, at the right time. Analogy: Like giving a chef the ingredients and recipe for a perfect dish. NextGen_Outlier 2
  • 3. Why is it Hard for AI Agents? Limited Context Window: Finite token space (e.g., 8k, 32k tokens). Dynamic Tasks: Multi-step workflows need different context per step. Memory Management: Agents lack inherent memory, unlike humans. Tool Overload: Selecting relevant tools without confusion. Balancing Relevance: Too much or too little context causes issues. NextGen_Outlier 3
  • 4. Types of Context Type Description System Instructions Rules defining behavior (e.g., "Act as a support agent"). User Prompt Immediate task (e.g., "Draft an email"). Conversation History Past messages in the session. Long-Term Memory User preferences or facts (e.g., "Prefers formal tone"). Retrieved Information External data via RAG or APIs. Tool Responses Outputs from tools (e.g., "Free at 3 PM"). NextGen_Outlier 4
  • 5. Types of Memory Memory Type Description Semantic General facts/preferences (e.g., "Favorite color: blue"). Episodic Specific past interactions (e.g., "Liked pasta recipe"). Procedural Task rules (e.g., "Check calendar before email"). Example: Storing "User prefers formal tone" as semantic memory. NextGen_Outlier 5
  • 6. Context Engineering Strategies Write: Save context outside the window (e.g., scratchpad). Select: Retrieve relevant data using RAG or embeddings. Compress: Summarize history to fit token limits. Isolate: Sandbox irrelevant data to avoid confusion. Example: Summarize chat as "User discussed project X, prefers agile." NextGen_Outlier 6
  • 7. What is LangGraph? A low-level framework for stateful AI agents. Key Features: Controllable workflows with nodes and edges. Memory management (short/long-term). Tool integration and human-in-the-loop support. Ideal for context engineering due to fine-grained control. NextGen_Outlier 7
  • 8. LangGraph Workflow Nodes: Tasks (e.g., fetch context, call LLM). Edges: Flow between tasks. State: Dynamic context (messages, memory). Example Workflow: User query → Fetch context → Call LLM → Store memory → Respond. NextGen_Outlier 8
  • 9. LangGraph Example: Email Agent from langgraph.graph import StateGraph from langchain_anthropic import ChatAnthropic # Define state class AgentState(TypedDict): messages: list[AnyMessage] preferences: dict memory_summary: str # Initialize LLM llm = ChatAnthropic(model="claude-3-7-sonnet-latest") # Nodes def fetch_context_node(state: AgentState): state["preferences"] = {"tone": "formal"} return state def llm_node(state: AgentState): response = llm.invoke(state["messages"]) state["messages"].append(response) return state # Build graph builder = StateGraph(AgentState) builder.add_node("fetch_context", fetch_context_node) builder.add_node("llm", llm_node) builder.add_edge("fetch_context", "llm") graph = builder.compile() NextGen_Outlier 9
  • 10. Getting Started with LangGraph Install: pip install langgraph langchain langchain-anthropic Set API Key: export ANTHROPIC_API_KEY="your-api-key" Use LangMem for long-term memory (optional). NextGen_Outlier 10
  • 11. Practical Tips Use RAG for efficient memory retrieval. Summarize long histories to save tokens. Namespace memories by user or app. Reflect on feedback to improve procedural memory. Test with small context windows first. NextGen_Outlier 11
  • 12. Conclusion Context engineering is key to intelligent AI agents. Manage context with Write, Select, Compress, Isolate. Use LangGraph for controllable workflows. Next Steps: Try LangGraph with your own agent project! NextGen_Outlier 12