# Automated Experimentation Loops: The Autoresearch Pattern

Category: Agent Orchestration
Stack: Autoresearch, Pytest, Metric Logging

## Overview
Structuring autonomous trial-and-error loops where agents propose hypotheses, run benchmarks, and record parameter sweeps.

## The Problem
Human engineers spend hours manually adjusting hyper-parameters, prompt phrases, and regex patterns to optimize accuracy.

## Production Rule
Define an immutable evaluation function. Let the agent iterate over code variations, keeping only changes that score higher on the benchmark suite.

## Code / Specification
File: `autoresearch_loop.py`

```autonomous research
best_score = baseline_evaluation()

for iteration in range(max_trials):
    patch = agent.propose_improvement()
    apply_patch(patch)
    score = run_test_suite()
    
    if score > best_score:
        best_score = score
        git_commit(f"Improved benchmark to {score}")
    else:
        git_revert()
```
