DeepSeek Harness Under the Hood: An Agent Runtime Built on Event Sourcing and Plugin Trees
Most agent frameworks treat session history as a mutable chat array, which breaks on crashes and complicates tool-result attribution. DeepSeek Harness's append-only event log and deriveMessages() projection give developers a recoverable, auditable execution trace—and the plugin tree means every capability, from the LLM adapter to the sandbox, can be swapped without touching the agent loop.
The runtime centers on a ReactLoopAgent spine that drives a turn-step loop: user input enters an Inbox, a pre-step waterfall decides what the model sees, and each step streams a request through the LLM, executes tool calls, and appends every chunk and result to an append-only session log. That log is the system's event-sourced backbone—deriveMessages() projects the model's visible history from it, not from a separate message list, which makes sessions resumable, forkable, and replayable.
Capabilities like shell, file I/O, and MCP tools follow a three-role Capability Seam pattern: a Service definition, a pluggable Provider, and a Consumer that exposes the capability to the model as a tool. The Cordis framework wires everything together through a shared context (ctx) and a waterfall event chain, letting plugins intercept and rewrite agent pre-steps, tool execution, and request building.
Assembly is handled by Profiles, Bundles, and declarative patch files that insert or replace plugins in the tree, resolving conflicts through a bottom-up load order and top-down priority. The design trades simplicity for extreme configurability: swapping a local bash executor for a sandboxed one requires only a patch, not a rewrite of the tool protocol.
Making the session log the single source of truth—rather than a parallel message array—solves a class of bugs that plague agent frameworks: tool results attributed to the wrong turn, lost context on crash recovery, and unreplayable trajectories.
The Capability Seam pattern (Definition/Provider/Consumer) is a formalization of what many agent projects do ad-hoc; baking it into the framework means the model never needs to relearn tool names when the backend changes.
Waterfall events are the runtime's primary extension point, not hooks or callbacks. This turns every decision—what the model sees, whether a tool runs, how a request is built—into an overridable chain, which is powerful but demands discipline to avoid ordering surprises.
The Profile/Bundle/Patch assembly layer mirrors how Android and frontend ecosystems handle feature modules, suggesting agent runtimes are converging on the same composition patterns as application frameworks.
DeepSeek Harness optimizes for runtime architecture, not for a specific use case like coding or research; this makes it a building block rather than a product, and the cost is the conceptual overhead required to assemble a working Profile.