diff --git a/lib/crewai/src/crewai/agent/core.py b/lib/crewai/src/crewai/agent/core.py index 46ff903c1..214e55227 100644 --- a/lib/crewai/src/crewai/agent/core.py +++ b/lib/crewai/src/crewai/agent/core.py @@ -1013,7 +1013,7 @@ class Agent(BaseAgent): task=task, i18n=self.i18n, agent=self, - crew=self.crew, # type: ignore[arg-type] + crew=self.crew, tools=parsed_tools, prompt=prompt, original_tools=raw_tools, @@ -1075,7 +1075,7 @@ class Agent(BaseAgent): self.agent_executor.tools_handler = self.tools_handler self.agent_executor.request_within_rpm_limit = rpm_limit_fn - if self.agent_executor.llm: + if isinstance(self.agent_executor.llm, BaseLLM): existing_stop = getattr(self.agent_executor.llm, "stop", []) self.agent_executor.llm.stop = list( set( diff --git a/lib/crewai/src/crewai/utilities/streaming.py b/lib/crewai/src/crewai/utilities/streaming.py index 5db09ba9c..dd0992684 100644 --- a/lib/crewai/src/crewai/utilities/streaming.py +++ b/lib/crewai/src/crewai/utilities/streaming.py @@ -142,8 +142,8 @@ def _unregister_handler(handler: Callable[[Any, BaseEvent], None]) -> None: handler: The handler function to unregister. """ with crewai_event_bus._rwlock.w_locked(): - handlers: frozenset[Callable[[Any, BaseEvent], None]] = ( - crewai_event_bus._sync_handlers.get(LLMStreamChunkEvent, frozenset()) + handlers: frozenset[Callable[..., None]] = crewai_event_bus._sync_handlers.get( + LLMStreamChunkEvent, frozenset() ) crewai_event_bus._sync_handlers[LLMStreamChunkEvent] = handlers - {handler}