{"record":{"id":"a4883d943536d003","repo":"apache/beam","slug":"google-adk-is-required-to-use-adkagentmodelhandler-install","errorCode":null,"errorMessage":"google-adk is required to use ADKAgentModelHandler. Install it with: pip install google-adk","messagePattern":"google-adk is required to use ADKAgentModelHandler\\. Install it with: pip install google-adk","errorType":"exception","errorClass":"ImportError","httpStatus":null,"severity":"error","filePath":"sdks/python/apache_beam/ml/inference/agent_development_kit.py","lineNumber":139,"sourceCode":"    max_batch_weight: Optional maximum total weight of a batch.\n    element_size_fn: Optional function that returns the size (weight) of an\n      element.\n  \"\"\"\n  def __init__(\n      self,\n      agent: _AgentOrFactory,\n      app_name: str = \"beam_inference\",\n      session_service_factory: Optional[Callable[[],\n                                                 \"BaseSessionService\"]] = None,\n      *,\n      min_batch_size: Optional[int] = None,\n      max_batch_size: Optional[int] = None,\n      max_batch_duration_secs: Optional[int] = None,\n      max_batch_weight: Optional[int] = None,\n      element_size_fn: Optional[Callable[[Any], int]] = None,\n      **kwargs):\n    if not ADK_AVAILABLE:\n      raise ImportError(\n          \"google-adk is required to use ADKAgentModelHandler. \"\n          \"Install it with: pip install google-adk\")\n\n    if agent is None:\n      raise ValueError(\"'agent' must be an Agent instance or a callable.\")\n\n    self._agent_or_factory = agent\n    self._app_name = app_name\n    self._session_service_factory = session_service_factory\n\n    super().__init__(\n        min_batch_size=min_batch_size,\n        max_batch_size=max_batch_size,\n        max_batch_duration_secs=max_batch_duration_secs,\n        max_batch_weight=max_batch_weight,\n        element_size_fn=element_size_fn,\n        **kwargs)\n","sourceCodeStart":121,"sourceCodeEnd":157,"githubUrl":"https://github.com/apache/beam/blob/12126d8942aaf848030c478b4c6a28c6af861c66/sdks/python/apache_beam/ml/inference/agent_development_kit.py#L121-L157","documentation":"ADKAgentModelHandler.__init__ detects that the optional google-adk package (flagged by ADK_AVAILABLE) is absent, so the handler cannot create runners or session services; the guard fires before any agent is invoked.","triggerScenarios":"Thrown at sdks/python/apache_beam/ml/inference/agent_development_kit.py:139 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Install the dependency: pip install google-adk","For containerized runners, add google-adk to the worker image's requirements and rebuild"],"exampleFix":null,"handlingStrategy":"try-catch","validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"12126d8942aaf848030c478b4c6a28c6af861c66","analyzedAt":"2026-09-13T01:50:10.254Z","contentChangedAt":"2026-09-13T01:50:10.254Z","schemaVersion":2},"datasetVersion":"2026-09-20T03:17:13.778Z"}