autoagent-harness-engineering
```markdown
What this skill does
```markdown
---
name: autoagent-harness-engineering
description: Autonomous agent harness engineering using AutoAgent — meta-agent that iteratively builds, benchmarks, and improves AI agent harnesses overnight
triggers:
- set up autoagent for autonomous agent engineering
- run the meta-agent harness loop
- configure agent.py harness for benchmarking
- add benchmark tasks to autoagent
- iterate on agent harness with autoagent
- run harbor benchmark with autoagent
- how do I use autoagent to improve my agent
- set up autonomous harness engineering experiment
---
# AutoAgent Harness Engineering
> Skill by [ara.so](https://ara.so) — Daily 2026 Skills collection.
AutoAgent is an autonomous harness engineering framework. You give an AI agent a task, and it builds and iterates on an agent harness overnight — modifying system prompts, tools, agent configuration, and orchestration, then running benchmarks, checking scores, and keeping or discarding changes automatically. Think of it as autoresearch, but for agent engineering.
---
## Installation & Setup
### Requirements
- Docker (Desktop or Engine)
- Python 3.10+
- [uv](https://docs.astral.sh/uv/)
- Model provider credentials (e.g., `OPENAI_API_KEY`)
### Install
```bash
# Install uv
curl -LsSf https://astral.sh/uv/install.sh | sh
# Clone and install dependencies
git clone https://github.com/kevinrgu/autoagent
cd autoagent
uv sync
# Configure environment variables
cat > .env << 'EOF'
OPENAI_API_KEY=$OPENAI_API_KEY
# Add other provider keys as needed
EOF
# Build the base Docker image
docker build -f Dockerfile.base -t autoagent-base .
```
---
## Project Structure
```
autoagent/
├── agent.py # Single-file harness under test (primary edit surface)
├── program.md # Meta-agent instructions + directive (human edits this)
├── Dockerfile.base # Base Docker image for task containers
├── tasks/ # Benchmark tasks in Harbor format
│ └── my-task/
│ ├── task.toml
│ ├── instruction.md
│ ├── tests/
│ │ ├── test.sh
│ │ └── test.py
│ ├── environment/
│ │ └── Dockerfile
│ └── files/
├── jobs/ # Harbor job outputs (auto-generated)
├── results.tsv # Experiment log (created by meta-agent, gitignored)
├── run.log # Latest run output
└── .agent/ # Optional workspace artifacts
```
---
## Key Concepts
### The Two Files You Actually Edit
1. **`program.md`** — Instructions for the meta-agent + the directive (what kind of agent to build). **You edit this.**
2. **`agent.py`** — The entire harness under test. Contains config, tool definitions, agent registry, routing/orchestration, and the Harbor adapter (fixed section). **The meta-agent edits this.**
### The Loop
```
meta-agent reads program.md
→ inspects current agent.py
→ runs benchmark
→ diagnoses failures
→ modifies agent.py (prompt, tools, config, orchestration)
→ runs benchmark again
→ keeps change if score improves, discards if not
→ repeats
```
---
## Running Benchmarks
### Run a Single Task
```bash
rm -rf jobs
mkdir -p jobs
uv run harbor run \
-p tasks/ \
--task-name "<task-name>" \
-l 1 \
-n 1 \
--agent-import-path agent:AutoAgent \
-o jobs \
--job-name latest > run.log 2>&1
```
### Run All Tasks in Parallel
```bash
rm -rf jobs
mkdir -p jobs
uv run harbor run \
-p tasks/ \
-n 100 \
--agent-import-path agent:AutoAgent \
-o jobs \
--job-name latest > run.log 2>&1
```
**Flags:**
| Flag | Description |
|---|---|
| `-p tasks/` | Path to tasks directory |
| `--task-name` | Run a specific named task |
| `-l 1` | Limit to 1 task |
| `-n <N>` | Concurrency (default 4, use 100 for max parallelism) |
| `--agent-import-path` | Python import path to your agent class |
| `-o jobs` | Output directory for job results |
| `--job-name` | Label for this run |
### Launching the Meta-Agent
Point any coding agent (Claude Code, Cursor, Codex, etc.) at the repo and say:
```
Read program.md and let's kick off a new experiment!
```
---
## Task Format (Harbor)
Tasks live in `tasks/` following the [Harbor task format](https://harborframework.com/docs/tasks).
### Minimal Task Structure
```
tasks/my-task/
├── task.toml # Config (timeouts, metadata)
├── instruction.md # Prompt sent to the agent
├── tests/
│ ├── test.sh # Entry point — writes /logs/reward.txt
│ └── test.py # Verification logic
├── environment/
│ └── Dockerfile # FROM autoagent-base
└── files/ # Reference files mounted into container
```
### `task.toml` Example
```toml
[task]
name = "my-task"
description = "A sample benchmark task"
timeout = 300
[task.metadata]
category = "reasoning"
difficulty = "medium"
```
### `instruction.md` Example
```markdown
You are given a dataset of customer reviews. Your task is to:
1. Classify each review as positive, negative, or neutral
2. Extract the main topic of each review
3. Output a JSON file at /output/results.json
The reviews are located at /files/reviews.csv
```
### `tests/test.sh` Example
```bash
#!/bin/bash
set -e
# Run verification and write score to /logs/reward.txt
python /tests/test.py
```
### `tests/test.py` Example
```python
import json
import os
EXPECTED_COUNT = 50
reward_path = "/logs/reward.txt"
output_path = "/output/results.json"
try:
with open(output_path) as f:
results = json.load(f)
# Score based on completeness and format
score = 0.0
if isinstance(results, list):
score += 0.3 # correct format
correct = sum(1 for r in results if "label" in r and "topic" in r)
score += 0.7 * (correct / EXPECTED_COUNT)
score = min(1.0, max(0.0, score))
except Exception as e:
score = 0.0
os.makedirs("/logs", exist_ok=True)
with open(reward_path, "w") as f:
f.write(str(score))
```
### `environment/Dockerfile` Example
```dockerfile
FROM autoagent-base
# Add any task-specific dependencies
RUN pip install pandas scikit-learn
# Copy reference files
COPY files/ /files/
```
---
## `agent.py` Structure
`agent.py` is the single-file harness. It has two sections:
### Editable Harness Section (meta-agent modifies this)
```python
# ── CONFIG ──────────────────────────────────────────────────────────────────
MODEL = "gpt-4o"
TEMPERATURE = 0.0
MAX_TOKENS = 4096
SYSTEM_PROMPT = """You are a helpful AI assistant..."""
# ── TOOL DEFINITIONS ─────────────────────────────────────────────────────────
TOOLS = [
{
"type": "function",
"function": {
"name": "read_file",
"description": "Read a file from the filesystem",
"parameters": {
"type": "object",
"properties": {
"path": {"type": "string", "description": "File path to read"}
},
"required": ["path"]
}
}
},
# ... more tools
]
# ── AGENT REGISTRY ───────────────────────────────────────────────────────────
AGENTS = {
"default": {
"model": MODEL,
"system_prompt": SYSTEM_PROMPT,
"tools": TOOLS,
"temperature": TEMPERATURE,
}
}
# ── ROUTING / ORCHESTRATION ──────────────────────────────────────────────────
def route(task: dict) -> str:
"""Return agent name based on task properties."""
return "default"
```
### Fixed Adapter Section (do NOT modify)
```python
# ── HARBOR ADAPTER (FIXED — DO NOT EDIT) ─────────────────────────────────────
class AutoAgent:
"""Harbor-compatible agent entry point."""
# ... Harbor integration + trajectory serialization
```
---
## `program.md` Template
```markdown
# Meta-Agent Program
## Context
This repo implements an autonomous harness engineering loop. The meta-agent
reads this file, inspects agent.py, runs benchmarks, modifies the harness,
and iterates to maximize benchmark score.
## Directive
Build an agent that can [DESCRIBE YOUR TASK HERE].
## Constraints
- Focus onRelated in Writing & Docs
jax-development
IncludedUse this skill when the user is writing, debugging, profiling, refactoring, reviewing, benchmarking, parallelising, exporting, or explaining JAX code, or when they mention JAX, jax.numpy, jit, grad, value_and_grad, vmap, scan, lax, random keys, pytrees, jax.Array, sharding, Mesh, PartitionSpec, NamedSharding, pmap, shard_map, Pallas, XLA, StableHLO, checkify, profiler, or the JAX repo. It helps turn NumPy or PyTorch-style code into pure functional JAX, fix tracer/control-flow/shape/PRNG bugs, remove recompiles and host-device syncs, choose transforms and sharding strategies, inspect jaxpr/lowering/IR, and benchmark compiled code correctly.
nature-article-writer
IncludedDrafts, rewrites, diagnostically critiques, and style-calibrates primary research manuscripts for Nature and Nature Portfolio journals. Use when the user wants a Nature-style title, summary paragraph or abstract, introduction, results, discussion, methods, figure legends, presubmission enquiry, cover letter, reviewer response, or when a scientific draft sounds generic, jargon-heavy, structurally weak, or AI-ish and needs precise, broad-reader-friendly prose without inventing data, analyses, or references. Best for primary research articles and letters rather than reviews or press releases unless explicitly adapting one.
deckrd
IncludedDocument-driven framework that derives requirements, specifications, implementation plans, and executable tasks from goals through structured AI dialogue. Use when user says "write requirements", "create spec", "plan implementation", "derive tasks", "structure this feature", "break down into tasks", or "document this module". Also use for reverse engineering existing code into docs (/deckrd rev). Do NOT use for direct code writing — use /deckrd-coder after tasks are generated. Do NOT use when the user only wants to run or fix existing code without planning.
clinical-decision-support
IncludedGenerate professional clinical decision support (CDS) documents for pharmaceutical and clinical research settings, including patient cohort analyses (biomarker-stratified with outcomes) and treatment recommendation reports (evidence-based guidelines with decision algorithms). Supports GRADE evidence grading, statistical analysis (hazard ratios, survival curves, waterfall plots), biomarker integration, and regulatory compliance. Outputs publication-ready LaTeX/PDF format optimized for drug development, clinical research, and evidence synthesis.
handling-sf-data
IncludedSalesforce data operations with 130-point scoring. Use this skill to create, update, delete, bulk import/export, generate test data, and clean up org records using sf CLI and anonymous Apex. TRIGGER when: user creates test data, performs bulk import/export, uses sf data CLI commands, needs data factory patterns for Apex tests, or needs to seed/clean records in a Salesforce org. DO NOT TRIGGER when: SOQL query writing only (use querying-soql), Apex test execution (use running-apex-tests), or metadata deployment (use deploying-metadata).
accelint-ac-to-playwright
IncludedConvert and validate acceptance criteria for Playwright test automation. Use when user asks to (1) review/evaluate/check if AC are ready for automation, (2) assess if AC can be converted as-is, (3) validate AC quality for Playwright, (4) turn AC into tests, (5) generate tests from acceptance criteria, (6) convert .md bullets or .feature Gherkin files to Playwright specs, (7) create test automation from requirements. Handles both bullet-style markdown and Gherkin syntax with JSON test plan generation and validation.