newsfilter.io
Conference Presentation

When to Build Your Own Agent Harness | Harrison Chase, LangChain

  • Core Framework for Agent Intelligence:

    • Agents are defined by three owned components: the model, the context, and the harness.
    • Ownership of the harness is prioritized as the primary mechanism for orchestrating the model and context.
    • The harness's fundamental role is to bring fixed and dynamic context to the model at the precise moment of generation.
    • The core architecture consists of an LLM running in a loop that generates text, calls tools if necessary, and feeds tool observations back into the model.
  • Harness Customization Strategies:

    • Middleware: Customization is achieved by inserting "middleware" constructs (hooks/plugins) into the base agent loop to modify behavior without altering the core architecture.
    • Pre- and Post-Call Modifications: Middleware allows for code execution or logic wrapping before model invocation, before each model call, and when wrapping tool calls.
    • Functional Extensions: Middleware enables access to sandboxes, file systems, sub-agents, memory systems, and summarization logic.
    • Summarization Logic: Context summarization is implemented as a middleware step that triggers when the context window approaches capacity.
    • Context Offloading: Large tool call results can be offloaded via middleware wrapping to preserve context window efficiency.
    • Cognitive Architectures: While general loops are standard, specific complex tasks (e.g., deep research, code review) may still utilize bespoke, multi-step cognitive architectures rather than simple loops.
  • Off-the-Shelf vs. Custom Harnesses:

    • Distribution Rule: Off-the-shelf harnesses (e.g., Cloud Code, Code Interpreter, Codex) perform best when the user's use case aligns with the distribution of the underlying model's training data.
    • Out-of-Distribution (OOD) Tasks: As tasks move further out of distribution, customizing the harness becomes necessary to maintain performance.
    • In-Distribution Optimization: Even for OOD tasks, harnesses should retain in-distribution components (e.g., using the specific "Edit File" tool optimized for a specific model) rather than rewriting them entirely.
    • Model Profiles: Langchain's "Deep Agents" utilizes model profiles to dynamically swap specific tools (like file editing) based on which model is active, ensuring tool compatibility.
  • Evaluations and Observability:

    • Strategic Importance: Satya Nadella's quotes emphasize creating private evals, retaining ownership of organizational memory/traces, and establishing a continuous learning loop to compound value.
    • Benchmark Standards: Industry standards for benchmarks are shifting toward "Harbor," an open-source eval runner created by the makers of Terminal Bench 2.
    • Harbor Task Structure: A Harbor task consists of an environment (often a Docker sandbox), a golden solution for sanity checks, test scripts (verifiers), and an instruction prompt.
    • Verifier Capabilities: Test scripts can execute code, run unit tests, employ LLMs as judges, or deploy other agents to score the primary agent's performance.
    • Multi-Dimensional Metrics: Evaluations track accuracy alongside latency, token consumption, and cost to provide a comprehensive performance view.
    • Observability Focus: Debugging often hinges on context quality rather than model capability; observability tools visualize the trajectory of messages, tool calls, and context accumulation.
    • Trajectory Analysis: Agent interactions are tracked as "trajectories" (human prompts, tool calls, model responses) to identify failure points in the logic flow.
  • The Continuous Improvement Flywheel:

    • Data Loop: The improvement process involves running agents, collecting traces, curating trace data, and running experiments to suggest fixes.
    • Feedback Sources: Feedback is gathered through user experience design (implicit feedback) and synthetic sources (fast/cheap SLMs or fine-tuned models acting as judges).
    • System Updates: Data from the flywheel can update the harness (harness engineering), the model (fine-tuning), or the context (memory augmentation).
    • LangSmith Engine: An automated agent within the platform that analyzes traces, identifies issues, and suggests fixes to prompts, instructions, or harness code.
    • Issue Boards: The Engine creates "issue boards" linking specific failures to supporting trace evidence and proposed code/prompt updates.
    • Benchmarking the Engine: An internal "Issue Bench" (Harbor-formatted) is used to benchmark the Engine itself against different models and harnesses.
    • Cross-Feature Learning: Lessons from external benchmarks (e.g., Codex's aggressive script generation) are integrated into core harnesses (e.g., "Codexification" of the Engine).
  • Market Trends and Future Outlook:

    • Convergence Hypothesis: General-purpose harnesses (Deep Agents, Codex, Cloud Code) are becoming sufficient for basic tasks due to improved model capabilities.
    • Divergence Drivers: Custom harnesses remain necessary for highly out-of-distribution tasks, domains requiring strict predictability (e.g., financial services), or specialized use cases (e.g., bio-agents).
    • Model vs. Harness Divergence: While model labs may converge on coding capabilities, harnesses may diverge based on specific domain requirements and unique tool optimizations (e.g., different file editing strategies by OpenAI vs. Anthropic).
    • Strategic Recommendation: Start with off-the-shelf harnesses for speed to value, then iterate toward custom middleware or cognitive architectures as use cases become more specialized.