Self-checking agent loops
AI that checks its work and retries within limits.
We build agents that test outputs against defined criteria, use feedback to revise them, and escalate when checks fail or limits are reached.
Architecture
How a loop works
Set criteria
Every loop starts with a measurable definition of done.
Attempt
The agent writes code, extracts data or drafts content with the tools it is allowed.
Check
Automated tests, source checks and rubric-based reviews decide pass or fail. A fail sends the work back for revision; a pass finishes it.
A loop, not a blank cheque
- Token and time budgets
- Retry caps and stop rules
- Human review checkpoints
Where it fits
- Coding tasks gated by test suites
- Extraction re-checked against source
- Content scored against a rubric
- Long-running research agents
Technical depth
- Verification, not tool success
- BrowserHUB checks the actual URL after every navigation and writes written acceptance criteria before testing starts. A tool call that returns without error is never treated as proof that the feature works.
- Bounded repair
- The agent gets up to 3 repair attempts, then stops and files an honest report. A loop that cannot converge is escalated, not retried forever.
- Visibility
- Every action and screenshot streams to a live watcher pane (tmux), so an engineer can watch the AI test without taking over the browser.
- Guardrails by construction
- An org-only access gate (PreToolUse hook), typed passwords redacted from logs, a per-developer local browser and a full audit trail of every action.
- Tooling surface
- 16 browser tools (navigate, click/type/scroll, get_state, screenshot, extract_content, tabs and sessions), two skills (pre-flight-check, browserhub-verify) and SessionStart, PreToolUse and Pre/PostToolUse hooks.
- Measured against a baseline
- In a head-to-head benchmark against headless Playwright on the same task, token cost was about the same, because screenshots are the expense, not the tool. Playwright is faster (one call runs a whole flow); BrowserHUB wins on visibility and criteria-checked verification. Both are used, for different jobs.
Stack
- Claude Code
- Pytest
- Git worktrees