Skip to content

feat: Enable Plugin Registration via adk api_server CLI #2636

@igooch

Description

@igooch

Description:

This issue tracks the feature enhancement to allow users to register ADK plugins directly when starting the agent using the adk api_server command. Currently, plugins can be registered programmatically when instantiating a Runner, but there's no direct way to do this when using the built-in server command. This change makes it easier to apply cross-cutting concerns like custom logging, metrics, or other extensions to agents being served via the default API server.

Benefits:

  • Simplified Plugin Usage: Makes it straightforward to add global functionalities to agents run with adk api_server.
  • Enhanced Extensibility: Allows users to leverage the ADK plugin system for modular extensions even when using the built-in server command.
  • Improved Developer Experience: Streamlines the process of configuring agents with common middleware-like features.

Proposed Functionality:

  • Introduce a new command-line option to adk api_server (e.g., --plugin).
  • The option should accept one or more fully qualified Python import paths to classes inheriting from BasePlugin.
  • The adk api_server will dynamically load and instantiate the specified plugins and register them with the internal Runner instance it uses to execute the agent.

Acceptance Criteria:

  • A user can run adk api_server . --plugin my_package.my_module.MyPlugin and the server starts successfully.
  • The callbacks defined in the registered plugin(s) are invoked during the agent's execution lifecycle.
  • Unit tests are updated to confirm the new CLI option and the plugin loading mechanism function as expected.

Metadata

Metadata

Assignees

Labels

bot triaged[Bot] This issue is triaged by ADK botcore[Component] This issue is related to the core interface and implementation

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions