diff --git a/cascadeflow/__init__.py b/cascadeflow/__init__.py index b62a38f2..307896a7 100644 --- a/cascadeflow/__init__.py +++ b/cascadeflow/__init__.py @@ -76,17 +76,19 @@ def __getattr__(self, name: str): # ==================== EAGER IMPORTS ==================== # Only the harness API is loaded eagerly — it uses only stdlib imports. -from .harness import ( # noqa: E402 +from .harness import ( HarnessConfig, HarnessInitReport, HarnessRunContext, +) +from .harness import agent as harness_agent # noqa: E402 +from .harness import ( + get_current_run, + get_harness_callback_manager, + get_harness_config, init, reset, run, - agent as harness_agent, - get_harness_config, - get_current_run, - get_harness_callback_manager, set_harness_callback_manager, ) @@ -97,6 +99,7 @@ def __getattr__(self, name: str): # Agent & result "CascadeAgent": (".agent", "CascadeAgent"), "CascadeResult": (".schema.result", "CascadeResult"), + "agent": (".agent", None), # Providers "BaseProvider": (".providers", "BaseProvider"), "ModelResponse": (".providers", "ModelResponse"), @@ -245,7 +248,10 @@ def __getattr__(name: str): import importlib module = importlib.import_module(module_path, __package__) - value = getattr(module, attr_name) + if attr_name is None: + value = module + else: + value = getattr(module, attr_name) globals()[name] = value return value raise AttributeError(f"module {__name__!r} has no attribute {name!r}")