mirror of
https://github.com/crewAIInc/crewAI.git
synced 2026-07-02 13:48:09 +00:00
fix: guard register_entity when RuntimeState is None
This commit is contained in:
@@ -14,6 +14,7 @@ from concurrent.futures import Future, ThreadPoolExecutor
|
||||
from contextlib import contextmanager
|
||||
import contextvars
|
||||
import inspect
|
||||
import logging
|
||||
import threading
|
||||
from typing import TYPE_CHECKING, Any, Final, ParamSpec, TypeVar
|
||||
|
||||
@@ -54,6 +55,8 @@ from crewai.events.utils.handlers import is_async_handler, is_call_handler_safe
|
||||
from crewai.utilities.rw_lock import RWLock
|
||||
|
||||
|
||||
logger = logging.getLogger(__name__)
|
||||
|
||||
P = ParamSpec("P")
|
||||
R = TypeVar("R")
|
||||
|
||||
@@ -267,6 +270,11 @@ class CrewAIEventsBus:
|
||||
if self._runtime_state is None:
|
||||
from crewai import RuntimeState
|
||||
|
||||
if RuntimeState is None:
|
||||
logger.warning(
|
||||
"RuntimeState unavailable; skipping entity registration."
|
||||
)
|
||||
return
|
||||
self._runtime_state = RuntimeState(root=[entity])
|
||||
else:
|
||||
self._runtime_state.root.append(entity)
|
||||
|
||||
Reference in New Issue
Block a user