{"record":{"id":"da517b631da20dda","repo":"microsoft/autogen","slug":"no-tools-are-available-da517b","errorCode":null,"errorMessage":"No tools are available.","messagePattern":"No tools are available\\.","errorType":"validation","errorClass":"ValueError","httpStatus":null,"severity":"error","filePath":"python/packages/autogen-ext/src/autogen_ext/agents/openai/_openai_assistant_agent.py","lineNumber":387,"sourceCode":"    def messages(self) -> AsyncMessages:\n        return self._client.beta.threads.messages\n\n    @property\n    def _get_assistant_id(self) -> str:\n        if self._assistant is None:\n            raise ValueError(\"Assistant not initialized\")\n        return self._assistant.id\n\n    @property\n    def _thread_id(self) -> str:\n        if self._thread is None:\n            raise ValueError(\"Thread not initialized\")\n        return self._thread.id\n\n    async def _execute_tool_call(self, tool_call: FunctionCall, cancellation_token: CancellationToken) -> str:\n        \"\"\"Execute a tool call and return the result.\"\"\"\n        if not self._original_tools:\n            raise ValueError(\"No tools are available.\")\n        tool = next((t for t in self._original_tools if t.name == tool_call.name), None)\n        if tool is None:\n            raise ValueError(f\"The tool '{tool_call.name}' is not available.\")\n        arguments = json.loads(tool_call.arguments)\n        result = await tool.run_json(arguments, cancellation_token, call_id=tool_call.id)\n        return tool.return_value_as_string(result)\n\n    async def on_messages(self, messages: Sequence[BaseChatMessage], cancellation_token: CancellationToken) -> Response:\n        \"\"\"Handle incoming messages and return a response.\"\"\"\n\n        async for message in self.on_messages_stream(messages, cancellation_token):\n            if isinstance(message, Response):\n                return message\n        raise AssertionError(\"The stream should have returned the final result.\")\n\n    async def on_messages_stream(\n        self, messages: Sequence[BaseChatMessage], cancellation_token: CancellationToken\n    ) -> AsyncGenerator[BaseAgentEvent | BaseChatMessage | Response, None]:","sourceCodeStart":369,"sourceCodeEnd":405,"githubUrl":"https://github.com/microsoft/autogen/blob/027ecf0a379bcc1d09956d46d12d44a3ad9cee14/python/packages/autogen-ext/src/autogen_ext/agents/openai/_openai_assistant_agent.py#L369-L405","documentation":"OpenAIAssistantAgent._execute_tool_call refuses to process any FunctionCall when self._original_tools is empty. The assistant-side tool set must have been supplied at construction (strings, Tool instances, or callables); with none registered there is nothing to bind a tool call to, which indicates a configuration bug rather than a model hiccup.","triggerScenarios":"Constructing the agent with tools=[] or tools=None, then the Assistants API somehow returning a requires_action run with function tool calls (e.g. the assistant_id points to a pre-existing OpenAI assistant that HAS server-side tools, while the local agent has none registered).","commonSituations":"Reusing an existing assistant_id whose server-side definition includes function tools, but constructing the local agent without the matching Tool implementations; deleting tools locally but not on the OpenAI side.","solutions":["Pass the matching Tool/Callable implementations in tools= when constructing the agent.","When attaching to an existing assistant_id, make sure the local tool set mirrors the functions defined on the server-side assistant.","If the assistant should not call tools, remove the function tools from the OpenAI assistant definition (update via the API) so runs never enter requires_action."],"exampleFix":"# before\nagent = OpenAIAssistantAgent(name=\"a\", instructions=\"...\", model=\"gpt-4o\",\n                            client=cl, assistant_id=\"asst_with_tools\")\n# asst_with_tools has server-side function tools -> run hits requires_action -> error\n\n# after\nagent = OpenAIAssistantAgent(\n    name=\"a\", instructions=\"...\", model=\"gpt-4o\", client=cl,\n    assistant_id=\"asst_with_tools\",\n    tools=[get_weather, FunctionTool(search_docs, description=\"Search docs\")],\n)","handlingStrategy":"validation","validationCode":"if not agent._original_tools:  # after construction\n    raise ConfigError(\"Register tools before runs that may require_action\")","typeGuard":null,"tryCatchPattern":null,"preventionTips":["When attaching to an existing assistant_id, pass the matching local tool implementations.","Keep server-side assistant tool definitions and local tools in sync (single source of truth).","Run a smoke-test turn in CI that exercises each registered tool."],"tags":["openai","assistants-api","tools","configuration"],"backgroundTag":null,"analyzedSha":"027ecf0a379bcc1d09956d46d12d44a3ad9cee14","analyzedAt":"2026-08-15T03:38:00.719Z","schemaVersion":2},"datasetVersion":"2026-08-15T17:31:12.345Z"}