Why is CrewAI asking for OPENAI_API_KEY if I set another LLM provider (e.g., Groq) to the crew?

So I just updated my crewai to 0.76.9.
I setup my first model, and chose “groq” to be my main llm.
Gave my API key and the project was ready to run.
When i ran “crewai run”, it gave me following error saying OPENAI_API_KEY couldn’t be found. The detailed error is below.

PS E:\Work\Practice\7. GenAI Practice\00.PRACTICE\Learn\test_non_openai> crewai run
Running the Crew
Using CPython 3.12.0 interpreter at: D:\Programs\Python\Python312\python.exe
Creating virtual environment at: .venv
   Built test-non-openai @ file:///E:/Work/Practice/7.%20GenAI%20Practice/00.PRACTICE/Learn/test_non_openai
░░░░░░░░░░░░░░░░░░░░ [0/217] Installing wheels...                                                                       warning: Failed to hardlink files; falling back to full copy. This may lead to degraded performance.
         If the cache and target directories are on different filesystems, hardlinking may not be supported.
         If this is intentional, set `export UV_LINK_MODE=copy` or use `--link-mode=copy` to suppress this warning.
Installed 217 packages in 17.98s
E:\Work\Practice\7. GenAI Practice\00.PRACTICE\Learn\test_non_openai\.venv\Lib\site-packages\pysbd\segmenter.py:66: SyntaxWarning: invalid escape sequence '\s'
  for match in re.finditer('{0}\s*'.format(re.escape(sent)), self.original_text):
E:\Work\Practice\7. GenAI Practice\00.PRACTICE\Learn\test_non_openai\.venv\Lib\site-packages\pysbd\lang\arabic.py:29: SyntaxWarning: invalid escape sequence '\.'
  txt = re.sub('(?<={0})\.'.format(am), '∯', txt)
E:\Work\Practice\7. GenAI Practice\00.PRACTICE\Learn\test_non_openai\.venv\Lib\site-packages\pysbd\lang\persian.py:29: SyntaxWarning: invalid escape sequence '\.'
  txt = re.sub('(?<={0})\.'.format(am), '∯', txt)
# Agent: AI LLMs Senior Data Researcher
## Task: Conduct a thorough research about AI LLMs Make sure you find any interesting and relevant information given the current year is 2024.

2024-10-31 02:29:57,752 - 21892 - llm.py-llm:161 - ERROR: LiteLLM call failed: litellm.AuthenticationError: AuthenticationError: OpenAIException - The api_key client option must be set either by passing api_key to the client or by setting the OPENAI_API_KEY environment variable
# Agent: AI LLMs Senior Data Researcher
## Task: Conduct a thorough research about AI LLMs Make sure you find any interesting and relevant information given the current year is 2024.

2024-10-31 02:29:57,770 - 21892 - llm.py-llm:161 - ERROR: LiteLLM call failed: litellm.AuthenticationError: AuthenticationError: OpenAIException - The api_key client option must be set either by passing api_key to the client or by setting the OPENAI_API_KEY environment variable
# Agent: AI LLMs Senior Data Researcher
## Task: Conduct a thorough research about AI LLMs Make sure you find any interesting and relevant information given the current year is 2024.

2024-10-31 02:29:57,793 - 21892 - llm.py-llm:161 - ERROR: LiteLLM call failed: litellm.AuthenticationError: AuthenticationError: OpenAIException - The api_key client option must be set either by passing api_key to the client or by setting the OPENAI_API_KEY environment variable
Traceback (most recent call last):
  File "E:\Work\Practice\7. GenAI Practice\00.PRACTICE\Learn\test_non_openai\.venv\Lib\site-packages\litellm\llms\OpenAI\openai.py", line 854, in completion
    raise e
  File "E:\Work\Practice\7. GenAI Practice\00.PRACTICE\Learn\test_non_openai\.venv\Lib\site-packages\litellm\llms\OpenAI\openai.py", line 767, in completion
    openai_client: OpenAI = self._get_openai_client(  # type: ignore
                            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "E:\Work\Practice\7. GenAI Practice\00.PRACTICE\Learn\test_non_openai\.venv\Lib\site-packages\litellm\llms\OpenAI\openai.py", line 575, in _get_openai_client
    _new_client = OpenAI(
                  ^^^^^^^
  File "E:\Work\Practice\7. GenAI Practice\00.PRACTICE\Learn\test_non_openai\.venv\Lib\site-packages\openai\_client.py", line 105, in __init__
    raise OpenAIError(
openai.OpenAIError: The api_key client option must be set either by passing api_key to the client or by setting the OPENAI_API_KEY environment variable

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "E:\Work\Practice\7. GenAI Practice\00.PRACTICE\Learn\test_non_openai\.venv\Lib\site-packages\litellm\main.py", line 1587, in completion
    raise e
  File "E:\Work\Practice\7. GenAI Practice\00.PRACTICE\Learn\test_non_openai\.venv\Lib\site-packages\litellm\main.py", line 1560, in completion
    response = openai_chat_completions.completion(
               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "E:\Work\Practice\7. GenAI Practice\00.PRACTICE\Learn\test_non_openai\.venv\Lib\site-packages\litellm\llms\OpenAI\openai.py", line 864, in completion
    raise OpenAIError(
litellm.llms.OpenAI.openai.OpenAIError: The api_key client option must be set either by passing api_key to the client or by setting the OPENAI_API_KEY environment variable

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "E:\Work\Practice\7. GenAI Practice\00.PRACTICE\Learn\test_non_openai\.venv\Lib\site-packages\crewai\agent.py", line 236, in execute_task
    result = self.agent_executor.invoke(
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "E:\Work\Practice\7. GenAI Practice\00.PRACTICE\Learn\test_non_openai\.venv\Lib\site-packages\crewai\agents\crew_agent_executor.py", line 93, in invoke
    formatted_answer = self._invoke_loop()
                       ^^^^^^^^^^^^^^^^^^^
  File "E:\Work\Practice\7. GenAI Practice\00.PRACTICE\Learn\test_non_openai\.venv\Lib\site-packages\crewai\agents\crew_agent_executor.py", line 175, in _invoke_loop
    raise e
  File "E:\Work\Practice\7. GenAI Practice\00.PRACTICE\Learn\test_non_openai\.venv\Lib\site-packages\crewai\agents\crew_agent_executor.py", line 115, in _invoke_loop
    answer = self.llm.call(
             ^^^^^^^^^^^^^^
  File "E:\Work\Practice\7. GenAI Practice\00.PRACTICE\Learn\test_non_openai\.venv\Lib\site-packages\crewai\llm.py", line 155, in call
    response = litellm.completion(**params)
               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "E:\Work\Practice\7. GenAI Practice\00.PRACTICE\Learn\test_non_openai\.venv\Lib\site-packages\litellm\utils.py", line 1013, in wrapper
    raise e
  File "E:\Work\Practice\7. GenAI Practice\00.PRACTICE\Learn\test_non_openai\.venv\Lib\site-packages\litellm\utils.py", line 903, in wrapper
    result = original_function(*args, **kwargs)
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "E:\Work\Practice\7. GenAI Practice\00.PRACTICE\Learn\test_non_openai\.venv\Lib\site-packages\litellm\main.py", line 2999, in completion
    raise exception_type(
          ^^^^^^^^^^^^^^^
  File "E:\Work\Practice\7. GenAI Practice\00.PRACTICE\Learn\test_non_openai\.venv\Lib\site-packages\litellm\litellm_core_utils\exception_mapping_utils.py", line 2116, in exception_type
    raise e
  File "E:\Work\Practice\7. GenAI Practice\00.PRACTICE\Learn\test_non_openai\.venv\Lib\site-packages\litellm\litellm_core_utils\exception_mapping_utils.py", line 310, in exception_type
    raise AuthenticationError(
litellm.exceptions.AuthenticationError: litellm.AuthenticationError: AuthenticationError: OpenAIException - The api_key client option must be set either by passing api_key to the client or by setting the OPENAI_API_KEY environment variable

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "E:\Work\Practice\7. GenAI Practice\00.PRACTICE\Learn\test_non_openai\.venv\Lib\site-packages\litellm\llms\OpenAI\openai.py", line 854, in completion
    raise e
  File "E:\Work\Practice\7. GenAI Practice\00.PRACTICE\Learn\test_non_openai\.venv\Lib\site-packages\litellm\llms\OpenAI\openai.py", line 767, in completion
    openai_client: OpenAI = self._get_openai_client(  # type: ignore
                            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "E:\Work\Practice\7. GenAI Practice\00.PRACTICE\Learn\test_non_openai\.venv\Lib\site-packages\litellm\llms\OpenAI\openai.py", line 575, in _get_openai_client
    _new_client = OpenAI(
                  ^^^^^^^
  File "E:\Work\Practice\7. GenAI Practice\00.PRACTICE\Learn\test_non_openai\.venv\Lib\site-packages\openai\_client.py", line 105, in __init__
    raise OpenAIError(
openai.OpenAIError: The api_key client option must be set either by passing api_key to the client or by setting the OPENAI_API_KEY environment variable

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "E:\Work\Practice\7. GenAI Practice\00.PRACTICE\Learn\test_non_openai\.venv\Lib\site-packages\litellm\main.py", line 1587, in completion
    raise e
  File "E:\Work\Practice\7. GenAI Practice\00.PRACTICE\Learn\test_non_openai\.venv\Lib\site-packages\litellm\main.py", line 1560, in completion
    response = openai_chat_completions.completion(
               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "E:\Work\Practice\7. GenAI Practice\00.PRACTICE\Learn\test_non_openai\.venv\Lib\site-packages\litellm\llms\OpenAI\openai.py", line 864, in completion
    raise OpenAIError(
litellm.llms.OpenAI.openai.OpenAIError: The api_key client option must be set either by passing api_key to the client or by setting the OPENAI_API_KEY environment variable

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "E:\Work\Practice\7. GenAI Practice\00.PRACTICE\Learn\test_non_openai\.venv\Lib\site-packages\crewai\agent.py", line 236, in execute_task
    result = self.agent_executor.invoke(
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "E:\Work\Practice\7. GenAI Practice\00.PRACTICE\Learn\test_non_openai\.venv\Lib\site-packages\crewai\agents\crew_agent_executor.py", line 93, in invoke
    formatted_answer = self._invoke_loop()
                       ^^^^^^^^^^^^^^^^^^^
  File "E:\Work\Practice\7. GenAI Practice\00.PRACTICE\Learn\test_non_openai\.venv\Lib\site-packages\crewai\agents\crew_agent_executor.py", line 175, in _invoke_loop
    raise e
  File "E:\Work\Practice\7. GenAI Practice\00.PRACTICE\Learn\test_non_openai\.venv\Lib\site-packages\crewai\agents\crew_agent_executor.py", line 115, in _invoke_loop
    answer = self.llm.call(
             ^^^^^^^^^^^^^^
  File "E:\Work\Practice\7. GenAI Practice\00.PRACTICE\Learn\test_non_openai\.venv\Lib\site-packages\crewai\llm.py", line 155, in call
    response = litellm.completion(**params)
               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "E:\Work\Practice\7. GenAI Practice\00.PRACTICE\Learn\test_non_openai\.venv\Lib\site-packages\litellm\utils.py", line 1013, in wrapper
    raise e
  File "E:\Work\Practice\7. GenAI Practice\00.PRACTICE\Learn\test_non_openai\.venv\Lib\site-packages\litellm\utils.py", line 903, in wrapper
    result = original_function(*args, **kwargs)
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "E:\Work\Practice\7. GenAI Practice\00.PRACTICE\Learn\test_non_openai\.venv\Lib\site-packages\litellm\main.py", line 2999, in completion
    raise exception_type(
          ^^^^^^^^^^^^^^^
  File "E:\Work\Practice\7. GenAI Practice\00.PRACTICE\Learn\test_non_openai\.venv\Lib\site-packages\litellm\litellm_core_utils\exception_mapping_utils.py", line 2116, in exception_type
    raise e
  File "E:\Work\Practice\7. GenAI Practice\00.PRACTICE\Learn\test_non_openai\.venv\Lib\site-packages\litellm\litellm_core_utils\exception_mapping_utils.py", line 310, in exception_type
    raise AuthenticationError(
litellm.exceptions.AuthenticationError: litellm.AuthenticationError: AuthenticationError: OpenAIException - The api_key client option must be set either by passing api_key to the client or by setting the OPENAI_API_KEY environment variable

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "E:\Work\Practice\7. GenAI Practice\00.PRACTICE\Learn\test_non_openai\.venv\Lib\site-packages\litellm\llms\OpenAI\openai.py", line 854, in completion
    raise e
  File "E:\Work\Practice\7. GenAI Practice\00.PRACTICE\Learn\test_non_openai\.venv\Lib\site-packages\litellm\llms\OpenAI\openai.py", line 767, in completion
    openai_client: OpenAI = self._get_openai_client(  # type: ignore
                            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "E:\Work\Practice\7. GenAI Practice\00.PRACTICE\Learn\test_non_openai\.venv\Lib\site-packages\litellm\llms\OpenAI\openai.py", line 575, in _get_openai_client
    _new_client = OpenAI(
                  ^^^^^^^
  File "E:\Work\Practice\7. GenAI Practice\00.PRACTICE\Learn\test_non_openai\.venv\Lib\site-packages\openai\_client.py", line 105, in __init__
    raise OpenAIError(
openai.OpenAIError: The api_key client option must be set either by passing api_key to the client or by setting the OPENAI_API_KEY environment variable

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "E:\Work\Practice\7. GenAI Practice\00.PRACTICE\Learn\test_non_openai\.venv\Lib\site-packages\litellm\main.py", line 1587, in completion
    raise e
  File "E:\Work\Practice\7. GenAI Practice\00.PRACTICE\Learn\test_non_openai\.venv\Lib\site-packages\litellm\main.py", line 1560, in completion
    response = openai_chat_completions.completion(
               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "E:\Work\Practice\7. GenAI Practice\00.PRACTICE\Learn\test_non_openai\.venv\Lib\site-packages\litellm\llms\OpenAI\openai.py", line 864, in completion
    raise OpenAIError(
litellm.llms.OpenAI.openai.OpenAIError: The api_key client option must be set either by passing api_key to the client or by setting the OPENAI_API_KEY environment variable

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "<frozen runpy>", line 198, in _run_module_as_main
  File "<frozen runpy>", line 88, in _run_code
  File "E:\Work\Practice\7. GenAI Practice\00.PRACTICE\Learn\test_non_openai\.venv\Scripts\run_crew.exe\__main__.py", line 8, in <module>
  File "E:\Work\Practice\7. GenAI Practice\00.PRACTICE\Learn\test_non_openai\src\test_non_openai\main.py", line 17, in run
    TestNonOpenaiCrew().crew().kickoff(inputs=inputs)
  File "E:\Work\Practice\7. GenAI Practice\00.PRACTICE\Learn\test_non_openai\.venv\Lib\site-packages\crewai\crew.py", line 494, in kickoff
    result = self._run_sequential_process()
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "E:\Work\Practice\7. GenAI Practice\00.PRACTICE\Learn\test_non_openai\.venv\Lib\site-packages\crewai\crew.py", line 598, in _run_sequential_process
    return self._execute_tasks(self.tasks)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "E:\Work\Practice\7. GenAI Practice\00.PRACTICE\Learn\test_non_openai\.venv\Lib\site-packages\crewai\crew.py", line 696, in _execute_tasks
    task_output = task.execute_sync(
                  ^^^^^^^^^^^^^^^^^^
  File "E:\Work\Practice\7. GenAI Practice\00.PRACTICE\Learn\test_non_openai\.venv\Lib\site-packages\crewai\task.py", line 191, in execute_sync
    return self._execute_core(agent, context, tools)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "E:\Work\Practice\7. GenAI Practice\00.PRACTICE\Learn\test_non_openai\.venv\Lib\site-packages\crewai\task.py", line 247, in _execute_core
    result = agent.execute_task(
             ^^^^^^^^^^^^^^^^^^^
  File "E:\Work\Practice\7. GenAI Practice\00.PRACTICE\Learn\test_non_openai\.venv\Lib\site-packages\crewai\agent.py", line 248, in execute_task
    result = self.execute_task(task, context, tools)
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "E:\Work\Practice\7. GenAI Practice\00.PRACTICE\Learn\test_non_openai\.venv\Lib\site-packages\crewai\agent.py", line 248, in execute_task
    result = self.execute_task(task, context, tools)
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "E:\Work\Practice\7. GenAI Practice\00.PRACTICE\Learn\test_non_openai\.venv\Lib\site-packages\crewai\agent.py", line 247, in execute_task
    raise e
  File "E:\Work\Practice\7. GenAI Practice\00.PRACTICE\Learn\test_non_openai\.venv\Lib\site-packages\crewai\agent.py", line 236, in execute_task
    result = self.agent_executor.invoke(
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "E:\Work\Practice\7. GenAI Practice\00.PRACTICE\Learn\test_non_openai\.venv\Lib\site-packages\crewai\agents\crew_agent_executor.py", line 93, in invoke
    formatted_answer = self._invoke_loop()
                       ^^^^^^^^^^^^^^^^^^^
  File "E:\Work\Practice\7. GenAI Practice\00.PRACTICE\Learn\test_non_openai\.venv\Lib\site-packages\crewai\agents\crew_agent_executor.py", line 175, in _invoke_loop
    raise e
  File "E:\Work\Practice\7. GenAI Practice\00.PRACTICE\Learn\test_non_openai\.venv\Lib\site-packages\crewai\agents\crew_agent_executor.py", line 115, in _invoke_loop
    answer = self.llm.call(
             ^^^^^^^^^^^^^^
  File "E:\Work\Practice\7. GenAI Practice\00.PRACTICE\Learn\test_non_openai\.venv\Lib\site-packages\crewai\llm.py", line 155, in call
    response = litellm.completion(**params)
               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "E:\Work\Practice\7. GenAI Practice\00.PRACTICE\Learn\test_non_openai\.venv\Lib\site-packages\litellm\utils.py", line 1013, in wrapper
    raise e
  File "E:\Work\Practice\7. GenAI Practice\00.PRACTICE\Learn\test_non_openai\.venv\Lib\site-packages\litellm\utils.py", line 903, in wrapper
    result = original_function(*args, **kwargs)
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "E:\Work\Practice\7. GenAI Practice\00.PRACTICE\Learn\test_non_openai\.venv\Lib\site-packages\litellm\main.py", line 2999, in completion
    raise exception_type(
          ^^^^^^^^^^^^^^^
  File "E:\Work\Practice\7. GenAI Practice\00.PRACTICE\Learn\test_non_openai\.venv\Lib\site-packages\litellm\litellm_core_utils\exception_mapping_utils.py", line 2116, in exception_type
    raise e
  File "E:\Work\Practice\7. GenAI Practice\00.PRACTICE\Learn\test_non_openai\.venv\Lib\site-packages\litellm\litellm_core_utils\exception_mapping_utils.py", line 310, in exception_type
    raise AuthenticationError(
litellm.exceptions.AuthenticationError: litellm.AuthenticationError: AuthenticationError: OpenAIException - The api_key client option must be set either by passing api_key to the client or by setting the OPENAI_API_KEY environment variable
An error occurred while running the crew: Command '['uv', 'run', 'run_crew']' returned non-zero exit status 1.

PS E:\Work\Practice\7. GenAI Practice\00.PRACTICE\Learn\test_non_openai>

I tried again, made sure that all steps are clear. But same result.

I have spent hours working around this problem. immersed myself in crewai docs and groq docs but couldn’t find anything besides the repeated things I have already tried several times.

Then I tried the same with gemini. Exact same issue. Can someone please help?

@SMAshhar Are you using memory? Then the reason why you’re asked for the OpenAI API key is that by default OpenAI’s LLM is used for embeddings. But you can change that. See the official docs.

Thanks for the reply.

I haven’t done anything. Just setup my crew and hit “crewai run”.
I will try do it first thing when I am able and will share the results

Edit:

@crew
	def crew(self) -> Crew:
		"""Creates the TestNonOpenai crew"""
		return Crew(
			agents=self.agents, # Automatically created by the @agent decorator
			tasks=self.tasks, # Automatically created by the @task decorator
			process=Process.sequential,
			verbose=True,
			memory=False,
			# process=Process.hierarchical, # In case you wanna use that instead https://docs.crewai.com/how-to/Hierarchical/
		)

I have added memory=False. Still the same error.

@SMAshhar Did you set Groq to all agents? By default, all agents use the gpt-4o-mini, and that’s why you’re asked to add the OpenAI API key.

See the official docs.

1 Like

No, like i said, i didn’t change much after initial setup.

Here is the full code from crew.py

from crewai import Agent, Crew, Process, Task
from crewai.project import CrewBase, agent, crew, task

# Uncomment the following line to use an example of a custom tool
# from test_non_openai.tools.custom_tool import MyCustomTool

# Check our tools documentations for more information on how to use them
# from crewai_tools import SerperDevTool

@CrewBase
class TestNonOpenaiCrew():
	"""TestNonOpenai crew"""

	@agent
	def researcher(self) -> Agent:
		return Agent(
			config=self.agents_config['researcher'],
			# tools=[MyCustomTool()], # Example of custom tool, loaded on the beginning of file
			verbose=True
		)

	@agent
	def reporting_analyst(self) -> Agent:
		return Agent(
			config=self.agents_config['reporting_analyst'],
			verbose=True
		)

	@task
	def research_task(self) -> Task:
		return Task(
			config=self.tasks_config['research_task'],
		)

	@task
	def reporting_task(self) -> Task:
		return Task(
			config=self.tasks_config['reporting_task'],
			output_file='report.md'
		)

	@crew
	def crew(self) -> Crew:
		"""Creates the TestNonOpenai crew"""
		return Crew(
			agents=self.agents, # Automatically created by the @agent decorator
			tasks=self.tasks, # Automatically created by the @task decorator
			process=Process.sequential,
			verbose=True,
			memory=False,
			# process=Process.hierarchical, # In case you wanna use that instead https://docs.crewai.com/how-to/Hierarchical/
		)

Edit:

Many thanks to @rokbenko

The problem was bypassed by using custom LLM by CrewAi. Here is how I did it:

import os
from crewai import Agent, LLM

# get api key from .env file
GROQ_API_KEY=os.getenv('GROQ_API_KEY')

# make custom llm
llm= LLM(
    model="groq/llama-3.11-70B-versatile",
    base_url="https://api.groq.com/openai/v1",
    api_key=GROQ_API_KEY
)

# Creating class here
class test_crewai():
    """Testing"""

    @agent
    def first_agent(self):
        return Agent(
            config=self.agent_config['first_agent'],
            verbose=True,
            llm=llm  # adding custom llm here
        )
    
    @agent
    def second_agent(self):
        return Agent(
            config=self.agent_config['second_agent'],
            verbose=True,
            llm=llm  # adding custom llm here
        )
    
    # rest of the code
1 Like