Article Review - LangChain: The Anatomy of an Agent Harness

2026. 6. 20. 17:10·LLM AI Agent

Link: https://www.langchain.com/blog/the-anatomy-of-an-agent-harness
Author: Vivek Trivedy | March 10, 2026 

Core Concept

Agent = Model + Harness

Harness란 모델 자체를 제외한 모든 코드, 설정, 실행 로직을 말한다. Harness 없이는 raw model이 agent로 기능할 수 없다.

Harness에 포함되는 것들:

  • System prompts
  • Tools, skills, MCPs 및 그 descriptions
  • 번들된 인프라 (filesystem, sandbox, browser)
  • Orchestration 로직 (subagent spawning, handoffs, model routing)
  • 결정론적 실행을 위한 hooks 및 middleware

Model Limitations and Harness Solutions

모델이 단독으로 할 수 없는 것들:

  • 인터랙션 간 durable state 유지
  • 코드 자율 실행
  • 실시간 지식 접근
  • 환경 설정 및 패키지 설치

이러한 기능들은 harness 수준의 엔지니어링을 통해 구현된다.

Core Harness Components

Filesystems for Durable Storage

Filesystem은 "가장 근본적인 harness primitive"로 불린다. 다른 기능들을 unlock하는 역할을 하기 때문이다.

주요 역할:

  • 데이터/문서 읽기용 workspace 생성
  • 모든 것을 context에 담는 대신 점진적으로 정보를 offload
  • shared file을 통한 여러 agent 및 사람 간 협업 지원
  • Git 연동으로 version 추적, 오류 rollback, 실험 branching 가능

Bash and Code Execution

모든 가능한 행동에 대해 tool을 미리 설계하는 대신, harness는 bash 및 범용 코드 실행 권한을 제공한다. 이를 통해 agent가 사람이 모든 tool을 미리 정의하지 않아도 코드를 작성·실행하여 자율적으로 문제를 해결할 수 있다.

실행 패턴은 ReAct loop: reason → tool call로 action → 결과 observe → 반복.

Sandboxes and Safe Environments

Agent가 생성한 코드 실행은 본질적으로 위험하기 때문에 sandbox가 필요하다.

Sandbox가 제공하는 것:

  • 격리된 안전한 코드 실행 환경
  • 확장성을 위한 on-demand 환경 생성
  • 명령어 allow-listing 및 network isolation
  • 사전 구성된 tooling (언어 런타임, git, 테스트 도구, 브라우저)

이 환경들은 agent가 "애플리케이션 코드 작성 → 테스트 실행 → 로그 확인 → 오류 수정"의 self-verification loop를 가능하게 한다.

Memory and Continual Learning

Agent는 training data 너머의 지식에 접근해야 한다. Harness가 이를 지원하는 방식:

  • 시작 시 context에 주입되는 AGENTS.md 같은 memory file 표준
  • Agent가 이전 세션의 지식을 durably 저장
  • web search 및 MCP tools로 knowledge cutoff 이후의 최신 데이터 접근
  • 모델 weights를 수정할 수 없으므로, "지식 추가"의 메커니즘은 context injection

Context Management and Compaction

작업이 길어질수록 context window가 채워지면서 모델 성능이 저하되는 "Context Rot" 현상이 발생한다.

Harness의 대응 전략:

  • Compaction — 기존 context를 지능적으로 요약·offload하여 API 오류 없이 작업 계속
  • Tool call offloading — 대용량 tool output의 head/tail token만 유지하고 full output은 filesystem에 저장해 noise 감소
  • Skills (progressive disclosure) — 시작 시 너무 많은 tool을 로드해 성능이 저하되지 않도록 점진적으로 공개

"Harnesses today are largely delivery mechanisms for good context engineering."

Long-Horizon Autonomous Execution

장기간에 걸친 복잡한 작업에는 여러 harness 기능의 조합이 필요하다.

  • Filesystem & Git — 여러 context window에 걸쳐 작업을 durably 캡처하고, shared ledger를 통한 agent 협업
  • Ralph Loops — 모델이 종료를 시도할 때 이를 가로채어 원래 prompt를 clean context window에 재주입하고 목표 완료까지 강제로 계속하게 하는 harness 패턴
  • Planning & Self-Verification
    • 모델이 목표를 단계별로 분해
    • self-verification으로 작업 정확성 평가
    • 사전 정의된 test suite가 피드백 루프 제공
    • 검증이 solution을 test에 근거하게 하고 개선 신호를 생성

The Model-Harness Co-Evolution

Claude Code 같은 현대 agent 제품들은 모델과 harness를 모두 loop에 넣어 post-training을 진행한다. 이 피드백 사이클은:

  1. 유용한 primitive 발견 → harness에 추가
  2. 해당 harness 내에서 탁월하도록 모델 훈련
  3. 반복

그러나 이는 모델이 training harness에 "overfit"되는 부작용을 낳는다. tool 로직을 변경하면 모델 성능이 저하될 수 있다 (OpenAI Codex의 apply_patch tool이 그 예).

중요한 점: "특정 태스크에 최적인 harness가 모델이 post-training된 harness와 반드시 같지 않다." Opus 4.6이 Claude Code에서 보이는 성능과 다른 환경에서의 성능이 다른 것이 이를 보여준다. 즉, 모델 선택과 별개로 harness 최적화만으로도 상당한 성능 향상이 가능하다.

Future Directions

Absorption Into Models

모델이 발전하면서 일부 harness 기능이 base model에 흡수될 수 있다. planning, self-verification, long-horizon coherence 개선으로 context injection 의존도가 줄어들 것이다.

하지만 이것이 harness engineering을 무의미하게 만들지는 않는다. prompt engineering이 오늘날에도 여전히 가치 있듯이, harness engineering도 계속 유효하다. Harness는 단순히 모델의 결함을 패치하는 것을 넘어, 모델의 지능을 더 효과적으로 만드는 시스템을 엔지니어링한다. 잘 구성된 환경, 적절한 tools, durable state, verification loop는 어떤 모델에도 도움이 된다.

Active Research Areas

LangChain이 탐색 중인 것들:

  • 공유 코드베이스에서 수백 개의 병렬 agent 오케스트레이션
  • Agent가 자신의 trace를 분석하여 harness 수준의 실패 모드를 식별·수정
  • 모든 것을 사전 구성하는 대신 필요한 tools와 context를 just-in-time으로 조합하는 dynamic harness

Conclusion

"The model contains the intelligence and the harness is the system that makes that intelligence useful."

 

Harness 설계는 모델이 독립적으로 할 수 없는 것을 파악하고, 자율적이고 장기적인 agent 작업을 가능하게 하는 솔루션을 엔지니어링하는 것에서 시작된다.

'LLM AI Agent' 카테고리의 다른 글

Article review - Context Rot: How Increasing Input Tokens Impacts LLM Performance  (0) 2026.06.19
Claude Code - .claude/ 폴더 구조 정리  (0) 2026.06.15
Claude Code - CLAUDE.md와 skills/로 업무 자동화 예제  (0) 2026.06.15
LLM 출력에서 자주 보이는 <think> 태그  (0) 2026.05.31
LLM AI Agent toy project - #2 Tool call  (0) 2026.05.29
'LLM AI Agent' 카테고리의 다른 글
  • Article review - Context Rot: How Increasing Input Tokens Impacts LLM Performance
  • Claude Code - .claude/ 폴더 구조 정리
  • Claude Code - CLAUDE.md와 skills/로 업무 자동화 예제
  • LLM 출력에서 자주 보이는 <think> 태그
ybjeon.today
ybjeon.today
#Security #AI #LLM #일상 #공부 #연구, 프로필: https://ybjeon.today
  • ybjeon.today
    ybjeon's today
    ybjeon.today
  • 전체
    오늘
    어제
  • 링크

    • Github
    • Homepage
  • 블로그 메뉴

    • 전체 보기
    • Security
    • LLM AI Agent
    • AI Agent Security
    • Development
    • Tech News
    • 방명록
  • 태그

    Paper
    ai
    ToDo
    coding
    Agent
    development
    Security
    review
    llm
    NEWS
    article
    Development Lifecycle
  • 인기 글

    • 분류 전체보기 (23) N
      • Dev (6)
      • Security (2)
      • AI Agent Security (6)
      • LLM AI Agent (8) N
      • Tech News (1)
  • 공지사항

  • 최근 댓글

  • 최근 글

  • hELLO· Designed By정상우.v4.10.6
ybjeon.today
Article Review - LangChain: The Anatomy of an Agent Harness
상단으로

티스토리툴바