How darwin-agent/harnessx works
HarnessX is an agent-harness framework and foundry: engineers compose reusable behavior around models, run agents through interchangeable entry points, and improve harnesses or models from run trajectories. The principal workflow is configure a model and harness, execute a task through the run loop and processors, invoke tools/providers, then capture results and traces. The repository also includes a visual Lab, an IM gateway, extensible plugins, and evolution recipes. Some subsystems are documented but unsampled; their links are shown only where README evidence supports them.
Main entry points: harness.py Harness · runloop.py Run loop · processor.py Processor pipeline · journal.py Trajectory journal
Components 22
Agent runtime
- Harness builder
harnessx/core/builder.py - Model configuration
harnessx/core/model_config.py - Harness
harnessx/core/harness.py - Run loop
harnessx/core/runloop.py - Events and state
harnessx/core/events.py - Model providers
harnessx/providers/litellm_provider.py - Trajectory journal
harnessx/tracing/journal.py
Harness capabilities
- Processor pipeline
harnessx/core/processor.py - Agent tools
harnessx/tools/builtin/bash.py - Workspace and skills
harnessx/workspace/workspace.py - Plugins and bundles
harnessx/plugins/loader.py - Memory processors
harnessx/processors/memory/memory_retrieval.py - Evaluation
harnessx/processors/evaluation/llm_judge.py
User interfaces
- CLI
harnessx/cli.py - Harness Lab UI
frontend/src/pages/BuilderPage.tsx - Lab API
harnessx/api/routes/run.py - IM Gateway
gateway/core/dispatch.py - Chat channels
gateway/channels/__init__.py
Evolution
- Harness evolution
harnessx/meta_harness/agent.py - Model evolution
recipe/verl_harnessX/main.py
Other components
- Developer
- Agent user
Connections 26
- Developer → CLI: configures
README.md - Developer → Harness Lab UI: composes
README.md - Agent user → CLI: submits task
README.md - Agent user → Chat channels: messages
README.md - CLI → Harness: runs task
harnessx/cli.py - Harness Lab UI → Lab API: configures and runs
- Lab API → Harness: builds and runs
harnessx/api/routes/run.py - Chat channels → IM Gateway: delivers messages
gateway/channels/__init__.py - IM Gateway → Harness: dispatches tasks
gateway/main.py - Harness builder → Harness: builds
harnessx/core/harness.py - Model configuration → Harness: creates agent
README.md - Harness → Run loop: executes
harnessx/core/harness.py - Harness → Processor pipeline: configures pipeline
harnessx/core/harness.py - Run loop → Processor pipeline: dispatches hooks
harnessx/core/processor.py - Run loop → Model providers: requests completions
- Run loop → Agent tools: executes tool calls
- Run loop → Events and state: updates run state
harnessx/core/harness.py - Processor pipeline → Memory processors: includes behavior
harnessx/processors/memory/memory_retrieval.py - Processor pipeline → Evaluation: includes behavior
harnessx/processors/evaluation/llm_judge.py - Processor pipeline → Plugins and bundles: extends via plugins
- Harness → Workspace and skills: configures workspace
harnessx/core/harness.py - Harness → Trajectory journal: records runs
harnessx/core/harness.py - Trajectory journal → Harness evolution: supplies trajectories
README.md - Trajectory journal → Model evolution: supplies reward trajectories
README.md - Harness evolution → Harness builder: searches configurations
- Model evolution → Model providers: fine-tunes model