{"record":{"id":"5d543dfb798f41ef","repo":"microsoft/autogen","slug":"agent-metadata-is-not-yet-implemented","errorCode":null,"errorMessage":"Agent metadata is not yet implemented.","messagePattern":"Agent metadata 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":499,"sourceCode":"                        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)\n        sender: AgentId | None = None\n        if request.HasField(\"source\"):\n            sender = AgentId(request.source.type, request.source.key)","sourceCodeStart":481,"sourceCodeEnd":517,"githubUrl":"https://github.com/microsoft/autogen/blob/027ecf0a379bcc1d09956d46d12d44a3ad9cee14/python/packages/autogen-ext/src/autogen_ext/runtimes/grpc/_worker_runtime.py#L481-L517","documentation":"GrpcWorkerAgentRuntime.agent_metadata() is a stub raising NotImplementedError: per-agent metadata queries are not implemented in the distributed worker runtime (metadata is a concept of the local agent runtime's direct-instantiation model).","triggerScenarios":"Calling `await runtime.agent_metadata(agent_id)` on GrpcWorkerAgentRuntime, often indirectly through helper code that queries metadata for logging or UI display.","commonSituations":"Dashboards/telemetry code written against the AgentRuntime interface being pointed at a gRPC worker; shared utilities that call agent_metadata on any runtime.","solutions":["Remove or condition the agent_metadata call for gRPC runtimes","Track agent metadata in your own registry keyed by AgentId for distributed deployments","Gate on runtime type before querying metadata"],"exampleFix":"# before\nmeta = await runtime.agent_metadata(agent_id)  # NotImplementedError\n\n# after\nmeta = my_metadata_registry.get(agent_id)  # app-managed","handlingStrategy":"type-guard","validationCode":"from autogen_ext.runtimes.grpc import GrpcWorkerAgentRuntime\n\nif isinstance(runtime, GrpcWorkerAgentRuntime):\n    meta = my_metadata_registry.get(agent_id)\nelse:\n    meta = await runtime.agent_metadata(agent_id)","typeGuard":"def runtime_has_agent_metadata(runtime: object) -> bool:\n    return not isinstance(runtime, GrpcWorkerAgentRuntime)","tryCatchPattern":"try:\n    meta = await runtime.agent_metadata(agent_id)\nexcept NotImplementedError:\n    meta = my_metadata_registry.get(agent_id)","preventionTips":["Keep agent metadata in an application registry for distributed runtimes","Wrap metadata access in a helper that handles unsupported runtimes","Test dashboards/telemetry against the gRPC runtime, not just local"],"tags":["python","autogen","grpc","not-implemented","metadata"],"backgroundTag":null,"analyzedSha":"027ecf0a379bcc1d09956d46d12d44a3ad9cee14","analyzedAt":"2026-08-15T03:38:00.719Z","schemaVersion":2},"datasetVersion":"2026-08-15T17:31:12.345Z"}