{"record":{"id":"ca64740d7895acdc","repo":"microsoft/autogen","slug":"to-use-the-grpc-runtime-the-grpc-extra-must-be-ins","errorCode":null,"errorMessage":"To use the GRPC runtime the grpc extra must be installed. Run `pip install autogen-ext[grpc]`","messagePattern":"To use the GRPC runtime the grpc extra must be installed\\. Run `pip install autogen-ext\\[grpc\\]`","errorType":"exception","errorClass":"ImportError","httpStatus":null,"severity":"error","filePath":"python/packages/autogen-ext/src/autogen_ext/runtimes/grpc/__init__.py","lineNumber":8,"sourceCode":"from ._worker_runtime import GrpcWorkerAgentRuntime\nfrom ._worker_runtime_host import GrpcWorkerAgentRuntimeHost\nfrom ._worker_runtime_host_servicer import GrpcWorkerAgentRuntimeHostServicer\n\ntry:\n    import grpc  # type: ignore\nexcept ImportError as e:\n    raise ImportError(\n        \"To use the GRPC runtime the grpc extra must be installed. Run `pip install autogen-ext[grpc]`\"\n    ) from e\n\n__all__ = [\n    \"GrpcWorkerAgentRuntime\",\n    \"GrpcWorkerAgentRuntimeHost\",\n    \"GrpcWorkerAgentRuntimeHostServicer\",\n]\n","sourceCodeStart":1,"sourceCodeEnd":17,"githubUrl":"https://github.com/microsoft/autogen/blob/027ecf0a379bcc1d09956d46d12d44a3ad9cee14/python/packages/autogen-ext/src/autogen_ext/runtimes/grpc/__init__.py#L1-L17","documentation":"The autogen_ext.runtimes.grpc package lazily requires the grpcio library but does not declare it as a hard dependency; it is an optional extra. Importing the package without grpcio installed raises this ImportError with the exact pip extra to install.","triggerScenarios":"Running `import autogen_ext.runtimes.grpc` (or instantiating GrpcWorkerAgentRuntime / GrpcWorkerAgentRuntimeHost) in an environment where the `pip install autogen-ext[grpc]` extra was never installed.","commonSituations":"Installing plain `autogen-ext` instead of `autogen-ext[grpc]`; CI caches or slim Docker images that only install base deps; adding distributed-runtime code to a project whose requirements.txt was generated from a non-gRPC setup.","solutions":["Install the extra: `pip install autogen-ext[grpc]`","Add `autogen-ext[grpc]` (pinned to the same version as autogen-core) to requirements.txt / pyproject.toml","If you do not need distributed agents, import a non-gRPC runtime (e.g. SingleThreadedAgentRuntime) instead"],"exampleFix":"# before\npip install autogen-ext\n\n# after\npip install \"autogen-ext[grpc]","handlingStrategy":"validation","validationCode":"import importlib.util\n\ndef grpc_extra_installed() -> bool:\n    return importlib.util.find_spec(\"grpc\") is not None\n\nif not grpc_extra_installed():\n    raise SystemExit(\"Missing dependency: pip install autogen-ext[grpc]\")","typeGuard":null,"tryCatchPattern":"try:\n    from autogen_ext.runtimes.grpc import GrpcWorkerAgentRuntime\nexcept ImportError as e:\n    print(\"install with: pip install autogen-ext[grpc]\", file=sys.stderr)\n    raise SystemExit(1) from e","preventionTips":["Declare autogen-ext[grpc] in project dependencies from day one","Smoke-test imports in CI on a clean environment","Use dependency lockfiles that include optional extras"],"tags":["python","autogen","grpc","dependency","import-error"],"backgroundTag":null,"analyzedSha":"027ecf0a379bcc1d09956d46d12d44a3ad9cee14","analyzedAt":"2026-08-15T03:38:00.719Z","schemaVersion":2},"datasetVersion":"2026-08-15T22:17:37.221Z"}