Building AI Agents: A Progressive Practice from Harness to LangGraph

A progressive agent-building path: start with deepagents, add context and middleware as needed, and use LangGraph only when necessary.
The article introduces a four-step agent-building method shared by a Twitter user, whose core idea is progressive enhancement rather than complex orchestration from the start. First, choose deepagents as the harness to quickly build a runnable prototype; second, inject skills and tools as needed rather than piling them on; third, use deepagents' powerful middleware to fine-tune the flow with lightweight customization; fourth, introduce LangGraph only when complex control flows are required. This path emphasizes moving from simple to complex and avoiding over-engineering.
In the field of AI agent development, balancing development efficiency with system control has always been a core challenge. A four-step agent-building method shared by a Twitter user—start with a harness, add context, fine-tune the harness, and introduce LangGraph workflows when necessary—offers developers a pragmatic and scalable path. This view emphasizes progressive enhancement rather than getting bogged down in complex workflow orchestration from the start.
Start with a Harness: Choosing deepagents
The first step in building an agent is choosing a suitable execution framework (harness). The user explicitly states a preference for deepagents, considering it a solid foundation. A harness is essentially the agent's runtime environment, responsible for handling model calls, tool execution, and state management.
Choosing a mature harness avoids reinventing the wheel. As a starting point, deepagents lets developers quickly build a runnable agent prototype without focusing on low-level details too early. This "get it running first" approach aligns with the principles of iterative development.
Distinguishing Harness from Agent Frameworks
In the context of agents, the term harness specifically refers to the execution loop that drives a large model to complete tasks. It typically includes prompt templates, tool-call parsers, message history management, and stop-condition evaluation. By contrast, LangChain, AutoGen, and similar projects fall more into the "framework" category, providing component libraries and abstraction layers. A harness is lighter and closer to the model API, letting developers fully control the input and output of each reasoning round. deepagents is exactly such a harness: it has built-in session state and tool scheduling but does not enforce a particular orchestration paradigm. Understanding this distinction helps determine when to switch harnesses and when to layer an orchestration layer (such as LangGraph) on top of the harness.
Add Context: Skills and Tools
With a basic harness in place, the next step is to inject domain context. This includes providing the agent with skills and tools so it can complete specific tasks. Skills define the operations the agent can perform, while tools extend the boundaries of its interaction with external systems.
The key at this stage is to add on demand rather than piling things on blindly. Developers should gradually introduce the necessary skills and tools based on actual task requirements, keeping the agent simple and maintainable.
Fine-Tune the Harness: The Power of Middleware
If adding context still doesn't meet the requirements, the next step is to fine-tune the harness itself. The user particularly emphasizes the middleware mechanism in deepagents, calling it "goated." Middleware allows developers to insert custom logic into the agent's execution flow—for example, modifying message handling, enhancing tool calls, or adjusting state transitions.
Fine-tuning through middleware enables customized behavior without breaking the existing architecture. This light-touch modification approach is more efficient than building from scratch and easier to maintain. For most scenarios, this step may already be sufficient.
Where Middleware Sits in the Agent Execution Flow
Middleware is typically mounted as hooks at key nodes of the harness, such as before model calls, before and after tool execution, and before messages are written to history. Developers can use this to dynamically inject system prompts, validate or rewrite tool inputs, maintain custom state across multiple tool calls, or even short-circuit certain steps to save tokens. Compared with directly forking the harness source code, the middleware pattern decouples customization logic from the core execution loop, resulting in fewer conflicts when upgrading the harness version. The deepagents middleware system supports chained composition, so multiple lightweight pieces of logic can be layered on demand without rewriting the entire flow at once.
Advanced: Building Workflows with LangGraph
Only when the above steps still cannot meet complex control-flow requirements should you consider using LangGraph to build workflows. LangGraph provides graph-based orchestration capabilities, suitable for scenarios requiring multiple steps, conditional branches, or loops. But the user positions it as a "when necessary" choice, implying that simpler solutions should be tried first.
This progressive strategy avoids over-engineering. Many agents only need the first two steps to meet their requirements, and the introduction of LangGraph should be based on actual bottlenecks rather than preemptive assumptions.
LangGraph's Graph Orchestration Model
LangGraph models the agent flow as a stateful graph: nodes represent computation steps (such as calling a model, executing a tool, or human review), edges represent conditional transitions, and global state is passed between nodes and can be read and written. This model is naturally suited to scenarios requiring loops (such as ReAct-style multi-round tool calls), branching (choosing different paths based on model output), or parallelism (calling multiple tools simultaneously). Compared with the linear loop built into a harness, LangGraph makes control flow explicit, which facilitates debugging and visualization, but it also introduces additional state-management overhead. Therefore, it is better suited to production-grade agents with complex flows and precise control boundaries than to rapid prototyping.
Conclusion
The agent-building path shared by the Twitter user emphasizes moving from simple to complex and enhancing on demand. Starting with the deepagents harness, adding context, fine-tuning with middleware, and finally introducing LangGraph when necessary—this flow provides developers with a clear decision framework. In today's increasingly rich AI agent toolchain, this pragmatic approach helps teams deliver quickly and iterate continuously.
One-line Summary
A progressive agent-building path: start with deepagents, add context and middleware as needed, and use LangGraph only when necessary.
Paragraph Summary
The article introduces a four-step agent-building method shared by a Twitter user, whose core idea is progressive enhancement rather than complex orchestration from the start. Step one: choose deepagents as the execution framework (harness) to quickly build a runnable prototype. Step two: inject context such as skills and tools, adding on demand rather than piling them on. Step three: use deepagents' powerful middleware mechanism to fine-tune the execution flow for lightweight customization. Step four: introduce LangGraph workflows only when complex control flows such as multiple steps, conditional branches, or loops are needed. This path emphasizes moving from simple to complex and deciding whether to upgrade based on actual bottlenecks, avoiding over-engineering and providing AI agent developers with a clear decision framework and a pragmatic delivery rhythm.
Related articles

Tencent WorkBuddy Hands-On: How AI Agents Crush Traditional Chat Assistants
WorkBuddy vs Doubao tested: how AI Agents directly operate computers to convert PPT to PDF, archive files and more. Analysis of WorkBuddy's low barrier, domestic ecosystem, pricing and plugin marketplace, plus AI Agent selection advice.

Azure Cross-Tenant Attack Chain: Root Cause Analysis of Five Paths
Binary Security analyzes five full cross-tenant compromise paths in Azure, trending 271 points on HN. This article interprets their shared root cause perspective and offers defense recommendations for cloud tenant isolation and reflections on responsibility boundaries.

Recreating a Real Bubble Tea Station in Isaac Sim: Script-Driven Unitree G1 Brews Tea
Developers recreated a real self-service tea station in NVIDIA Isaac Sim, using scripts to drive a Unitree G1 through a five-step tea-brewing process, exploring whether physics simulation can be a source of synthetic robot demonstration data and discussing contact stability and imitation learning.