Skip to content
Charan Kumar Reddy
AI & AgentsExperimental

Multi-Agent LLM Orchestration

PEVR engine: Planner, Executor, Verifier and Refiner agents over a validated task DAG

Planner-Executor-Verifier-Refiner (PEVR) engine that turns a multi-part request into a validated task DAG, runs it with LLM agents and checks every draft against rule-extracted facts no model can change; flagged drafts go through a bounded repair loop. Runs on Groq, Gemini or any OpenAI-compatible endpoint with retry and fallback, or offline with a deterministic mock.

injected faults caught by the Verifier, 0 false flags (offline mock)
20/20
benchmarks/results.json
verified pass rate, first draft to after repair
0.55 → 0.95
benchmarks/results.json

The problem

LLM-written technical summaries silently drop or alter given figures, break output formats and ignore instructions, and an LLM judge shares those failure modes.

The approach

Rule-extracted immutable anchors, a validated task DAG run in async waves, a deterministic Verifier that scores every draft and a bounded Refiner loop, behind a Groq/Gemini/OpenAI-compatible router with backoff and fallback.

Architecture

  1. 01

    Planner

    Extracts numbers, entities and machine-checkable constraints with rules into frozen anchors, asks the model for a task DAG, validates it (acyclic, at most 8 tasks, one synthesis node that reads every analysis task) and falls back to a clause-based DAG when the model's plan is invalid.

  2. 02

    Executor

    Runs the DAG in topological waves with asyncio, nodes in a wave concurrently, and requires a strict Pydantic JSON schema for every node output.

  3. 03

    Verifier

    Pure code: scores each draft 0 to 1 from anchor recall, schema validity, constraint checks and a penalty for figures that appear nowhere in the request, and lists each violation.

  4. 04

    Refiner

    Runs only on flagged drafts, receives the exact violations, is re-verified, and is bounded by max_retries; an unparseable repair never replaces a valid earlier draft.

  5. 05

    Provider router

    Groq, Gemini and OpenAI-compatible adapters with full-jitter exponential backoff on 429/5xx and timeouts, immediate fallback on non-retryable errors, and a seeded offline mock with fault injection.

Key decisions

  • Extracts anchors with rules rather than a model so the facts being checked cannot themselves be hallucinated.
  • Keeps the Verifier deterministic so the same draft always gets the same score and every failure names a specific anchor or rule.
  • Records the mock's injected faults as ground truth so the benchmark measures detection directly, which exposed a mock bug that hid faults in analysis nodes before the results were recorded.
  • Reports the one final answer that still fails after two repair rounds instead of tuning the fault rates or seed.

Results

  • Offline mock run: the Verifier flagged all 20 first drafts with an injected fault and no others; 18 of 20 flagged nodes were repaired within 2 rounds.
  • Final-answer verified pass rate rose from 0.55 to 0.95 and constraint satisfaction from 0.7 to 1.0 after repair.
Measured results and the files they come from
MetricValueSource
Injected faults caught by the Verifier (offline mock)20/20 · 0 false flagsbenchmarks/results.json
Verified pass rate, first draft → after repair0.55 → 0.95benchmarks/results.json
Anchor retention in final answers, first → final0.7802 → 0.989benchmarks/results.json

How it is tested

  • 38 pytest tests covering anchor extraction, DAG validation, verifier scoring, router retry and fallback, HTTP adapters against mocked Groq/Gemini responses, the engine end to end, the CLI and an eval smoke run; CI on Python 3.12 and 3.13.
  • 20-case benchmark (multi-step, anchor preservation, constraint following) with fault rates fixed before the first recorded run.

Limits, stated plainly

  • Recorded results use the offline mock and measure the detect-and-repair loop, not the quality of a real language model; a live run needs API keys.
  • The unsupported-number check also flags correctly derived figures, and entity extraction is capitalisation-based with author-labelled expected anchors.

Stack

PythonasyncioPydantichttpxGroqGeminipytestGitHub Actions