Skip to content

Conversation

@kamalraj23
Copy link

@kamalraj23 kamalraj23 commented Nov 6, 2025

Close issue #3426

This adds a small-but-useful CLI feature for agent debugging and docs.

  • New command: adk graph <agent_dir> --format dot|png|svg [--out path]
  • New flag: --ascii-only (DOT output only) to strip Unicode icons for Windows CMD

Usage:

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

@gemini-code-assist
Copy link

Summary of Changes

Hello @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

  • New CLI Command: "adk graph": Introduces a new command-line interface command "adk graph" to visualize agent structures, aiding in debugging and documentation.
  • Multiple Output Formats: The "adk graph" command supports outputting agent graphs in DOT (text), PNG, and SVG formats, providing flexibility for different use cases.
  • Windows Compatibility for DOT Output: Adds an "--ascii-only" flag for the "adk graph" command when outputting in DOT format, which strips non-ASCII characters to ensure compatibility with Windows command prompts that may not render Unicode correctly.
Using Gemini Code Assist

The 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 /gemini <command> or @gemini-code-assist <command>. Below is a summary of the supported commands on the current page.

Feature Command Description
Code Review /gemini review Performs a code review for the current pull request in its current state.
Pull Request Summary /gemini summary Provides a summary of the current pull request in its current state.
Comment @gemini-code-assist Responds in comments when explicitly tagged, both in pull request comments and review comments.
Help /gemini help Displays a list of available commands.

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 .gemini/ folder in the base of the repository. Detailed instructions can be found here.

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

  1. Review the Privacy Notices, Generative AI Prohibited Use Policy, Terms of Service, and learn how to configure Gemini Code Assist in GitHub here. Gemini can make mistakes, so double check it and use code with caution.

@adk-bot adk-bot added the tools [Component] This issue is related to tools label Nov 6, 2025
@adk-bot
Copy link
Collaborator

adk-bot commented Nov 6, 2025

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!

Copy link

@gemini-code-assist gemini-code-assist bot left a 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.

kamalraj23 and others added 2 commits November 6, 2025 18:25
Co-authored-by: gemini-code-assist[bot] <176961590+gemini-code-assist[bot]@users.noreply.github.com>
@ryanaiagent ryanaiagent self-assigned this Nov 6, 2025
@ryanaiagent
Copy link
Collaborator

Hi @kamalraj23, Thank you for your work on this pull request. We appreciate the effort you've invested.
It looks like the automated code formatting check failed. You can use autoformat.sh to fix it.

@ryanaiagent ryanaiagent added the request clarification [Status] The maintainer need clarification or more information from the author label Nov 7, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

request clarification [Status] The maintainer need clarification or more information from the author tools [Component] This issue is related to tools

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants