{"record":{"id":"ea2b8895eb11ece3","repo":"microsoft/autogen","slug":"distributed-runtime-features-require-additional-de","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":"error","filePath":"python/packages/autogen-ext/src/autogen_ext/runtimes/grpc/_worker_runtime.py","lineNumber":69,"sourceCode":"from autogen_core._serialization import (\n    SerializationRegistry,\n)\nfrom autogen_core._telemetry import MessageRuntimeTracingConfig, TraceHelper, get_telemetry_grpc_metadata\nfrom google.protobuf import any_pb2\nfrom opentelemetry.trace import TracerProvider\nfrom typing_extensions import Self\n\nfrom autogen_ext.runtimes.grpc._utils import subscription_to_proto\n\nfrom . import _constants\nfrom ._constants import GRPC_IMPORT_ERROR_STR\nfrom ._type_helpers import ChannelArgumentType\nfrom .protos import agent_worker_pb2, agent_worker_pb2_grpc, cloudevent_pb2\n\ntry:\n    import grpc.aio\nexcept ImportError as e:\n    raise ImportError(GRPC_IMPORT_ERROR_STR) from e\n\nif TYPE_CHECKING:\n    from .protos.agent_worker_pb2_grpc import AgentRpcAsyncStub\n\nlogger = logging.getLogger(\"autogen_core\")\nevent_logger = logging.getLogger(\"autogen_core.events\")\n\nP = ParamSpec(\"P\")\nT = TypeVar(\"T\", bound=Agent)\n\n\ntype_func_alias = type\n\n\nclass QueueAsyncIterable(AsyncIterator[Any], AsyncIterable[Any]):\n    def __init__(self, queue: asyncio.Queue[Any]) -> None:\n        self._queue = queue\n","sourceCodeStart":51,"sourceCodeEnd":87,"githubUrl":"https://github.com/microsoft/autogen/blob/027ecf0a379bcc1d09956d46d12d44a3ad9cee14/python/packages/autogen-ext/src/autogen_ext/runtimes/grpc/_worker_runtime.py#L51-L87","documentation":"GrpcWorkerAgentRuntime's module imports grpc.aio at load time; without the optional grpcio dependency the module raises ImportError with GRPC_IMPORT_ERROR_STR pointing to `pip install autogen-core[grpc]`. This guard fires on the first import of autogen_ext.runtimes.grpc._worker_runtime, before any runtime behavior runs.","triggerScenarios":"Importing GrpcWorkerAgentRuntime (usually via `from autogen_ext.runtimes.grpc import GrpcWorkerAgentRuntime`) or the module _worker_runtime in an environment lacking the grpc extra.","commonSituations":"Same class of issue as the package-level guard but hit when the submodule is imported directly; deploying to environments where only autogen-core (not the [grpc] extra) was installed; documentation samples that assume the extra.","solutions":["Install the extra: `pip install autogen-core[grpc]` (and/or autogen-ext[grpc])","Pin the extras in your dependency manifest so fresh environments get grpcio automatically","Guard the import in code that optionally supports gRPC: wrap in try/except ImportError and fall back to a local runtime"],"exampleFix":"# before\nfrom autogen_ext.runtimes.grpc import GrpcWorkerAgentRuntime  # ImportError\n\n# after (install first: pip install autogen-core[grpc])\nfrom autogen_ext.runtimes.grpc import GrpcWorkerAgentRuntime","handlingStrategy":"validation","validationCode":"import importlib.util\n\nif importlib.util.find_spec(\"grpc.aio\") is None:\n    raise SystemExit(\"Missing dependency: pip install autogen-core[grpc]\")\n\nfrom autogen_ext.runtimes.grpc import GrpcWorkerAgentRuntime","typeGuard":null,"tryCatchPattern":"try:\n    from autogen_ext.runtimes.grpc._worker_runtime import GrpcWorkerAgentRuntime\nexcept ImportError as e:\n    if \"grpc extra\" in str(e):\n        subprocess.check_call([sys.executable, \"-m\", \"pip\", \"install\", \"autogen-core[grpc]\"])\n    raise","preventionTips":["Install extras via the documented pip extra names","Verify environments with a startup dependency check","Avoid deep imports of private modules in user code; import from the package root"],"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"}