---
title: "Improving Deep Agents with harness engineering"
description: "Changing only the harness around a fixed model (gpt-5.2-codex) raised deepagents-cli from 52.8% to 66.5% on Terminal Bench 2.0, moving it from outside the top 30 to the top 5."
url: "https://swe.quest/articles/improving-deep-agents-with-harness-engineering-33fb749a7cb2187c"
canonical: "https://www.langchain.com/blog/improving-deep-agents-with-harness-engineering"
source: "LangChain"
published: "2026-10-13"
difficulty: "medium"
kind: "Case study"
reading_minutes: 8
tags: ["ai-agents","ai-coding","evals","llms"]
---

# Improving Deep Agents with harness engineering

A post on [LangChain](https://swe.quest/sources/langchain.md), published 2026-10-13, 8 min read, Case study. Original: [https://www.langchain.com/blog/improving-deep-agents-with-harness-engineering](https://www.langchain.com/blog/improving-deep-agents-with-harness-engineering)

## Summary

Changing only the harness around a fixed model (gpt-5.2-codex) raised deepagents-cli from 52.8% to 66.5% on Terminal Bench 2.0, moving it from outside the top 30 to the top 5. The gains came from an automated trace-analysis loop over LangSmith traces and targeted changes to the system prompt and middleware. These included a pre-completion checklist that forces a verification pass, injected directory and tool context, time-budget warnings, and loop detection after repeated edits to the same file. A high-xhigh "reasoning sandwich" that spends more compute on planning and verification beat running at xhigh throughout, which scored 53.9% because of timeouts. Harnesses also need tailoring per model: Claude Opus 4.6 scored 59.6% on an earlier harness that had not been through the same improvement loop.

Written by swe.quest, not by the author.

**Difficulty:** Medium: assumes a working developer; shows how it is built or done

## Topics

- [AI agents](https://swe.quest/tags/ai-agents.md) (AI & ML)
- [AI for coding](https://swe.quest/tags/ai-coding.md) (AI & ML)
- [Evaluation](https://swe.quest/tags/evals.md) (AI & ML)
- [LLMs](https://swe.quest/tags/llms.md) (AI & ML)

## Prerequisites

- LLM coding agents ([easy posts on LLMs](https://swe.quest/tags/llms.md?difficulty=easy))
- agent tool calling
- prompt engineering

## Keywords

Terminal Bench 2.0, deepagents-cli, LangSmith, gpt-5.2-codex, Harbor, Daytona, LangChain

## Related posts

- [Open-source DeepResearch – Freeing our search agents](https://swe.quest/articles/open-source-deepresearch-freeing-our-search-agents-72a8cc1624888c05.md): Hugging Face · 2025-02-04 · Medium · 17 min read · AI agents, LLMs, Evaluation, Open source
  Hugging Face reproduced OpenAI's Deep Research agent in about 24 hours using the open smolagents framework and reached 55.15% on the GAIA validation set, up from roughly 46% for the previous open state of the art (Magentic-One).
- [Agent-driven development in Copilot Applied Science](https://swe.quest/articles/agent-driven-development-in-copilot-applied-science-57df9b7433878456.md): GitHub Engineering · 2026-03-31 · Medium · 9 min read · AI for coding, AI agents, Developer productivity, Evaluation, Testing
  A Copilot Applied Science researcher built eval-agents, a set of Copilot SDK-based agents that automate analysis of coding-agent trajectories from benchmarks like TerminalBench2 and SWEBench-Pro, and developed it primarily through coding agents.
- [Introducing harness adapters: adapt your favorite model to your harness to improve performance and cost](https://swe.quest/articles/introducing-harness-adapters-adapt-your-favorite-model-to-your-harness-to-8f64a783213a2586.md): Hugging Face · 2026-11-20 · Hard · 21 min read · Model training, AI agents, AI for coding, Evaluation, LLMs
  RL-training a LoRA adapter for a specific agent harness and task distribution makes a frozen base model both more accurate and cheaper: Qwen3.8-27B under the pi harness rises from 39% to 55% pass@1 on Terminal-Bench 2.1 while average token usage drops from 2.9K to 1.5K per task, mostly because the model reasons less and calls fewer tools.
- [How to build and maintain an agentic evaluation](https://swe.quest/articles/how-to-build-and-maintain-an-agentic-evaluation-c4d1ca50835658f2.md): Hugging Face · 2026-11-23 · Medium · 35 min read · Evaluation, AI agents, LLMs, Open source
  Agentic evaluations depend on far more than the model: task instructions, agent harness, environment, verifier and traces can each move a score, with harness changes alone shifting Terminal-Bench accuracy by up to 29.9 points.
- [The Most Common Questions About Agent Evals, Answered](https://swe.quest/articles/the-most-common-questions-about-agent-evals-answered-40ebbb294f8cf253.md): LangChain · 2026-10-15 · Medium · 15 min read · Evaluation, AI agents, Observability, LLMs
  Agent evals score agent runs to handle nondeterminism, multiple valid answers and variable execution paths: start by reading traces, pick one behavior, build a 10-20 example dataset from real traces, run a baseline experiment, and fold new failures back in.

Browse: [Latest posts](https://swe.quest/index.md) · [Topics](https://swe.quest/tags.md) · [Sources](https://swe.quest/sources.md) · [Topic map](https://swe.quest/map.md) · [Site guide (llms.txt)](https://swe.quest/llms.txt)
