diff --git a/src/crewai/agent.py b/src/crewai/agent.py index ac080f2d07..20b47dbe92 100644 --- a/src/crewai/agent.py +++ b/src/crewai/agent.py @@ -24,7 +24,13 @@ from crewai.memory.contextual.contextual_memory import ContextualMemory from crewai.utilities import I18N, Logger, Prompts, RPMController from crewai.utilities.token_counter_callback import TokenCalcHandler, TokenProcess -from agentops.agent import track_agent +try: + from agentops.agent import track_agent +except ImportError: + def track_agent(): + def noop(f): + return f + return noop @track_agent() diff --git a/src/crewai/tools/tool_usage.py b/src/crewai/tools/tool_usage.py index 83f0dd9283..c5bbdbd330 100644 --- a/src/crewai/tools/tool_usage.py +++ b/src/crewai/tools/tool_usage.py @@ -9,7 +9,10 @@ from crewai.telemetry import Telemetry from crewai.tools.tool_calling import InstructorToolCalling, ToolCalling from crewai.utilities import I18N, Converter, ConverterError, Printer -import agentops +try: + import agentops +except ImportError: + agentops = None OPENAI_BIGGER_MODELS = ["gpt-4"]