Company conference · 50 minutes + discussion
Finding
the flow
Loops, graphs, and more reliable AI agents
What if following the process wasn't up to the agent?
The familiar problem
“Done.”
According to whom?
The agent says it checked the facts.
The check never ran.
The next step happens anyway.
The system needs to enforce the rules described in the prompt.
A process you can point at
The arrows are rules
↳ Check fails → revise the draft → check again
Nodes do work. Arrows are permitted transitions.
Guards decide whether an arrow can be taken.
Foundations: W3C state machines · LangGraph Graph API
What moves through the graph
The graph remembers facts
Work
Draft version: B
Order facts: current
Validation: failed
Control
Repair attempts: 1 of 3
Approved version: none
Next step: repair
The controller reads the recorded check result to establish whether the check ran.
The anatomy of one arrow
A transition is a small contract
| Transition contract | Required fact or outcome |
|---|---|
| Before · work identified | This draft and this recipient |
| Before · checks established | Validation passed for this version |
| Before · permission established | A person approved this version |
| After · action recorded | Store delivery outcome; unknown means reconcile |
The send service evaluates the guard when it executes the action.
Graph engineering
Put agents inside
established workflows
State machines and workflows already describe steps, conditions, and recovery. Now some of those steps contain an AI agent.
“Graph engineering” covers several approaches. This talk focuses on controlling the workflow around an agent.
Context: LangChain: 3 Years of Graph Engineering · Feng et al., 2026 survey preprint
The grilling sub-loop · conceptual work
Make the goal testable
Goal → questions → human decisions → recorded contract → review. Open questions return to questioning. Resolved gaps and human approval permit execution.
“Improve customer replies” → correct order facts, no unsupported delivery promises, approval before send.
People or agents can lead the questions. People decide intent and tradeoffs.
Proposed conceptual workflow, informed by dev-loops grilling.
Illustrative example · a customer reply
Check and approve
before sending
↳ Wrong order detail → repair the draft → validate again
The drafting agent has no direct send permission. The send service checks the approved version.
Customer reply · 1 / 3
Follow the happy path
Draft → validate: pass → person approves A → send A.
| Draft | A |
|---|---|
| Validation | pass for A |
| Approval | A |
| Next | send A |
The checks and approval refer to the same piece of work.
Customer reply · 2 / 3
A failed check sends it back
Validation fails → repair draft A into B → validate B again.
| Draft | A |
|---|---|
| Validation | wrong order date |
| Approval | none |
| Next | repair → B |
Useful feedback names the mismatch. A new draft starts with no passing evidence.
Customer reply · 3 / 3
Unknown takes another arrow
Unknown → recover facts. Restored → validate again. Budget exhausted → person.
| Order service | unavailable |
|---|---|
| Validation | unknown |
| Budget | 2 waits left |
| Next | recover facts |
An unavailable service leaves validation unknown. Recover the facts before deciding whether to send.
A developer run · changed acceptance criteria
Changed criteria require
fresh clearance
Criteria v1 → human-authorized change → criteria v2 → old clearance stale → review existing work against v2.
| Code | unchanged |
|---|---|
| Criteria | v1 → v2 |
| Clearance | v1: stale |
| Next | review against v2 |
Acceptance criteria define what the work must satisfy. Developer agents can propose changes; only a human can authorize them.
Fail closed
Advancement requires
evidence.
| Check result | Workflow response |
|---|---|
| Pass | Allow the next permitted step |
| Fail | Repair or reject |
| Unknown / check crashed | Block advancement; recover the evidence |
A broken check must never silently count as a pass.
Security principle: OWASP: Fail Securely.
Loops need an exit
“Try again” needs a reason
| What went wrong? | What happens next? |
|---|---|
| Temporary tool outage | Wait, then retry within a budget |
| Bad output | Repair with feedback, then recheck |
| Send timed out | Find out whether it sent before repeating |
| Attempts exhausted | Stop and hand over to a person |
After a failed check, repair and recheck against the same requirements.
Room to think
Define where the agent
can choose
The agent chooses how
Explore, investigate, draft, compare, revise.
The system decides whether
Checks passed? Action allowed? Budget left? Approval current?
A step can contain an agent. When a model selects an arrow, that decision remains a model judgment.
Anthropic: Building effective agents · LangChain: Graph Engineering
Another useful graph shape
Parallel work still needs a join
One version → fact check + policy check + recipient check → join all required results.
“Fan out” starts independent work. “Fan in” gathers the required outcomes before deciding.
The join has its own guard
Two passes and a missing check
| Required check | Outcome |
|---|---|
| Facts | Pass |
| Policy | Pass |
| Recipient | No result returned |
The join is blocked.
The join requires an accountable outcome for every required check.
A real example · dev-loops
Apply it to AI development
The work is a proposed software change. Its record carries the scope, checks, review findings, and approval.
↳ Findings return the change to repair and fresh checks
Simplified lifecycle; the outer router re-reads current state each cycle. Source: dev-loops public contract
dev-loops · the shared record
What does the router know?
| Plain-language question | Recorded field | Example |
|---|---|---|
| Which work? | target | Pull request 42 |
| Who owns it? | ownership | Copilot |
| Who should act now? | nextActor | Reviewer |
| Where is it? | status | Active |
| Is the action allowed? | authorization | Authorized |
Illustrative values; field names come from the public routing contract.
dev-loops · deterministic routing
One state, one next action
| Current facts | Router response |
|---|---|
| Blocked or not authorized | Stop |
| Waiting for an external result | Wait / watch |
| Reviewer should act next | Review / fix route |
| “Ready” but current approval evidence missing | Reconcile the evidence |
| Merge ready but not authorized | Wait for merge authorization |
Read current facts first. Apply the routing rules in a defined order.
dev-loops · a bounded handoff
Give the worker a job card
What to work on
Target and current step
Required context
One bounded next action
What counts as finished
Acceptance criteria
Required evidence
Stop and permission boundaries
The handoff envelope is derived from resolved state and settings. A fresh worker gets the same task contract.
The envelope guides the worker; separate runtime checks enforce protected actions.
dev-loops · outer control, inner work
A loop can contain another loop
Observe → resolve → bounded action → refresh → observe. A bounded action may contain a review ↔ repair loop.
The outer loop chooses the next job. Inner loops do that job within their limits.
dev-loops · the review / repair loop
A review round has an output contract
Bundle → required review lenses → validate coverage and results. Missing → blocked. Complete → judge → act list. Actionable work → fix → fresh bundle; no blocking work → eligible for next gate.
Coverage, result validity, and judge disposition are separate checks. Only actionable findings go to the fixer.
The UI design and review sub-loop
How this presentation was built
Author edits → browser renders → automated checks and visual review → findings → author repairs → fresh render and checks.
One agent authored the deck. The parent agent reviewed screenshots. The shared browser suite checked fit, accessibility, and navigation.
Actual findings from the first expanded draft
Visual review caught
errors in the graph
| Hidden edge labels | Shorten “draft ready” and “approved” |
|---|---|
| Wrong active route | Keep handover muted while budget remains |
| Crossed return line | Move the nested-loop callout off that path |
The fit tests passed. Visual review then found errors in what the arrows meant.
Turn the sub-loop into a reusable contract
Exit on evidence for the current render
| Rule | What it controls |
|---|---|
| Any edit → fresh render | Clearance requires screenshots of the current HTML |
| Checks + visual review complete | Every required result must be present |
| Actionable finding → author repair | Repeat the affected sub-loop, then recheck |
| Budget exhausted → human decision | A proposed rule for future runs; this run had no configured cap |
The outer workflow waits for this result, then refreshes. “Clean” means within the stated checks and review scope.
dev-loops · a failed check changes the route
Each revision needs
current evidence
| Observed state | Required response |
|---|---|
| Automated tests fail | Repair and rerun checks |
| A fix creates a new version | Get pre-approval evidence for that version |
| Required review evidence unavailable | Block the merge check |
The recorded evidence names the exact code revision: the “head SHA.”
Source: sanctioned merge wrapper and its pre-merge checks. Full code map in speaker notes.
dev-loops · external work continues
Waiting survives the conversation
A checkpoint helps the next session reattach and run fresh checks against current state.
Keep waiting while the recorded conditions hold. Reconcile changed or contradictory state.
dev-loops · evidence and authority
Publishing requires
separate authorization
The supported merge path checks prerequisites and refuses when they are missing.
Documented rules and optional hooks have gaps in their enforcement coverage.
dev-loops · the action boundary
The merge checks the actual version
| Moment | Observed revision | Result |
|---|---|---|
| Read candidate | A | Check its prerequisites |
| Read gate evidence | B, after a new push | Reject the mismatch |
| Matching evidence for A | A | Pin merge command to A |
| New push before merge | B | Version-pinned merge refuses |
The merge wrapper checks the version again when it acts.
Two illustrative branches through the sanctioned merge wrapper.
People, time and cost · proposed operating choices
People own the decisions
Set the terms
Goals, acceptance criteria, permissions and budgets.
Resolve ambiguity and exceptions. Improve the process.
Make approval usable
Show the proposed action, current evidence, open risks and alternatives.
Name an owner. Offer a reject path.
Approval queues and fatigue can turn review into rubber-stamping. Track human effort and waiting time.
Design recommendation. Pause/resume mechanism: LangGraph interrupts.
Measure a fixed set of tasks
Cost per accepted result
All task-set costs
÷ accepted results
Include the failed attempts
Models, tools, compute, retries and human time.
Account for building and maintaining the workflow.
Keep quality beside cost
Completion rate and defects found after acceptance.
Elapsed time, human minutes and expensive outliers.
Compare the same tasks and acceptance criteria. Report zero completions explicitly.
Proposed scorecard; evaluation basis: Anthropic agent evaluations.
Context has a cost and a purpose
Choose what the next worker needs
| Approach | Useful when | Cost or risk |
|---|---|---|
| Continue the conversation | Earlier reasoning still matters | Stale and irrelevant material accumulates |
| Fresh context per task | A bounded task can stand alone | Setup repeats; missing context must be recovered |
| Scoped handoff + artifacts | Work crosses a role or session | Summaries need care; retrieval takes time |
Prompt caching can reuse an identical prefix. Compare uncached input, cache writes, cache reads and output across every worker.
Context engineering · Prompt caching. Fresh context is not automatically cheaper.
Review design
Give each review a clear question
| Review shape | Tradeoff to test |
|---|---|
| One general reviewer | Less coordination; test whether it catches the relevant defects |
| Distinct review angles | Focused questions; duplicated reading and correlated mistakes |
| Grouped angles | Share material; keep each required question accountable |
Measure unique valid findings, missed defects, false alarms and human triage time. Deduplicate and resolve disagreements.
Documented example: Claude Code Review. dev-loops supports grouped review angles; task-based evaluation must establish their value.
Choose capability from task evidence
Match capability to the step
| Work | Candidate to evaluate |
|---|---|
| Exact rules and recorded facts | Ordinary code |
| Bounded extraction or classification | A lower-cost model that meets the task's bar |
| Difficult reasoning or higher risk | A stronger model, with the required checks |
Include routing mistakes and retries in the bill. A cheap failure plus an expensive retry can exceed a good first attempt.
Research: RouteLLM. dev-loops provides configurable role tiers; no savings estimate is claimed here.
Illustrative agent-facing tool result
Return the facts needed to act
| Field | Example result |
|---|---|
| Status / reason | unknown / order service timed out |
| Affected items | Reply B · delivery date unchecked |
| Allowed next action | Recover order facts; send remains blocked |
| Evidence reference | run-42/check-7 · full log available on demand |
| Completeness | Validation incomplete · log excerpt truncated |
Keep errors, missing results and truncation visible. Give the agent a way to retrieve the underlying evidence.
Design example informed by Anthropic: Writing effective tools. Evaluate the format for the task.
Proposed controller rule · spend, elapsed time, repair rounds
An exhausted budget pauses the work
Limit reached → preserve work and pause → human decision: extend the budget and recheck, authorize changed scope and re-evaluate clearance, or stop with work incomplete.
A limit cannot weaken acceptance criteria or mark unfinished work complete.
Retry limits: AWS Well-Architected. The spend and human-decision branches are proposed workflow design.
Your turn · two minutes
Which arrow is allowed?
| Snapshot | What should happen? |
|---|---|
| A · Draft ready; check timed out | Send, repair, or recover evidence? |
| B · Approved A; current draft is B | Send or obtain new clearance? |
| C · All checks pass; publish unauthorized | Publish or wait for authority? |
Ask a neighbor: what fact is missing, and who is allowed to supply it?
The guarded routes
A pause can be the correct result
| Snapshot | Allowed next step |
|---|---|
| A · Unknown check | Recover evidence within a budget |
| B · Changed draft | Validate and approve the current version |
| C · Missing authority | Wait for an authorized decision |
Advance when the required evidence and authority are present.
What this can promise
What do these
checks establish?
With the same validated state and rules, code can choose the same permitted next step.
The agent can still write a wrong answer. A check can miss it. The workflow itself can be wrong.
Passing a gate establishes what it tested. Rigid routes and wrong checks need maintenance.
Make reliability a question you can test
Test the wrong turns
| Deliberately introduce | Observe |
|---|---|
| A failed or missing check | Does advancement stop? |
| Changed work after approval | Does stale evidence get rejected? |
| A timeout after an action | Does recovery avoid duplicate effects? |
| The same task, many times | Success, escapes, handovers, time, cost |
Evaluation approach: Anthropic: Demystifying evals for AI agents.
Finding the flow
Make the next step
depend on evidence.
Draw one real process.
Mark what must be true before it advances.
Add the return paths—and the stops.
Let reliable results depend less on the agent following oh-so-sophisticated prompts.
Appendix · follow the sources
Further down the graph
Graphs and agents
- 3 Years of Graph Engineering — LangChain, 2026
- Graph Engineering in the Era of LLM Agents — survey preprint, 2026
- Building effective agents — Anthropic
- State-machine notation and semantics — W3C
Checks and recovery
- Fail Securely — OWASP
- Making retries safe — Amazon Builders’ Library
- Demystifying evals for AI agents — Anthropic, 2026
- dev-loops source snapshot — case study
Research checked 16 September 2026. Accompanying speaker notes include the full claim-to-source map, cost/context sources and limitations.