{"record":{"id":"1bd0c9b73cd26254","repo":"microsoft/autogen","slug":"the-model-does-not-support-function-calling-multi","errorCode":null,"errorMessage":"The model does not support function calling. MultimodalWebSurfer requires a model that supports function calling.","messagePattern":"The model does not support function calling\\. MultimodalWebSurfer requires a model that supports function calling\\.","errorType":"validation","errorClass":"ValueError","httpStatus":null,"severity":"error","filePath":"python/packages/autogen-ext/src/autogen_ext/agents/web_surfer/_multimodal_web_surfer.py","lineNumber":236,"sourceCode":"        animate_actions: bool = False,\n        to_save_screenshots: bool = False,\n        use_ocr: bool = False,\n        browser_channel: str | None = None,\n        browser_data_dir: str | None = None,\n        to_resize_viewport: bool = True,\n        playwright: Playwright | None = None,\n        context: BrowserContext | None = None,\n    ):\n        \"\"\"\n        Initialize the MultimodalWebSurfer.\n        \"\"\"\n        super().__init__(name, description)\n        if debug_dir is None and to_save_screenshots:\n            raise ValueError(\n                \"Cannot save screenshots without a debug directory. Set it using the 'debug_dir' parameter. The debug directory is created if it does not exist.\"\n            )\n        if model_client.model_info[\"function_calling\"] is False:\n            raise ValueError(\n                \"The model does not support function calling. MultimodalWebSurfer requires a model that supports function calling.\"\n            )\n\n        self._model_client = model_client\n        self.headless = headless\n        self.browser_channel = browser_channel\n        self.browser_data_dir = browser_data_dir\n        self.start_page = start_page or self.DEFAULT_START_PAGE\n        self.downloads_folder = downloads_folder\n        self.debug_dir = debug_dir\n        self.to_save_screenshots = to_save_screenshots\n        self.use_ocr = use_ocr\n        self.to_resize_viewport = to_resize_viewport\n        self.animate_actions = animate_actions\n\n        # Call init to set these in case not set\n        self._playwright: Playwright | None = playwright\n        self._context: BrowserContext | None = context","sourceCodeStart":218,"sourceCodeEnd":254,"githubUrl":"https://github.com/microsoft/autogen/blob/027ecf0a379bcc1d09956d46d12d44a3ad9cee14/python/packages/autogen-ext/src/autogen_ext/agents/web_surfer/_multimodal_web_surfer.py#L218-L254","documentation":"MultimodalWebSurfer drives the browser by emitting tool/function calls, so it inspects model_client.model_info['function_calling'] at construction and rejects models that declare no function-calling support with ValueError. This is a hard capability requirement, not a runtime degradation — the agent cannot operate without structured tool calls.","triggerScenarios":"Constructing MultimodalWebSurfer with a ChatCompletionClient whose model_info sets function_calling=False, e.g. some embedding/small local models, replay/seed clients used in tests, or a custom model_info dict that omits the key with a falsy default.","commonSituations":"Swapping in a cheaper or local model (e.g. via a custom client) that lacks tool-calling, mis-declared model_info when wrapping third-party endpoints, running deterministic tests with a mock client that did not set function_calling=True.","solutions":["Use a function-calling-capable model, e.g. AzureOpenAIChatCompletionClient with gpt-4o / gpt-4-turbo","If wrapping a custom client, set model_info={..., 'function_calling': True} only if the backend truly supports tools","In tests, use ReplayChatCompletionClient with a model_info that declares function_calling and vision","Note vision ('vision': True) is also required for this multimodal agent"],"exampleFix":"// before\nclient = ReplayChatCompletionClient(chat_completions)  # default info: no function calling\nsurfer = MultimodalWebSurfer(name='s', model_client=client)  # ValueError\n\n// after\nfrom autogen_core.models import ModelInfo\nclient = ReplayChatCompletionClient(chat_completions, model_info=ModelInfo(vision=True, function_calling=True, json_output=False, family='unknown', structured_output=False))\nsurfer = MultimodalWebSurfer(name='s', model_client=client)","handlingStrategy":"validation","validationCode":"def supports_web_surfer(client) -> bool:\n    info = client.model_info\n    return bool(info.get('function_calling')) and bool(info.get('vision'))","typeGuard":"from autogen_core.models import ChatCompletionClient\n\ndef is_web_surfer_capable(client: ChatCompletionClient) -> bool:\n    info = client.model_info\n    return bool(info.get('function_calling')) and bool(info.get('vision'))","tryCatchPattern":null,"preventionTips":["Check model_info['function_calling'] and ['vision'] before constructing","Keep a whitelist of approved model deployments for the web surfer","In tests, configure ReplayChatCompletionClient model_info explicitly"],"tags":["web-surfer","model-capabilities","function-calling","configuration"],"backgroundTag":null,"analyzedSha":"027ecf0a379bcc1d09956d46d12d44a3ad9cee14","analyzedAt":"2026-08-15T03:38:00.719Z","schemaVersion":2},"datasetVersion":"2026-08-15T17:31:12.345Z"}