Repository navigation
feat: add agents workflow diagram to render an agent's workflow as a Mermaid flowchart - #177
Open
danieldutu wants to merge 1 commit into
Open
danieldutu wants to merge 1 commit into
danieldutu wants to merge 1 commit into
Conversation
…Mermaid flowchart Part of elevenlabs#170. The command reads a local agent config and prints the workflow as a Mermaid flowchart. It needs no API key and no network. The emitted classDef names carry a wf_ prefix (wf_start, wf_end, ...). Mermaid treats end as a flowchart keyword, so a class named end is unsafe across versions. The type table keeps the plain node type names.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
agents workflow diagram <config-path>prints theworkflowof a local agent config as a Mermaid flowchart.The config stores
workflow.nodesandworkflow.edgesas raw JSON, which is hard to review in a diff. Mermaid renders natively on GitHub, so the output can be pasted into amermaidcode fence in a PR or doc. The command reads the file only: no API key, no network.It reads the file as untyped JSON, so node types the CLI does not know yet still render.
Output rules:
start,end,say,tool,update_state,override_agent,standalone_agent,phone_number) has its ownclassDef. The emitted class names carry awf_prefix (wf_start,wf_end, …): Mermaid treatsendas a flowchart keyword, so a class namedendis unsafe across Mermaid versions. Node ids get the same treatment through ann_prefix.wf_otherclass.label, or itsconditiontext, cut at 40 characters. Unconditional edges have no label.workflowkey exits with a validation error.I edited
cli/elevenlabs/workflow/diagram.rsandcli/elevenlabs/workflow/mod.rsby hand; both are in.fernignore, so regeneration leaves them alone. The README section is also hand-written.Checks:
cargo test diagram(3 passed),rustfmt --checkon the touched file, andcargo clippywith no findings there.Not in this PR: the GitHub Action,
backward_conditionarrows and an agent-name argument from the #170 proposal. I can add them in a follow-up. If you prefer another command name thanagents workflow diagram, say so and I rename it.Part of #170.