Agent Tool Flowchart Builder
Design tool-call DAGs and intentional agent loops locally
Add node
Add edge
Examples
Intentional retry loop
validateFlowchart(defaultAgentToolFlowchart){ cycles: [["call_tool", "more"]], severity: "warning" }The call_tool → more loop is allowed because its edge carries maxIterations 3.
Mermaid shapes
toMermaid(defaultAgentToolFlowchart)"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
Model the nodes
Add start, tool (with toolName/params), decision, and end nodes with stable ids and labels.
Wire labeled edges
Connect the flow and give every decision exit a label; add maxIterations to intentional retry loops.
Validate the graph
Read validation for unreachable warnings, decision-exit errors, and cycle severity before publishing.
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.
Related guides
References & standards
Related tools
AI Agent Memory & Buffer Simulator
Compare sliding window, summary buffer, and vector memory strategies
AI API Client SDK Generator
Generate typed API client SDK files from OpenAPI specifications or cURL requests
AI Code Explainer
Explain code snippets with grounded cloud AI
AI Code Security Auditor
Scan source code for high-confidence OWASP Top 10 vulnerabilities
AI Code Translator
Translate code into idiomatic implementations in another language
AI Commit Message Generator
Suggest Conventional Commits messages from a git diff using on-device WebLLM