{"record":{"id":"2b281c36d3b0f88a","repo":"deepset-ai/haystack","slug":"cls-name-is-an-experimental-component-and","errorCode":null,"errorMessage":"'{cls.__name__}' is an experimental component and may change or be removed in future releases without prior deprecation notice. ","messagePattern":"'(.+?)' is an experimental component and may change or be removed in future releases without prior deprecation notice\\. ","errorType":"console","errorClass":"ExperimentalWarning","httpStatus":null,"severity":"info","filePath":"haystack/utils/experimental.py","lineNumber":33,"sourceCode":"\n    Components decorated with @experimental are subject to breaking changes\n    or removal in future releases without prior deprecation notice.\n\n    ## Usage example\n\n        @_experimental\n        @component\n        class MyComponent:\n            ...\n    \"\"\"\n    # getattr/setattr are intentional here: direct attribute access (cls.__init__, cls.__init__ = ...)\n    # triggers mypy [misc] and [attr-defined] errors because T is an unbound TypeVar.\n    # noqa comments suppress ruff B009/B010 which would auto-revert these back to direct access.\n    original_init: Any = getattr(cls, \"__init__\")  # noqa: B009\n\n    @functools.wraps(original_init)\n    def new_init(self: Any, *args: Any, **kwargs: Any) -> None:\n        warnings.warn(\n            f\"'{cls.__name__}' is an experimental component and may change or be removed \"\n            \"in future releases without prior deprecation notice. \",\n            ExperimentalWarning,\n            stacklevel=2,\n        )\n        original_init(self, *args, **kwargs)\n\n    setattr(cls, \"__init__\", new_init)  # noqa: B010\n    setattr(cls, \"__experimental__\", True)  # noqa: B010\n    return cls\n\n\nclass ExperimentalWarning(UserWarning):\n    \"\"\"Warning emitted when an experimental Haystack component is instantiated.\"\"\"\n","sourceCodeStart":15,"sourceCodeEnd":48,"githubUrl":"https://github.com/deepset-ai/haystack/blob/e318778c9bf60a1963e3b5f451359655dd696c30/haystack/utils/experimental.py#L15-L48","documentation":"Haystack marks some components as experimental via the @experimental decorator (haystack/utils/experimental.py). The decorator wraps __init__ in new_init, which emits this ExperimentalWarning on every instantiation, telling you the class's API may change or disappear without any deprecation cycle.","triggerScenarios":"Instantiating any class decorated with @experimental, e.g. ComponentThatAddsTen() — the warning fires each time __init__ runs, with the concrete class name interpolated into the message.","commonSituations":"Trying a new Haystack feature (component still under development) in production or CI; noisy test logs from repeated instantiation; upgrading Haystack and finding the experimental component's API changed or was removed.","solutions":["Treat the component as unstable: pin the Haystack version (pip install haystack-ai==X.Y.Z) so its API cannot shift under you","Wrap instantiation behind your own adapter/factory so a future API change or removal requires edits in one place only","Silence it deliberately with warnings.filterwarnings('ignore', category=ExperimentalWarning, module='haystack') once you accept the instability risk","Check release notes for the component's graduation to stable, then drop the adapter/warning filters"],"exampleFix":"# before\nfrom haystack.components.experimental import ComponentThatAddsTen\ncomp = ComponentThatAddsTen()  # ExperimentalWarning every time\n# after\nimport warnings\nwarnings.filterwarnings(\"ignore\", category=ExperimentalWarning, module=\"haystack\")\n# and/or isolate behind an adapter:\ndef make_component(**kwargs):\n    from haystack.components.experimental import ComponentThatAddsTen\n    return ComponentThatAddsTen(**kwargs)","handlingStrategy":"try-catch","validationCode":"import inspect\n\ndef is_experimental(cls) -> bool:\n    init = getattr(cls, \"__init__\", None)\n    return init is not None and getattr(init, \"__wrapped__\", None) is not None and \\\n        any(\"experimental\" in str(a).lower() for a in getattr(init, \"__annotations__\", {}).values()) or \\\n        \"experimental\" in (cls.__doc__ or \"\").lower()","typeGuard":null,"tryCatchPattern":"import warnings\n\nwith warnings.catch_warnings(record=True) as caught:\n    warnings.simplefilter(\"always\", ExperimentalWarning)\n    comp = ComponentThatAddsTen()\n    if any(issubclass(w.category, ExperimentalWarning) for w in caught):\n        # log and pin/adapter around the unstable component\n        print(\"Using experimental component:\", comp.__class__.__name__)","preventionTips":["Pin the Haystack version whenever you depend on experimental components","Wrap experimental components behind your own adapter class or factory function","Filter ExperimentalWarning in production logging once you accept the risk","Track Haystack release notes for graduation or removal of the component"],"tags":["experimental","deprecation","python","unstable-api"],"backgroundTag":"experimental-component-warning","analyzedSha":"e318778c9bf60a1963e3b5f451359655dd696c30","analyzedAt":"2026-08-30T11:45:20.711Z","schemaVersion":2},"datasetVersion":"2026-08-30T13:17:10.514Z"}