Agent Harness Design: Parallel DAG Planning, Self-Verification Loops, KV-Cache Context Engineering, and E-Commerce System Design
Why sequential ReAct loops bottleneck on serial tool latency, how LLMCompiler-style DAG planners reduce critical-path latency from $\sum_i L_i$ to $\max_{\pi \in \text{Paths}(G)} \sum_{i \in \pi} L_i$, why intrinsic LLM self-correction fails without external deterministic verifiers, how append-only prefix stability preserves $92\%+$ KV-cache hit rates across multi-turn trajectories, and how to architect and evaluate a production shopping-assistant agent for OmniMart.
An LLM is only a conditional next-token distribution $p_\theta(y_t \mid x, y_{<t})$. Turning that distribution into a reliable, sub-second production system requires an agent harness: the surrounding orchestration runtime that compiles user requests into parallel execution graphs, verifies intermediate tool outputs against deterministic constraints, manages working context without invalidating GPU KV-cache prefixes, and persists long-term user preferences across sessions.
Two chapters on production agent harness design
Compare sequential ReAct against Plan-and-Solve and parallel DAG compilation (LLMCompiler), formalize why self-refine loops require external symbolic/programmatic verifiers to avoid reward-hacked drift, engineer KV-cache-preserving context windows via append-only logs and stale tool-observation masking, and separate episodic vector memory from structured semantic profile stores.
A complete end-to-end architecture and evaluation blueprint for a marketplace shopping assistant handling $50\text{M}$ SKUs at $<1.2\text{s}$ p95 latency: intent routing, parallel MCP tool execution (hybrid BM25 + CLIP HNSW retrieval, real-time inventory/pricing, user fit memory), deterministic groundedness verification, and a 4-layer offline + online evaluation framework.