{"record":{"id":"31aa0dc1013ebc67","repo":"microsoft/autogen","slug":"instructions-not-initialized","errorCode":null,"errorMessage":"Instructions not initialized","messagePattern":"Instructions 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":395,"sourceCode":"            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\n    def _add_tools(self, tools: Optional[ListToolType], converted_tools: List[ToolDefinition]) -> None:\n        \"\"\"\n        Convert various tool formats to Azure AI Agent tool definitions.\n\n        Args:\n            tools: List of tools in various formats (string identifiers, ToolDefinition objects, Tool objects, or callables)","sourceCodeStart":377,"sourceCodeEnd":413,"githubUrl":"https://github.com/microsoft/autogen/blob/027ecf0a379bcc1d09956d46d12d44a3ad9cee14/python/packages/autogen-ext/src/autogen_ext/agents/azure/_azure_ai_agent.py#L377-L413","documentation":"AzureAIAgent.instructions raises ValueError when _instructions is falsy — the system prompt / instructions were never supplied or are an empty string. The property assumes instructions exist; an agent without them fails on read.","triggerScenarios":"Constructing AzureAIAgent with instructions=None or \"\" and reading agent.instructions.","commonSituations":"Optional-instruction agents where the caller skips the parameter; templating code producing an empty string when a template var is unset.","solutions":["Pass non-empty instructions at construction.","If instructions are genuinely optional in your app, read via try/except and use a default prompt.","Validate rendered instruction templates are non-empty before creating the agent."],"exampleFix":"# before\nagent = AzureAIAgent(client, name=\"a\")\nprint(agent.instructions)  # ValueError\n# after\nagent = AzureAIAgent(client, name=\"a\", instructions=\"You are a helpful assistant.\")\nprint(agent.instructions)","handlingStrategy":"validation","validationCode":"instructions = template.render(vars).strip()\nassert instructions, \"instructions template rendered empty\"\nagent = AzureAIAgent(client, name=\"a\", instructions=instructions)","typeGuard":null,"tryCatchPattern":"try:\n    ins = agent.instructions\nexcept ValueError:\n    ins = DEFAULT_PROMPT","preventionTips":["Always set instructions at construction.","Assert rendered prompt templates are non-empty before use.","Keep a default system prompt constant and use it when none is configured."],"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"}