Skip to content

Commit

Permalink
fixing annotations
Browse files Browse the repository at this point in the history
  • Loading branch information
joaomdmoura committed Oct 18, 2024
1 parent 81ae07a commit d72ebb9
Showing 1 changed file with 7 additions and 5 deletions.
12 changes: 7 additions & 5 deletions src/crewai/project/annotations.py
Original file line number Diff line number Diff line change
Expand Up @@ -76,22 +76,24 @@ def wrapper(self, *args, **kwargs) -> Crew:
instantiated_agents = []
agent_roles = set()

# Collect methods from crew in order
# Collect methods from crew instance (not class)
all_functions = [
(name, getattr(self, name))
for name, attr in self.__class__.__dict__.items()
if callable(attr)
for name in dir(self)
if callable(getattr(self, name)) and not name.startswith("__")
]

# Filter tasks and agents
tasks = [
(name, method)
for name, method in all_functions
if hasattr(method, "is_task")
if hasattr(method, "is_task") and method.is_task
]

agents = [
(name, method)
for name, method in all_functions
if hasattr(method, "is_agent")
if hasattr(method, "is_agent") and method.is_agent
]

# Instantiate tasks in order
Expand Down

0 comments on commit d72ebb9

Please sign in to comment.