[BUG] AgentExecutor.ainvoke routes LLM requests through LLM.call
Description
AgentExecutor.ainvoke() runs through Flow.kickoff_async(), while the ReAct and native-tool LLM router methods are synchronous and call get_llm_response(). Flow offloads these synchronous router methods to the default executor, so each in-flight provider request occupies a worker thread and routes through LLM.call().
This limits async concurrency to the executor's worker capacity even when the provider implements LLM.acall().
Steps to Reproduce
- Create a
BaseLLMtest double that records calls tocall()andacall(). - Create an
Agentwith the test double. - Run
await agent.kickoff_async("probe"). - Inspect the recorded method.
Current result:
call
Expected behavior
The async AgentExecutor path should await aget_llm_response() and route capable providers through LLM.acall().
Custom LLMs that signal unavailable async support with NotImplementedError should execute LLM.call() in a worker thread to preserve compatibility.
Evidence
The two shared LLM router methods in crewai.experimental.agent_executor.AgentExecutor currently call get_llm_response():
call_llm_and_parsecall_llm_native_tools
get_llm_response() invokes LLM.call(), while aget_llm_response() invokes LLM.acall().
Possible Solution
Convert both LLM router methods to async methods and await aget_llm_response(). Add a narrow NotImplementedError fallback in aget_llm_response() using asyncio.to_thread(llm.call, ...).
Additional context
This issue covers experimental AgentExecutor LLM routing. Async native tool execution is tracked separately in #6616 and #6622.
This issue is stale because it has been open for 30 days with no activity. Remove stale label or comment or this will be closed in 5 days.
This issue was closed because it has been stalled for 5 days with no activity.