Skip to content

bug: The tools do not execute concurrently #1321

@bajie-git

Description

@bajie-git
  • I have looked for existing issues (including closed) about this

Bug Report

The tools do not execute concurrently。
The make_image tool will call the API to generate images. By observing logs and network packet capture, we can confirm that it is serial

Reproduction

let agent = CLAUDE_CLIENT
        .agent("claude-opus-4-5-20251101")
        .preamble(indoc! {r#"
            Some unimportant cue words
        "#,
        })
        .tool(PlanRef) // 配置工具
        .tool(Todo)
        .tool(MakeImage)
        .tool(MvScriptGen)
        .tool(MakeVideo)
        .tool(ConcatVideo)
        .tool(MergeAudioVideo)
        .build();

    let mut chat_history = vec![];

    let response = PromptRequest::new(
        &agent,
        "Some unimportant cue words",
    )
    .with_history(&mut chat_history)
    .multi_turn(50)
    .with_tool_concurrency(5)
    .with_hook(Hook {
        share_history: share_history.clone(),
    })
    .await?;

The content returned by the Claude model

{
  "id": "msg_01Wci4WrAbMtHHjaj2zkbciT",
  "type": "message",
  "role": "assistant",
  "model": "claude-opus-4-5-20251101",
  "content": [
    {
      "type": "text",
      "text": "太好了!MV脚本已生成。这是一首温暖的圣诞歌曲,共11个镜头,总时长58秒。现在我需要先生成主体角色和物品的参考图片,以保证视频的一致性。"
    },
    {
      "id": "toolu_bdrk_012VePfT1HFD9e6JzscHBR4x",
      "type": "tool_use",
      "name": "todo",
      "input": {
        "todo_items": [
          {
            "status": "Done",
            "title": "分析音频并生成MV分镜脚本"
          },
          {
            "status": "Doing",
            "title": "生成主体角色参考图片"
          },
          {
            "status": "Todo",
            "title": "根据脚本生成各视频片段"
          },
          {
            "status": "Todo",
            "title": "合并所有视频片段"
          },
          {
            "status": "Todo",
            "title": "将音频与视频合成最终MV"
          }
        ]
      }
    },
    {
      "id": "toolu_bdrk_01PsSmmoV9tCatUtFxjWBrLm",
      "type": "tool_use",
      "name": "make_image",
      "input": {
        "image_idx": 1,
        "prompt": "A young Asian woman, gentle features, wearing a chunky beige knitted turtleneck sweater, messy bun hairstyle, soft makeup, looking nostalgic, portrait photo, warm lighting, high quality"
      }
    },
    {
      "id": "toolu_bdrk_01Dt6HSVPQ9jv66AgQLwwekp",
      "type": "tool_use",
      "name": "make_image",
      "input": {
        "image_idx": 2,
        "prompt": "A ceramic mug filled with hot cocoa, marshmallows on top, rising white steam, vintage style, product photography, warm tones, detailed"
      }
    },
    {
      "id": "toolu_bdrk_01Q2Gdeo4hYEK1yFupUAa7iQ",
      "type": "tool_use",
      "name": "make_image",
      "input": {
        "image_idx": 3,
        "prompt": "A pair of red knitted wool mittens, warm texture, slightly worn looking, festive vibe, product photography, cozy atmosphere, detailed texture"
      }
    },
    {
      "id": "toolu_bdrk_01QFjt6TQ1GGUhdf5FtvyiW4",
      "type": "tool_use",
      "name": "make_image",
      "input": {
        "image_idx": 4,
        "prompt": "A cozy living room interior, roaring fireplace, Christmas lights bokeh in background, warm orange lighting, comfortable sofa, winter night atmosphere, interior photography"
      }
    }
  ],
  "stop_reason": "tool_use",
  "usage": {
    "input_tokens": 8252,
    "cache_creation_input_tokens": 0,
    "cache_read_input_tokens": 0,
    "output_tokens": 606,
    "cache_creation": {},
    "claude_cache_creation_5_m_tokens": 0,
    "claude_cache_creation_1_h_tokens": 0
  }
}

Expected behavior

Multiple make_image tools are executed simultaneously

Screenshots

Additional context

rig-core = "0.29.0"

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions