본문 바로가기

코딩

Context Engineering

728x90
반응형

Context Engineering for Agents

Context Engineering for Agents

 

 

 

🧠 AI 에이전트를 위한 컨텍스트 엔지니어링 (Context Engineering)

✅ 1. 컨텍스트 엔지니어링이란?

Context Engineering은 에이전트가 효과적으로 판단하고 행동할 수 있도록 제한된 컨텍스트 윈도우에 정확하고 관련성 있는 정보를 넣는 기술입니다.

Karpathy는 이를 컴퓨터 시스템에 비유하여 LLM = CPU, Context Window = RAM으로 설명합니다.

🧰 2. 주요 용어

용어 설명
LLM GPT-4, Claude 등 대형 언어 모델
Context Window 모델이 한 번에 기억하고 처리할 수 있는 최대 토큰 수
Agent 도구 호출, 메모리, 계획 능력을 갖춘 자율 실행 시스템
Scratchpad 작업 중 임시로 저장하는 메모 공간
Memory 여러 세션에 걸쳐 기억되는 장기 메모리
RAG 검색 기반 지식 보강 생성 (Retrieval-Augmented Generation)
LangGraph LangChain 기반 에이전트 플로우 프레임워크

🧭 3. 4대 전략 (WSCI) 요약

① 📝 Write Context

  • Scratchpad: 세션 중 임시 기록
  • Memory: 장기 기억 저장소
  • 예시: Anthropic의 연구 계획 저장, LangGraph의 state 객체 활용

② 🔍 Select Context

  • 필요한 정보(지식, 툴, 과거 기록 등)만 선택하여 로딩
  • 유사도 검색 기반 Retrieval (Vector DB, Embedding)
  • 예시: Cloud 코드 작업 시 CLA 파일 자동 로딩

③ ✂️ Compress Context

  • 중요 정보만 요약(Summarization), 오래된 내용 제거(Trimming)
  • 예시: Claude의 자동 compact 기능, Sub-agent 간 정보 전달 요약

④ 📦 Isolate Context

  • 각 에이전트의 컨텍스트를 분리 (Multi-agent 구조)
  • 샌드박스 환경을 활용해 불필요한 정보 전달 차단
  • 예시: Anthropic 병렬 Agent, HuggingFace의 Code Sandbox

🧰 4. LangGraph에서의 활용

전략 LangGraph 지원
Write State 객체 활용하여 Scratchpad 및 Memory 저장
Select Long-term Memory + Embedding 기반 검색
Compress 노드 내부에서 요약 또는 트리밍 로직 삽입 가능
Isolate Multi-agent 구조 및 샌드박스 실행 환경 지원

📌 요약 정리

WSCI 전략:

  • Write: 외부 저장소에 정보 기록
  • Select: 적절한 정보만 컨텍스트에 로딩
  • Compress: 요약/정리로 컨텍스트 용량 최적화
  • Isolate: 독립된 컨텍스트 환경 분리 처리

LangGraph는 이러한 전략을 실행하기 위한 강력한 프레임워크로, 컨텍스트 엔지니어링을 위한 핵심 도구들을 제공합니다.

 

n8n vs MCP Server: What’s the Difference?

Category n8n MCP Server (Mission Control Platform)
Definition Open-source workflow automation tool Backend server platform for coordinating AI agents and multi-agent systems
Primary Use Case Automating workflows, API orchestration, data flow Agent management, state syncing, message relaying
Target Audience Non-developers, business automation users LLM developers, AI researchers, agent system engineers
Architecture Visual, node-based interface (drag and drop) Backend controller model (often SDK/code-based)
Example Features - Send email
- Connect to databases
- Post Slack alerts
- Store agent state
- Manage message queues
- Mediate tool calls
AI Integration Can integrate with AI, but not AI-focused Purpose-built for LLM-based AI agent control
Extensibility Wide range of prebuilt plugins (HTTP, Notion, etc.) Custom extensibility, some open-source plugin support
Popular Tools n8n.io LangGraph, CrewAI’s MCP Server, AutoGen

Summary

n8n is a general-purpose automation platform designed to visually connect various tools and services.
MCP (Mission Control Platform), on the other hand, is focused on orchestrating multiple AI agents — managing their communication, states, and interactions to accomplish more complex tasks collaboratively.

Note: If you're building multi-agent LLM applications, MCPs are essential for coordination and scalability.

728x90
반응형