chore: refactor type hints for Agent and Task in annotations and wrappers

This commit is contained in:
Greyson Lalonde
2025-10-13 15:35:39 -04:00
parent 6492852a0c
commit e029de2863
2 changed files with 14 additions and 23 deletions

View File

@@ -2,13 +2,14 @@
from collections.abc import Callable
from functools import wraps
from typing import Concatenate, ParamSpec, TypeVar
from typing import TYPE_CHECKING, Concatenate, ParamSpec, TypeVar
from crewai import Crew
from crewai.project.utils import memoize
if TYPE_CHECKING:
from crewai import Agent, Crew, Task
from crewai.project.wrappers import (
AfterKickoffMethod,
AgentInstance,
AgentMethod,
BeforeKickoffMethod,
CacheHandlerMethod,
@@ -17,7 +18,6 @@ from crewai.project.wrappers import (
LLMMethod,
OutputJsonClass,
OutputPydanticClass,
TaskInstance,
TaskMethod,
TaskResultT,
ToolMethod,
@@ -174,8 +174,8 @@ def crew(
Returns:
The configured Crew instance with callbacks attached.
"""
instantiated_tasks: list[TaskInstance] = []
instantiated_agents: list[AgentInstance] = []
instantiated_tasks: list[Task] = []
instantiated_agents: list[Agent] = []
agent_roles: set[str] = set()
# Use the preserved task and agent information