microsoft/autogen · error · ValueError

Provider module '{module_path}' is not in a trusted namespac

Error message

Provider module '{module_path}' is not in a trusted namespace. Allowed namespaces by default: autogen_core, autogen_agentchat, autogen_ext, autogen_studio, autogenstudio. To allow additional namespaces, set the AUTOGEN_ALLOWED_PROVIDER_NAMESPACES environment variable to a comma-separated list (e.g. AUTOGEN_ALLOWED_PROVIDER_NAMESPACES=mycompany_agents,mypackage).

What it means

Error "Provider module '{module_path}' is not in a trusted namespace. Allowed namespaces by default: autogen_core, autogen_agentchat, autogen_ext, autogen_studio, autogenstudio. To allow additional namespaces, set the AUTOGEN_ALLOWED_PROVIDER_NAMESPACES environment variable to a comma-separated list (e.g. AUTOGEN_ALLOWED_PROVIDER_NAMESPACES=mycompany_agents,mypackage)." thrown in microsoft/autogen.

Source

Thrown at python/packages/autogen-core/src/autogen_core/_component_config.py:263

        # First, do a look up in well known providers
        if loaded_model.provider in WELL_KNOWN_PROVIDERS:
            loaded_model.provider = WELL_KNOWN_PROVIDERS[loaded_model.provider]

        output = loaded_model.provider.rsplit(".", maxsplit=1)
        if len(output) != 2:
            raise ValueError("Invalid")

        module_path, class_name = output

        trusted = _get_trusted_namespaces()
        # Also allow test modules (pytest convention) to load components
        module_name = module_path.rsplit(".", maxsplit=1)[-1]
        is_test_module = module_name.startswith("test_") or module_path.startswith("test_")
        if not is_test_module and not any(
            module_path.startswith(ns) or module_path == ns.rstrip(".") for ns in trusted
        ):
            raise ValueError(
                f"Provider module '{module_path}' is not in a trusted namespace. "
                f"Allowed namespaces by default: autogen_core, autogen_agentchat, autogen_ext, "
                f"autogen_studio, autogenstudio. "
                f"To allow additional namespaces, set the AUTOGEN_ALLOWED_PROVIDER_NAMESPACES "
                f"environment variable to a comma-separated list "
                f"(e.g. AUTOGEN_ALLOWED_PROVIDER_NAMESPACES=mycompany_agents,mypackage)."
            )

        module = importlib.import_module(module_path)
        component_class = module.__getattribute__(class_name)

        if not is_component_class(component_class):
            raise TypeError("Invalid component class")

        # We need to check the schema is valid
        if not hasattr(component_class, "component_config_schema"):
            raise AttributeError("component_config_schema not defined")

View on GitHub (pinned to 027ecf0a37)

Solutions

  1. Move the class into an allowed namespace or extend AUTOGEN_ALLOWED_PROVIDER_NAMESPACES

Example fix

export AUTOGEN_ALLOWED_PROVIDER_NAMESPACES=mycompany_agents,mypackage

When it happens

Trigger: Thrown at python/packages/autogen-core/src/autogen_core/_component_config.py:263 when the library encounters an invalid state.

Common situations: See trigger scenarios.


AI-assisted analysis of microsoft/autogen@027ecf0a37 (2026-08-15). Data as JSON: /api/errors/cc3b497f23b96d32. Report an issue: GitHub.