{"record":{"id":"865e86faede72280","repo":"microsoft/autogen","slug":"deployment-name-not-initialized","errorCode":null,"errorMessage":"Deployment name not initialized","messagePattern":"Deployment name not initialized","errorType":"exception","errorClass":"ValueError","httpStatus":null,"severity":"error","filePath":"python/packages/autogen-ext/src/autogen_ext/agents/azure/_azure_ai_agent.py","lineNumber":389,"sourceCode":"            raise ValueError(\"Agent not initialized\")\n        return self._agent.id\n\n    @property\n    def description(self) -> str:\n        if not self._description:\n            raise ValueError(\"Description not initialized\")\n        return self._description\n\n    @property\n    def agent_id(self) -> str:\n        if not self._agent_id:\n            raise ValueError(\"Agent not initialized\")\n        return self._agent_id\n\n    @property\n    def deployment_name(self) -> str:\n        if not self._deployment_name:\n            raise ValueError(\"Deployment name not initialized\")\n        return self._deployment_name\n\n    @property\n    def instructions(self) -> str:\n        if not self._instructions:\n            raise ValueError(\"Instructions not initialized\")\n        return self._instructions\n\n    @property\n    def tools(self) -> List[ToolDefinition]:\n        \"\"\"\n        Get the list of tools available to the agent.\n\n        Returns:\n            List[ToolDefinition]: The list of tool definitions.\n        \"\"\"\n        return self._api_tools\n","sourceCodeStart":371,"sourceCodeEnd":407,"githubUrl":"https://github.com/microsoft/autogen/blob/027ecf0a379bcc1d09956d46d12d44a3ad9cee14/python/packages/autogen-ext/src/autogen_ext/agents/azure/_azure_ai_agent.py#L371-L407","documentation":"AzureAIAgent.deployment_name raises ValueError when _deployment_name is falsy — the model deployment name was not provided at construction (or is empty), so there is nothing to report.","triggerScenarios":"Constructing AzureAIAgent without a deployment_name / model deployment argument and then reading agent.deployment_name.","commonSituations":"Configuration built from env vars or config files where the deployment key is missing or misspelled; empty-string defaults from os.getenv(\"DEPLOYMENT\", \"\").","solutions":["Provide the deployment name at construction (e.g. via the constructor's deployment/model parameter).","Validate config before building the agent: fail fast if the deployment setting is missing.","Guard the property read with try/except or check the underlying config value instead."],"exampleFix":"# before\nagent = AzureAIAgent(client, name=\"a\")\nprint(agent.deployment_name)  # ValueError\n# after\nagent = AzureAIAgent(client, name=\"a\", deployment_name=\"gpt-4o-deploy\")\nprint(agent.deployment_name)","handlingStrategy":"validation","validationCode":"deployment = os.getenv(\"AZURE_DEPLOYMENT\")\nif not deployment:\n    raise SystemExit(\"AZURE_DEPLOYMENT is required\")\nagent = AzureAIAgent(client, name=\"a\", deployment_name=deployment)","typeGuard":null,"tryCatchPattern":"try:\n    dn = agent.deployment_name\nexcept ValueError:\n    dn = os.environ[\"AZURE_DEPLOYMENT\"]","preventionTips":["Fail fast on missing deployment config before constructing the agent.","Centralize config validation (deployment name, model) in one startup check.","Don't default config values to empty strings."],"tags":["azure","configuration","azure-ai-agent"],"backgroundTag":null,"analyzedSha":"027ecf0a379bcc1d09956d46d12d44a3ad9cee14","analyzedAt":"2026-08-15T03:38:00.719Z","schemaVersion":2},"datasetVersion":"2026-08-15T17:31:12.345Z"}