-
Notifications
You must be signed in to change notification settings - Fork 2.3k
feat(cli): add adk graph command and --ascii-only option for DOT output #3425
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
Summary of ChangesHello @kamalraj23, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed! This pull request significantly enhances the Agent Development Kit's command-line interface by introducing a new "graph" command. This feature allows developers to generate visual representations of their agent structures, which is invaluable for debugging complex agent flows and creating clear documentation. It supports various output formats, including DOT, PNG, and SVG, and includes a specific option to ensure compatibility for DOT output on Windows systems. Highlights
Using Gemini Code AssistThe full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips. Invoking Gemini You can request assistance from Gemini at any point by creating a comment using either
Customization To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a Limitations & Feedback Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for Github and other Google products, sign up here. You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension. Footnotes
|
|
Response from ADK Triaging Agent Hello @kamalraj23, thank you for creating this PR! This PR is a new feature, could you please associate the github issue with this PR? If there is no existing issue, could you please create one? In addition, could you please provide a testing plan section in your PR to talk about how you will test? This information will help reviewers to review your PR more efficiently. Thanks! |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Code Review
This pull request introduces a new adk graph command to the CLI, which is a great feature for debugging and documentation. The implementation is solid, but I have a couple of suggestions to improve robustness and code clarity. Specifically, I recommend using pathlib for more reliable path manipulation and simplifying the logic for stripping non-ASCII characters.
Co-authored-by: gemini-code-assist[bot] <176961590+gemini-code-assist[bot]@users.noreply.github.com>
|
Hi @kamalraj23, Thank you for your work on this pull request. We appreciate the effort you've invested. |
Close issue #3426
This adds a small-but-useful CLI feature for agent debugging and docs.
adk graph <agent_dir> --format dot|png|svg [--out path]--ascii-only(DOT output only) to strip Unicode icons for Windows CMDUsage:
python -m google.adk.cli graph contributing\samples\hello_world --format dot --ascii-only --out graph.dot
python -m google.adk.cli graph contributing\samples\hello_world --format png --out hello.png (requires Graphviz)
Testing Plan
Environment:
Windows 10/11, Python 3.12 venv
Repo installed editable: pip install -e ".[test,eval,a2a]"
Optional for images: winget install Graphviz.Graphviz
DOT output (no Graphviz needed):
python -m google.adk.cli graph contributing\samples\hello_world --format dot --ascii-only --out graph.dot
Verify:
type graph.dot | more
Expect: strict digraph { ... hello_world_agent, roll_die, check_prime ... }
Without ascii-only (UTF-8 console), optional:
chcp 65001
set PYTHONIOENCODING=utf-8
python -m google.adk.cli graph contributing\samples\hello_world --format dot --out graph.dot
PNG/SVG (requires Graphviz):
python -m google.adk.cli graph contributing\samples\hello_world --format png --out hello.png
dir hello.png (file exists)
Negative test:
python -m google.adk.cli graph invalid\path --format dot
Expect a clear error about the path not existing.
No breaking changes:
adk run, adk web still work as before (unchanged).
Formatting:
python -m isort src tests contributing
python -m pyink --config pyproject.toml src tests contributing