-
Notifications
You must be signed in to change notification settings - Fork 2.5k
feat: Add development mode with auto-reload (--dev flag) #3680
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 @notnotdurgesh, 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 developer experience for ADK agents by introducing a development mode with automatic agent reloading. Previously, developers had to manually restart their agents after every code or configuration change, leading to a slow and disruptive workflow. The new 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
|
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 --dev flag for adk run to enable an auto-reload development mode, which is a great enhancement for the developer experience. The implementation using watchdog is appropriate, and the feature is well-covered by new unit tests. My review includes a couple of minor suggestions to improve code maintainability and adhere to Python's standard style conventions.
- Extract duplicate logic into _handle_event helper method - Use tuple syntax for str.endswith() with multiple extensions - Move import os to module level following PEP 8
Link to Issue or Description of Change
Problem
Currently, when developing agents with ADK, developers need to manually restart the agent process every time they make changes to Python or YAML files. This creates a poor development experience, especially when iterating on agent logic, tools, or configuration. Developers have to stop the running agent, make code changes, restart the agent, and resume testing - a slow and disruptive workflow similar to how web developers had to manually restart servers before tools like
nodemonexisted.Solution
Add a
--devflag to theadk runcommand that enables development mode with automatic agent reloading. When enabled, the system monitors the agent directory for changes to.pyand.yamlfiles, automatically reloads the agent when files are modified or created, provides visual feedback when auto-reload is active, and continues the existing session context after reload. This improves the developer experience by reducing friction and enabling faster iteration cycles.Implementation Details
--devflag toadk runcommand incli_tools_click.py.DevModeChangeHandlerclass incli.pyusing the existingwatchdoglibrary dependency..pyand.yamlfiles in agent directories with recursive watching.threadingevents.Usage
Testing Plan
Unit Tests
DevModeChangeHandlerclass functionality.Pytest results summary:
Manual End-to-End (E2E) Tests
pip install -e .).adk run --dev contributing/samples/quickstart.agent.pywhile agent is running.adk run contributing/samples/quickstart(without--devflag).Test Logs:
Checklist
CONTRIBUTING.mddocument.Code Review Comments
DevModeChangeHandlerclass and methods.watchdogdependency (no new dependencies added).adk runfunctionality.Additional Context
Technical Implementation
DevModeChangeHandlerclass extendswatchdog.events.FileSystemEventHandler.threading.Eventfor thread-safe reload signaling between watchdog thread and main CLI thread.on_modifiedandon_createdevents for.pyand.yamlfiles only.Performance Considerations
Compatibility
watchdog(Windows, macOS, Linux).Future Enhancements