{"record":{"id":"24f97c4cf65b48b1","repo":"microsoft/autogen","slug":"distributed-runtime-features-require-additional-de-24f97c","errorCode":null,"errorMessage":"Distributed runtime features require additional dependencies. Install them with: pip install autogen-core[grpc]","messagePattern":"Distributed runtime features require additional dependencies\\. Install them with: pip install autogen-core\\[grpc\\]","errorType":"exception","errorClass":"ImportError","httpStatus":null,"severity":"critical","filePath":"python/packages/autogen-ext/src/autogen_ext/runtimes/grpc/_worker_runtime_host.py","lineNumber":13,"sourceCode":"import asyncio\nimport logging\nimport signal\nfrom typing import Optional, Sequence\n\nfrom ._constants import GRPC_IMPORT_ERROR_STR\nfrom ._type_helpers import ChannelArgumentType\nfrom ._worker_runtime_host_servicer import GrpcWorkerAgentRuntimeHostServicer\n\ntry:\n    import grpc\nexcept ImportError as e:\n    raise ImportError(GRPC_IMPORT_ERROR_STR) from e\nfrom .protos import agent_worker_pb2_grpc\n\nlogger = logging.getLogger(\"autogen_core\")\n\n\nclass GrpcWorkerAgentRuntimeHost:\n    def __init__(self, address: str, extra_grpc_config: Optional[ChannelArgumentType] = None) -> None:\n        self._server = grpc.aio.server(options=extra_grpc_config)\n        self._servicer = GrpcWorkerAgentRuntimeHostServicer()\n        agent_worker_pb2_grpc.add_AgentRpcServicer_to_server(self._servicer, self._server)\n        self._server.add_insecure_port(address)\n        self._address = address\n        self._serve_task: asyncio.Task[None] | None = None\n\n    async def _serve(self) -> None:\n        await self._server.start()\n        logger.info(f\"Server started at {self._address}.\")\n        await self._server.wait_for_termination()","sourceCodeStart":1,"sourceCodeEnd":31,"githubUrl":"https://github.com/microsoft/autogen/blob/027ecf0a379bcc1d09956d46d12d44a3ad9cee14/python/packages/autogen-ext/src/autogen_ext/runtimes/grpc/_worker_runtime_host.py#L1-L31","documentation":"The module _worker_runtime_host.py imports grpc at top level inside a try/except and re-raises ImportError with GRPC_IMPORT_ERROR_STR ('Distributed runtime features require additional dependencies. Install them with: pip install autogen-core[grpc]') when grpc is missing. Importing GrpcWorkerAgentRuntimeHost therefore fails immediately on any Python environment lacking the grpcio stack. The error is raised at import time, before any class is instantiated.","triggerScenarios":"Running 'from autogen_ext.runtimes.grpc import GrpcWorkerAgentRuntimeHost' (or anything that transitively imports this module, e.g. autogen_ext.runtimes.grpc.__init__) in an environment where grpcio/grpcio-tools are not installed — i.e. autogen-ext installed without the [grpc] extra and without a manual pip install of grpcio.","commonSituations":"Fresh environments installing bare 'autogen-ext' instead of 'autogen-ext[grpc]'; CI caches or slim Docker images that prune optional deps; dependency resolvers removing grpcio as 'unused'; upgrading autogen-ext without re-adding the extra.","solutions":["Install the grpc extra: pip install 'autogen-core[grpc]' (as the message says), and/or 'autogen-ext[grpc]' for the full ext stack","Add the extra to your project's requirements/pyproject so environments always include it: autogen-ext[grpc]==<pinned>","If you don't need gRPC, import a different runtime (e.g. autogen_core SingleThreadedAgentRuntime) instead of the grpc modules","Verify with 'pip show grpcio' or 'python -c \"import grpc\"' in the exact environment/venv that runs the app"],"exampleFix":"# before\npip install autogen-ext\npython app.py  # ImportError: Distributed runtime features require additional dependencies...\n\n# after\npip install 'autogen-core[grpc]' 'autogen-ext[grpc]'\npython app.py","handlingStrategy":"validation","validationCode":"import importlib.util\ngrpc_available = importlib.util.find_spec('grpc') is not None\nif not grpc_available:\n    raise SystemExit('Install dependencies: pip install \"autogen-core[grpc]\"')","typeGuard":"import importlib.util\ndef grpc_deps_installed() -> bool:\n    return importlib.util.find_spec('grpc') is not None","tryCatchPattern":"try:\n    from autogen_ext.runtimes.grpc import GrpcWorkerAgentRuntimeHost\nexcept ImportError as e:\n    if 'autogen-core[grpc]' in str(e):\n        raise SystemExit('Missing gRPC extra. Run: pip install \"autogen-core[grpc]\"') from e\n    raise","preventionTips":["Declare 'autogen-ext[grpc]' (and autogen-core[grpc]) in project dependencies","Smoke-test 'import grpc' in deployment images during build","Use the same venv for pip install and app execution","If gRPC is unneeded, use SingleThreadedAgentRuntime instead"],"tags":["import","grpc","dependencies","installation"],"backgroundTag":null,"analyzedSha":"027ecf0a379bcc1d09956d46d12d44a3ad9cee14","analyzedAt":"2026-08-15T03:38:00.719Z","schemaVersion":2},"datasetVersion":"2026-08-15T22:17:37.221Z"}