Agentic-AI-Eval-Harness

Architecture — agent-eval-harness v0.2.1

Diagrams in diagrams/*.mmd (Mermaid, render natively on GitHub):

1. Layered view

CLI (cli/) ── pytest bridge (pytest_plugin.py) ── Web Dashboard (web/server.py)
  │
Operations & Commands: run / ablate / calibrate / repro / regression / compare / status / serve
  │
Runner (runner/)  ── Benchmark Registry (registry/)  ── Datasets (datasets/*.jsonl)
  │ per case: fresh Environment
Harness (harness/)  = Execution Environment
  ├─ ToolGateway (permissions, validation, limits, retries, fault injection)
  ├─ VerificationLayer (output/arg checks, retry orchestration)   [ablatable]
  ├─ ContextOptimizer (observation trimming/dedup)                 [ablatable]
  └─ ResourceGuards (steps, tool calls, wall clock, output/state bytes, network)
Agents (agents/)  = unit under test
  ├─ ModelBackend protocol  ── ScriptedModel (deterministic) | LiveBackends
  ├─ 5 pattern agents (ReAct, Plan-Execute, Supervisor, Swarm, Map-Reduce)
  └─ Adapters (LangGraph / OpenAI Agents SDK / CrewAI)
Evaluators (evaluators/)  = deterministic + llm_judge + trajectory
Metrics (metrics/)  →  Comparison (comparison/)  →  Regression engine (regression/)
Reporting (reporting/)  = Markdown + JSON + Web UI  ← Observability event stream (observability/)
Security (security/)  = policy, injection screen, redaction, network guard, audit
Deployment (infra/)  = Dockerfile (multi-stage, non-root) + docker-compose (runner/dashboard/status)

2. Execution flow per case (the core loop)

  1. Runner loads benchmark (registry) + dataset slice; validates.
  2. Environment constructed per case: limits + policy + ablation profile + fault schedule + fresh KV store + event recorder; network guard armed.
  3. Agent adapter runs inside the environment via RunContext (gateway + events + model backend + limits). Every decision/tool call/state change emits an event.
  4. Agent outcome -> AgentResult (trajectory, final answer, failure class).
  5. Evaluators run in isolation (exceptions -> EVALUATOR_ERROR, run continues).
  6. Verdict per case; metrics aggregate; run record + event log persisted (redacted).

3. Key contracts

4. Determinism & reproducibility design

5. Security architecture

Belt-and-suspenders: (a) tools are offline fixtures by construction; (b) tool allowlist + forbidden-arg guards at the gateway; (c) socket guard raises SecurityViolation if anything opens a network socket during a run; (d) injection screening flags adversarial text in tasks and tool outputs (audit-logged, never silently dropped); (e) secret redaction at export; (f) resource caps bound worst case; (g) audit JSONL; (h) production container runs as non-root user (UID 10001). Arbitrary user agent code is explicitly OUT of the sandbox threat boundary in v0.1 (documented in THREAT-MODEL.md §trust boundaries).

6. Extension points