{"record":{"id":"69f0dd38f442d289","repo":"microsoft/autogen","slug":"loading-state-is-not-yet-implemented","errorCode":null,"errorMessage":"Loading state is not yet implemented.","messagePattern":"Loading state is not yet implemented\\.","errorType":"exception","errorClass":"NotImplementedError","httpStatus":null,"severity":"error","filePath":"python/packages/autogen-ext/src/autogen_ext/runtimes/grpc/_worker_runtime.py","lineNumber":496,"sourceCode":"                        spec_version=\"1.0\",\n                        type=topic_id.type,\n                        source=topic_id.source,\n                        attributes=attributes,\n                        proto_data=any_proto,\n                    )\n                )\n\n            telemetry_metadata = get_telemetry_grpc_metadata()\n            task = asyncio.create_task(self._send_message(runtime_message, \"publish\", topic_id, telemetry_metadata))\n            self._background_tasks.add(task)\n            task.add_done_callback(self._raise_on_exception)\n            task.add_done_callback(self._background_tasks.discard)\n\n    async def save_state(self) -> Mapping[str, Any]:\n        raise NotImplementedError(\"Saving state is not yet implemented.\")\n\n    async def load_state(self, state: Mapping[str, Any]) -> None:\n        raise NotImplementedError(\"Loading state is not yet implemented.\")\n\n    async def agent_metadata(self, agent: AgentId) -> AgentMetadata:\n        raise NotImplementedError(\"Agent metadata is not yet implemented.\")\n\n    async def agent_save_state(self, agent: AgentId) -> Mapping[str, Any]:\n        raise NotImplementedError(\"Agent save_state is not yet implemented.\")\n\n    async def agent_load_state(self, agent: AgentId, state: Mapping[str, Any]) -> None:\n        raise NotImplementedError(\"Agent load_state is not yet implemented.\")\n\n    async def _get_new_request_id(self) -> str:\n        async with self._pending_requests_lock:\n            self._next_request_id += 1\n            return str(self._next_request_id)\n\n    async def _process_request(self, request: agent_worker_pb2.RpcRequest) -> None:\n        assert self._host_connection is not None\n        recipient = AgentId(request.target.type, request.target.key)","sourceCodeStart":478,"sourceCodeEnd":514,"githubUrl":"https://github.com/microsoft/autogen/blob/027ecf0a379bcc1d09956d46d12d44a3ad9cee14/python/packages/autogen-ext/src/autogen_ext/runtimes/grpc/_worker_runtime.py#L478-L514","documentation":"GrpcWorkerAgentRuntime.load_state() is a stub that always raises NotImplementedError, mirroring save_state: the distributed runtime does not support restoring global runtime state from a mapping.","triggerScenarios":"Calling `await runtime.load_state(state)` on GrpcWorkerAgentRuntime, typically from generic restore/checkpoint code paths that accept any AgentRuntime.","commonSituations":"Porting a SingleThreadedAgentRuntime app with save/restore to gRPC workers; framework checkpoint tools invoking load_state uniformly.","solutions":["Drop runtime-level load_state for gRPC deployments and restore state inside your agents' own handlers or constructor-time hydration","Keep a local SingleThreadedAgentRuntime variant for stateful tests/simulations","Feature-detect before calling: hasattr/runtime type checks to skip persistence for gRPC runtimes"],"exampleFix":"# before\nawait runtime.load_state(saved)  # NotImplementedError\n\n# after\nif isinstance(runtime, GrpcWorkerAgentRuntime):\n    await hydrate_agents_from_store()\nelse:\n    await runtime.load_state(saved)","handlingStrategy":"type-guard","validationCode":"from autogen_ext.runtimes.grpc import GrpcWorkerAgentRuntime\n\nif isinstance(runtime, GrpcWorkerAgentRuntime):\n    await hydrate_agents_from_store()\nelse:\n    await runtime.load_state(saved)","typeGuard":"def runtime_supports_state(runtime: object) -> bool:\n    return not isinstance(runtime, GrpcWorkerAgentRuntime)","tryCatchPattern":"try:\n    await runtime.load_state(state)\nexcept NotImplementedError:\n    await hydrate_agents_from_store()  # app-level restore","preventionTips":["Branch restore logic on runtime type","Hydrate agents at construction or via a LoadState message","Abstract persistence behind your own interface instead of the runtime's"],"tags":["python","autogen","grpc","not-implemented","state-management"],"backgroundTag":null,"analyzedSha":"027ecf0a379bcc1d09956d46d12d44a3ad9cee14","analyzedAt":"2026-08-15T03:38:00.719Z","schemaVersion":2},"datasetVersion":"2026-08-15T22:17:37.221Z"}