Skip to content
Merged
7 changes: 5 additions & 2 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -49,8 +49,11 @@ CLAUDE.md
AGENTS.md
CODEX.md

# AI assistant skill definitions
skills/
# AI assistant skill definitions (personal/local only)
skills/*
# Exception: distributable skills published with the project
!skills/cascadeflow/
!skills/cascadeflow/**

# ============================================================================
# INTERNAL PLANNING (local only, not for GitHub)
Expand Down
25 changes: 25 additions & 0 deletions cascadeflow/agent.py
Original file line number Diff line number Diff line change
Expand Up @@ -3229,3 +3229,28 @@ def from_profile(


__all__ = ["CascadeAgent", "CascadeResult"]


# ─────────────────────────────────────────────────────────────────────────────
# Make `cascadeflow.agent` callable as the harness decorator.
#
# `cascadeflow.agent` is the module file (this file). Many internal imports rely
# on that — `from cascadeflow.agent import CascadeAgent`, `cascadeflow.agent.PROVIDER_REGISTRY`,
# etc. But README/docs/llms.txt also use `@cascadeflow.agent(budget=..., ...)` as a
# decorator, which historically raised `TypeError: 'module' object is not callable`.
#
# Subclass the module's type and add `__call__` so `cascadeflow.agent(...)` returns
# the harness `agent` decorator. Module-attribute access is unaffected.
# ─────────────────────────────────────────────────────────────────────────────


class _CallableAgentModule(type(sys.modules[__name__])):
"""Module subclass that delegates calls to `cascadeflow.harness.agent`."""

def __call__(self, *args, **kwargs):
from cascadeflow.harness import agent as _harness_agent_decorator

return _harness_agent_decorator(*args, **kwargs)


sys.modules[__name__].__class__ = _CallableAgentModule
Loading
Loading