diff --git a/src/crewai/llm.py b/src/crewai/llm.py index 99f5138d5..43391951e 100644 --- a/src/crewai/llm.py +++ b/src/crewai/llm.py @@ -12,12 +12,10 @@ from typing import ( List, Literal, Optional, - Protocol, Tuple, Type, Union, cast, - runtime_checkable, ) from dotenv import load_dotenv @@ -35,6 +33,7 @@ from crewai.traces.unified_trace_controller import trace_llm_call from crewai.utilities.exceptions.context_window_exceeding_exception import ( LLMContextLengthExceededException, ) +from crewai.utilities.protocols import AgentExecutorProtocol load_dotenv() @@ -130,17 +129,6 @@ def suppress_warnings(): sys.stderr = old_stderr -@runtime_checkable -class AgentExecutorProtocol(Protocol): - """Protocol defining the expected interface for an agent executor.""" - - @property - def agent(self) -> Any: ... - - @property - def task(self) -> Any: ... - - class LLM: def __init__( self, diff --git a/src/crewai/utilities/protocols.py b/src/crewai/utilities/protocols.py new file mode 100644 index 000000000..83ebf58e9 --- /dev/null +++ b/src/crewai/utilities/protocols.py @@ -0,0 +1,12 @@ +from typing import Any, Protocol, runtime_checkable + + +@runtime_checkable +class AgentExecutorProtocol(Protocol): + """Protocol defining the expected interface for an agent executor.""" + + @property + def agent(self) -> Any: ... + + @property + def task(self) -> Any: ...