DevTools Logo

Agent Tool Flowchart Builder

Agent Tool Flowchart Builder

Design tool-call DAGs and intentional agent loops locally

Add node

Add edge

Model autonomous agent workflows as a directed graph: start, tool (with parameter templates), decision (two labeled exits), and end nodes. The builder validates reachability, requires decisions to have both exits, and distinguishes accidental cycles from intentional agent loops by requiring a max-iterations annotation on loop edges. The engine deterministically emits a Mermaid flowchart definition you can paste into documentation, plus validation findings that catch unreachable nodes, orphaned edges, and unbounded loops. Everything is computed locally — nothing about your agent design leaves your device.

Examples

Intentional retry loop

Input
validateFlowchart(defaultAgentToolFlowchart)
Output
{ cycles: [["call_tool", "more"]], severity: "warning" }

The call_tool → more loop is allowed because its edge carries maxIterations 3.

Mermaid shapes

Input
toMermaid(defaultAgentToolFlowchart)
Output
"flowchart TD\n  more{More work?}\n  ..."

Decisions render as {braces}, start/end as ((stadium)), and loop edges show max 3 iter.

About this tool

Agent Tool Flowchart Builder diagrams tool-calling loops with buildAgentToolFlowchart(model): nodes are start/tool/decision/end with labels plus optional toolName/params, edges carry optional labels and maxIterations, and the result bundles Mermaid source, a sorted nodeList, validation findings, and detected cycles. defaultAgentToolFlowchart ships a request → search-tool → decision loop with a labeled 3-iteration edge.

Validation is explicit: missing start/end nodes error, nodes unreachable from any start warn, decisions need at least two labeled outgoing edges, and every cycle either warns (an edge on the loop carries a positive maxIterations) or errors (no iteration bound). detectCycles canonicalizes rotations so the same loop reports identically every run.

Mermaid output is deterministic — nodes and edges sort by id, tool nodes render label · toolName · params, and loop edges append max N iter to the edge label — so the diagram diffs cleanly in version control.

How to use this tool

  1. Model the nodes

    Add start, tool (with toolName/params), decision, and end nodes with stable ids and labels.

  2. Wire labeled edges

    Connect the flow and give every decision exit a label; add maxIterations to intentional retry loops.

  3. Validate the graph

    Read validation for unreachable warnings, decision-exit errors, and cycle severity before publishing.

  4. Copy the Mermaid

    Paste the flowchart TD source into docs or the Mermaid live editor to render the diagram.

Use cases

Documenting agent loops

Publish a reviewable diagram of which tools run, where branches split, and how retries terminate.

Catching unbounded retries

Turn an unlabelled tool loop into a cycle error, then fix it with an explicit max-iteration bound.

Onboarding to an agent graph

Give new contributors the node list plus Mermaid source instead of tracing edge code by hand.

Common mistakes

Mistake:Leaving a retry loop unbounded.

Fix:Put a positive maxIterations on one loop edge — otherwise the cycle finding escalates to an error.

Mistake:Giving a decision one exit or blank labels.

Fix:Decisions need two or more labeled outgoing edges; add yes/no labels so the branch reads correctly.

Mistake:Orphaning helper nodes off the start path.

Fix:Every node must be reachable from a start node — connect or delete orphans to clear the warning.

Frequently asked questions

What does this tool do?

It diagrams agent tool loops with buildAgentToolFlowchart: start/tool/decision/end nodes, labeled edges with maxIterations, deterministic Mermaid output, plus validation findings and canonical cycle detection.

When is a loop allowed versus an error?

A loop with a positive maxIterations on one edge warns as intentional (the default call_tool → more loop). The same loop without the bound errors until you label it.

Is my diagram uploaded or stored?

No. Graph validation, cycle detection, and Mermaid rendering run fully client-side.

Why an unreachable or decision-exit finding?

Nodes off the start path warn as unreachable — connect or delete them. Decisions need two-plus labeled exits, so add yes/no labels to clear the error.

References & standards