Overview
ThePlannerGeneratorEvaluator is a domain-agnostic three-agent orchestration harness inspired by the GAN-style architecture described in Anthropic’s harness design research. It coordinates long-running autonomous tasks from a short natural-language prompt, using an iterative generate-evaluate feedback loop to converge on high-quality output across any domain.
All three agents communicate through a single shared file on disk.
The harness follows this workflow:
- Planning: Planner expands a short prompt into an ambitious plan with steps and evaluation criteria
- Contract Negotiation: Generator proposes what “done” looks like for each step; Evaluator reviews
- Execution: Generator produces concrete output and self-assesses before handoff
- Evaluation: Evaluator scores output per-criterion with hard thresholds — any criterion below its threshold fails the step
- Feedback Loop: On failure, Generator receives scores + trajectory signal (refine or pivot) and retries
- All state on disk: The shared state file is the single append-only record of the entire run
Installation
Key Features
Attributes
str
default:"None"
Unique identifier for this harness instance. Auto-generated via
swarm_id() if not provided.str
default:"PlannerGeneratorEvaluator"
Human-readable name for this harness.
str
Description of the harness purpose.
str
default:"gpt-5.4"
Model identifier for all three agents
str
default:"None"
Override model for the Planner
str
default:"None"
Override model for the Generator
str
default:"None"
Override model for the Evaluator
int
default:"10"
Upper bound on plan steps to execute
int
default:"3"
Max evaluation failures before advancing
str
default:"os.getcwd()"
Directory where output is produced
Path for the shared state file (auto-generated if None)
Dict[str, float]
default:"{}"
Fallback score thresholds by criterion name
OutputType
default:"dict"
Format for output (dict, str, list, final, json, yaml)
bool
default:"False"
Enable verbose logging
str
default:"PLANNER_SYSTEM_PROMPT"
System prompt for the Planner agent. Defaults to the built-in planner prompt.
str
default:"GENERATOR_SYSTEM_PROMPT"
System prompt for the Generator agent. Defaults to the built-in generator prompt.
str
default:"EVALUATOR_SYSTEM_PROMPT"
System prompt for the Evaluator agent. Defaults to the built-in evaluator prompt.
Agent
default:"None"
Pre-configured Agent for planning
Agent
default:"None"
Pre-configured Agent for generation (e.g., with file/code tools)
Agent
default:"None"
Pre-configured Agent for evaluation (e.g., with Playwright MCP)
Methods
run()
Execute the full PGE harness pipeline from a short prompt to completed output.task(str): A short natural-language description of the desired task
output_type
After run() completes, access harness.last_result for structured metadata:
batched_run()
Run the harness on multiple tasks sequentially.tasks(List[str]): List of task prompts to process
get_harness_result()
Return the current state of the harness as a dictionary.id, name, shared_state_path, and conversation (the full conversation history as a dict)
Return Types
The PGE harness produces three structured return types that are also re-exported fromswarms.structs so you can type-annotate against them.
StepContract
A negotiated agreement between the Generator and the Evaluator for one step of the plan — the title and acceptance criteria the Generator commits to, plus anapproved flag and any amendments the Evaluator pushed back with.
int
required
1-indexed position in the plan.
str
default:"\"\""
Short step title.
str
default:"\"\""
What the Generator’s output must satisfy for the Evaluator to approve.
bool
default:"False"
Whether the Evaluator approved this contract.
str
default:"\"\""
Evaluator-suggested changes when not approved.
EvaluationReport
Per-step evaluation produced by the Evaluator agent — criterion scores, threshold checks, pass/fail, and feedback used to drive retries.int
required
Step this report belongs to.
Dict[str, float] | None
default:"None"
Map of criterion name to score, typically in
[0, 1].Dict[str, float] | None
default:"None"
Minimum scores needed to pass each criterion.
bool
default:"False"
Whether the step met every threshold.
str
default:"\"\""
Specific, retry-targeted feedback for the Generator.
str
default:"\"\""
Short prose summary of the evaluation.
str
default:"\"\""
Unparsed Evaluator output, retained for debugging.
HarnessResult
Final result container — populated afterrun() and accessible via harness.last_result.
str
default:"\"\""
Where the harness wrote artifacts (plan, logs, final output).
str
default:"\"\""
The full plan the harness executed against.
List[Dict[str, Any]] | None
default:"None"
Per-step structured log: which Generator/Evaluator turns ran, scores, retries.
float
default:"0.0"
Wall-clock seconds for the full run.
int
default:"0"
Number of steps that hit
passed=True.int
default:"0"
Total retries across all steps.
Usage Examples
Basic Usage
Custom Agents with Tools
Pass pre-configured agents with tools so the Generator can write files and the Evaluator can verify them on disk:Evaluator with Playwright MCP (Web App Testing)
For web application development, give the Evaluator browser automation via Playwright MCP so it can test the running app like a real user:Custom Thresholds
Provide default score thresholds that apply when the Planner doesn’t define them:Architecture Details
Shared State File
All inter-agent communication flows through a single append-only markdown file. Each section is timestamped and labeled:Refine vs. Pivot
When a step fails evaluation, the harness computes a score trajectory across retries:- Scores improving — REFINE: keep the current direction, fix specific issues
- Scores declining or stagnant — PIVOT: take a fundamentally different approach