Skip to content

Add Development Mode with Auto-Reload for Agent Development (--dev flag) #3679

@notnotdurgesh

Description

@notnotdurgesh

Is your feature request related to a problem? Please describe.

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
  • Resume testing

This workflow is slow and disrupts the development flow, similar to how web developers had to manually restart servers before tools like nodemon existed.

Describe the solution you'd like

Add a --dev flag to the adk run command that enables development mode with automatic agent reloading. When enabled, the system should:

  • Monitor the agent directory for changes to .py and .yaml files
  • Automatically reload the agent when files are modified or created
  • Provide visual feedback when auto-reload is active
  • Continue the existing session context after reload

Usage

adk run --dev path/to/my_agent

Expected behavior

  • Start agent with "Auto-reload enabled - watching for file changes..." message
  • Monitor agent directory recursively for .py and .yaml file changes
  • Automatically reload agent when changes detected
  • Preserve session state where possible
  • Continue accepting user input seamlessly

Implementation Details

The implementation uses Python's watchdog library (already a dependency) to monitor file system events:

  • DevModeChangeHandler class extends FileSystemEventHandler
  • Monitors on_modified and on_created events for .py and .yaml files
  • Uses threading events to signal when reload is needed
  • Integrates with existing CLI infrastructure

Describe alternatives you've considered

  • Manual reload command: Add a separate adk reload command - less seamless than auto-reload.
  • Polling-based approach: File system polling instead of events - less efficient.
  • IDE integration: Rely on IDE hot-reload features - not all developers use compatible IDEs.
  • External tools: Recommend using external file watchers - increases complexity.

Additional context

This feature would significantly improve the agent development workflow by:

  • Reducing development friction
  • Enabling faster iteration cycles
  • Providing immediate feedback on code changes
  • Making ADK more developer-friendly, similar to modern web frameworks

The implementation leverages the existing watchdog dependency and integrates cleanly with the current CLI architecture. It follows the same pattern as successful developer tools like nodemon, webpack-dev-server, and similar auto-reload utilities in other ecosystems.

Prerequisites/Requirements

  • Python watchdog library (already included in ADK dependencies)
  • File system permissions to monitor directories
  • Compatible with existing session management and agent loading infrastructure

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions