Skip to content

[Feature]: LocalAgentRunner 应支持并行执行 Tool Calls #2

@huanghuoguoguo

Description

@huanghuoguoguo

背景

当前 LocalAgentRunner 在处理 LLM 返回的多个 tool_calls 时,采用的是顺序执行,没有使用 asyncio.gather() 进行并发。

问题

当 LLM 单次返回多个 tool_calls 时,这些调用之间往往是相互独立的。顺序执行意味着延迟被线性叠加,用户体验上 Agent 响应会明显变慢。

建议

将 tool_calls 的执行改为并行。LLM 在同一次响应中返回的多个 tool_calls 在语义上就是并行意图,顺序执行没有必要。

参考

  • OpenAI Function Calling 文档中明确建议 parallel tool calls 应并行处理
  • LangChain AgentExecutor 默认并行执行同批次 tool calls

原 issue: langbot-app/LangBot#2050

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions