microsoft/autogen · error · NotImplementedError
BaseAzureAISearchTool is an abstract base class and cannot b
Error message
BaseAzureAISearchTool is an abstract base class and cannot be instantiated directly. Use a concrete implementation like AzureAISearchTool.
What it means
_from_config on BaseAzureAISearchTool is a guarded abstract classmethod. If invoked on the base class itself (cls is BaseAzureAISearchTool) it raises NotImplementedError telling you to use a concrete implementation such as AzureAISearchTool. This is a programmer-facing guard for custom subclasses and internal plumbing, not a runtime service error.
Source
Thrown at python/packages/autogen-ext/src/autogen_ext/tools/azure/_ai_search.py:656
elif search_type == "hybrid":
vector_fields = config_dict.get("vector_fields")
search_fields = config_dict.get("search_fields")
if not vector_fields or len(vector_fields) == 0:
raise ValueError("vector_fields must contain at least one field name for hybrid search")
if not search_fields or len(search_fields) == 0:
raise ValueError("search_fields must contain at least one field name for hybrid search")
@classmethod
@abstractmethod
def _from_config(cls, config: AzureAISearchConfig) -> "BaseAzureAISearchTool":
"""Create a tool instance from a configuration object.
This is an abstract method that must be implemented by subclasses.
"""
if cls is BaseAzureAISearchTool:
raise NotImplementedError(
"BaseAzureAISearchTool is an abstract base class and cannot be instantiated directly. "
"Use a concrete implementation like AzureAISearchTool."
)
raise NotImplementedError("Subclasses must implement _from_config")
@abstractmethod
async def _get_embedding(self, query: str) -> List[float]:
"""Generate embedding vector for the query text."""
raise NotImplementedError("Subclasses must implement _get_embedding")
_allow_private_constructor = ContextVar("_allow_private_constructor", default=False)
class AzureAISearchTool(EmbeddingProviderMixin, BaseAzureAISearchTool):
"""Azure AI Search tool for querying Azure search indexes.
This tool provides a simplified interface for querying Azure AI Search indexes usingView on GitHub (pinned to 027ecf0a37)
Solutions
- Call the concrete class instead: AzureAISearchTool._from_config(config) (or just use its public factory methods).
- In custom subclasses, do not delegate _from_config to super(); construct the concrete instance directly.
- If you never extend these classes, this error indicates you are reaching into private API — switch to the documented factory constructors.
Example fix
# before tool = BaseAzureAISearchTool._from_config(cfg) # after tool = AzureAISearchTool._from_config(cfg)
Defensive patterns
Strategy: type-guard
Validate before calling
from autogen_ext.tools.azure._ai_search import BaseAzureAISearchTool, AzureAISearchTool
def is_concrete_tool_cls(cls) -> bool:
return cls is not BaseAzureAISearchTool Type guard
def can_from_config(cls) -> bool:
from autogen_ext.tools.azure._ai_search import BaseAzureAISearchTool
return cls is not BaseAzureAISearchTool and '_from_config' in cls.__dict__ Try / catch
try:
tool = cls._from_config(cfg)
except NotImplementedError:
if cls is BaseAzureAISearchTool:
cls = AzureAISearchTool # fall back to the concrete class
tool = cls._from_config(cfg)
else:
raise Prevention
- Never call private _from_config on the base class; use public factory methods.
- In generic code, accept only concrete tool classes and assert that at the boundary.
- In subclasses, do not delegate _from_config to super().
When it happens
Trigger: Calling BaseAzureAISearchTool._from_config(config) directly, or writing a custom subclass whose _from_config implementation delegates to super()._from_config (which lands on the base implementation).
Common situations: Writing a custom search tool subclass and accidentally calling super()._from_config(config) inside it; generic factory code that receives the base class as a parameter instead of a concrete tool class.
Related errors
- Subclasses must implement _from_config
- Subclasses must implement _get_embedding
- Index '{self.search_config.index_name}' not found.
- Error from Azure AI Search: {error_msg}
- Invalid configuration: {str(e)}
AI-assisted analysis of microsoft/autogen@027ecf0a37 (2026-08-15).
Data as JSON: /api/errors/f214f7572aa622c6.
Report an issue: GitHub.