[Reopen] AgentExecutor async path still routes through LLM.call
Open
@stud925 is already working on this.
Since Sep 8, 2026.
- Dominant language
- Python
- Stars
- 58.8k
- Forks
- 8.5k
- Avg merge
- 1d 15h
- Merged PRs (30d)
- 109
Description
Summary
Issue #6683 was previously closed by inactivity, but the behavior is still present and impacts async pipelines.
In AgentExecutor.ainvoke()/run_async flow, LLM calls are routed through the shared synchronous path (get_llm_response()), even when the provider implements an async path (LLM.acall() / aget_llm_response()).
As a result, async workloads can be constrained by thread-pool capacity and lose the expected async execution benefits.
Current behavior
AgentExecutormethodscall_llm_and_parseandcall_llm_native_toolscallget_llm_response().get_llm_response()invokesLLM.call().LLM.call()uses sync execution path, requiring threadpool offload for providers that are actually async-capable.
Expected behavior
- Async execution paths should use
aget_llm_response()andLLM.acall()when available. - Preserve compatibility for custom LLMs that only implement sync behavior by falling back to
asyncio.to_thread(...)only onNotImplementedError.
Suggested fix
- Convert the two router methods to
asyncandawait aget_llm_response(). - In
aget_llm_response(), implement narrow fallback:- try async path first
- on
NotImplementedError, delegate toasyncio.to_thread(llm.call, ...)(or equivalent)
- Keep sync behavior unchanged for non-async contexts.
Repro (minimal)
- Create a custom LLM double that records calls for both
call()andacall(). - Attach it to an
Agentand invokeawait agent.kickoff_async("probe"). - Validate that
acall()is invoked when available.
If needed, I can provide a tiny regression test draft.
Context
This is a re-open-style report derived from #6683 and current source inspection.
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Assessment
This issue has not been assessed yet.