Why Agent is getting terminate , sometimes it's provide result and sometime automatic terminate

[2025-03-15 21:28:59][:robot: LLM CALL STARTED]: 2025-03-15 21:28:59.512519

[2025-03-15 21:29:01][:white_check_mark: LLM CALL COMPLETED]: 2025-03-15 21:29:01.351855
Maximum iterations reached. Requesting final answer.

[2025-03-15 21:29:01][:robot: LLM CALL STARTED]: 2025-03-15 21:29:01.353942

[2025-03-15 21:29:02][:white_check_mark: LLM CALL COMPLETED]: 2025-03-15 21:29:02.464492
Agent failed to reach a final answer. This is likely a bug - please report it.

[2025-03-15 21:29:02][:cross_mark: TASK FAILED: SEARCH GITHUB REPOSITORIES FOR RELEVANT PROJECTS.]: 2025-03-15 21:29:02.465458

[2025-03-15 21:29:02][:cross_mark: CREW β€˜CREW’ FAILED, 0CDF5F6D-8313-4FFF-A1B7-C3B9B467B9A6]: 2025-03-15 21:29:02.465575
Traceback (most recent call last):
File β€œ/Users/ganeshkinkargiri./Desktop/LLM-FINE-TUNE/agent-ai-venv/lib/python3.10/site-packages/crewai/agent.py”, line 246, in execute_task
result = self.agent_executor.invoke(
File β€œ/Users/ganeshkinkargiri./Desktop/LLM-FINE-TUNE/agent-ai-venv/lib/python3.10/site-packages/crewai/agents/crew_agent_executor.py”, line 108, in invoke
formatted_answer = self._invoke_loop()
File β€œ/Users/ganeshkinkargiri./Desktop/LLM-FINE-TUNE/agent-ai-venv/lib/python3.10/site-packages/crewai/agents/crew_agent_executor.py”, line 180, in _invoke_loop
assert isinstance(formatted_answer, AgentFinish)
AssertionError

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
File β€œ/Users/ganeshkinkargiri./Desktop/LLM-FINE-TUNE/agent-ai-venv/lib/python3.10/site-packages/crewai/agent.py”, line 246, in execute_task
result = self.agent_executor.invoke(
File β€œ/Users/ganeshkinkargiri./Desktop/LLM-FINE-TUNE/agent-ai-venv/lib/python3.10/site-packages/crewai/agents/crew_agent_executor.py”, line 108, in invoke
formatted_answer = self._invoke_loop()
File β€œ/Users/ganeshkinkargiri./Desktop/LLM-FINE-TUNE/agent-ai-venv/lib/python3.10/site-packages/crewai/agents/crew_agent_executor.py”, line 180, in _invoke_loop
assert isinstance(formatted_answer, AgentFinish)
AssertionError

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
File β€œ/Users/ganeshkinkargiri./Desktop/LLM-FINE-TUNE/Agentic-AI/crewAI/tools/github_search_main.py”, line 73, in
results = crew.kickoff()
File β€œ/Users/ganeshkinkargiri./Desktop/LLM-FINE-TUNE/agent-ai-venv/lib/python3.10/site-packages/crewai/crew.py”, line 619, in kickoff
result = self._run_sequential_process()
File β€œ/Users/ganeshkinkargiri./Desktop/LLM-FINE-TUNE/agent-ai-venv/lib/python3.10/site-packages/crewai/crew.py”, line 731, in _run_sequential_process
return self._execute_tasks(self.tasks)
File β€œ/Users/ganeshkinkargiri./Desktop/LLM-FINE-TUNE/agent-ai-venv/lib/python3.10/site-packages/crewai/crew.py”, line 829, in _execute_tasks
task_output = task.execute_sync(
File β€œ/Users/ganeshkinkargiri./Desktop/LLM-FINE-TUNE/agent-ai-venv/lib/python3.10/site-packages/crewai/task.py”, line 304, in execute_sync
return self._execute_core(agent, context, tools)
File β€œ/Users/ganeshkinkargiri./Desktop/LLM-FINE-TUNE/agent-ai-venv/lib/python3.10/site-packages/crewai/task.py”, line 448, in _execute_core
raise e # Re-raise the exception after emitting the event
File β€œ/Users/ganeshkinkargiri./Desktop/LLM-FINE-TUNE/agent-ai-venv/lib/python3.10/site-packages/crewai/task.py”, line 368, in _execute_core
result = agent.execute_task(
File β€œ/Users/ganeshkinkargiri./Desktop/LLM-FINE-TUNE/agent-ai-venv/lib/python3.10/site-packages/crewai/agent.py”, line 277, in execute_task
result = self.execute_task(task, context, tools)
File β€œ/Users/ganeshkinkargiri./Desktop/LLM-FINE-TUNE/agent-ai-venv/lib/python3.10/site-packages/crewai/agent.py”, line 277, in execute_task
result = self.execute_task(task, context, tools)
File β€œ/Users/ganeshkinkargiri./Desktop/LLM-FINE-TUNE/agent-ai-venv/lib/python3.10/site-packages/crewai/agent.py”, line 276, in execute_task
raise e
File β€œ/Users/ganeshkinkargiri./Desktop/LLM-FINE-TUNE/agent-ai-venv/lib/python3.10/site-packages/crewai/agent.py”, line 246, in execute_task
result = self.agent_executor.invoke(
File β€œ/Users/ganeshkinkargiri./Desktop/LLM-FINE-TUNE/agent-ai-venv/lib/python3.10/site-packages/crewai/agents/crew_agent_executor.py”, line 108, in invoke
formatted_answer = self._invoke_loop()
File β€œ/Users/ganeshkinkargiri./Desktop/LLM-FINE-TUNE/agent-ai-venv/lib/python3.10/site-packages/crewai/agents/crew_agent_executor.py”, line 180, in _invoke_loop
assert isinstance(formatted_answer, AgentFinish)
AssertionError