The problem of parallel use of intelligent agents in workflow #12415

Closed
opened 2026-02-21 19:07:18 -05:00 by yindo · 1 comment
Owner

Originally created by @1523826455647 on GitHub (Mar 31, 2025).

Self Checks

  • This is only for bug report, if you would like to ask a question, please head to Discussions.
  • I have searched for existing issues search for existing issues, including closed ones.
  • I confirm that I am using English to submit this report (我已阅读并同意 Language Policy).
  • [FOR CHINESE USERS] 请务必使用英文提交 Issue,否则会被关闭。谢谢!:)
  • Please do not modify this template :) and fill in all the required fields.

Dify version

v1.1.0

Cloud or Self Hosted

Self Hosted (Docker)

Steps to reproduce

When I use agents in parallel in the workflow, checking the iterations in the trace only shows one agent working, but in reality, both agents will run their work simultaneously, but only one is displayed in the record.

Image
I used two parallel running agents simultaneously without iteration, and he did not encounter this issue

Image

✔️ Expected Behavior

Add parallel running intelligent agent output results in iterative steps

Actual Behavior

No response

Originally created by @1523826455647 on GitHub (Mar 31, 2025). ### Self Checks - [x] This is only for bug report, if you would like to ask a question, please head to [Discussions](https://github.com/langgenius/dify/discussions/categories/general). - [x] I have searched for existing issues [search for existing issues](https://github.com/langgenius/dify/issues), including closed ones. - [x] I confirm that I am using English to submit this report (我已阅读并同意 [Language Policy](https://github.com/langgenius/dify/issues/1542)). - [x] [FOR CHINESE USERS] 请务必使用英文提交 Issue,否则会被关闭。谢谢!:) - [x] Please do not modify this template :) and fill in all the required fields. ### Dify version v1.1.0 ### Cloud or Self Hosted Self Hosted (Docker) ### Steps to reproduce When I use agents in parallel in the workflow, checking the iterations in the trace only shows one agent working, but in reality, both agents will run their work simultaneously, but only one is displayed in the record. ![Image](https://github.com/user-attachments/assets/a5f9355b-fcba-4b7c-8b51-d7ad7295927c) I used two parallel running agents simultaneously without iteration, and he did not encounter this issue ![Image](https://github.com/user-attachments/assets/23fe5adf-1216-48c7-ad77-04a9ea0f07de) ### ✔️ Expected Behavior Add parallel running intelligent agent output results in iterative steps ### ❌ Actual Behavior _No response_
yindo added the 🌊 feat:workflow label 2026-02-21 19:07:18 -05:00
yindo closed this issue 2026-02-21 19:07:18 -05:00
Author
Owner

@dosubot[bot] commented on GitHub (Mar 31, 2025):

To address the issue of only one agent being displayed in the workflow execution trace when using parallel agents in Dify v1.1.0, you can utilize the logging functions provided by the Dify SDK. Specifically, you should use create_log_message and finish_log_message to log the execution of each agent separately. This will ensure that both agents' activities are tracked and displayed in the execution trace.

Here's a sample approach:

# Create a log message for the first agent
agent1_log = self.create_log_message(
    label="Agent 1 Execution",
    data={},
    metadata={"start_at": agent1_started_at, "provider": "qwen-max-latest"},
    status=ToolInvokeMessage.LogMessage.LogStatus.START,
)
yield agent1_log

# Invoke the first agent's model
self.session.model.llm.invoke(...)
yield self.finish_log_message(
    log=agent1_log,
    data={"output": agent1_response},
    metadata={
        "started_at": agent1_started_at,
        "finished_at": time.perf_counter(),
        "elapsed_time": time.perf_counter() - agent1_started_at,
        "provider": "qwen-max-latest",
    },
)

# Create a log message for the second agent
agent2_log = self.create_log_message(
    label="Agent 2 Execution",
    data={},
    metadata={"start_at": agent2_started_at, "provider": "qwen-max-latest"},
    status=ToolInvokeMessage.LogMessage.LogStatus.START,
)
yield agent2_log

# Invoke the second agent's model
self.session.model.llm.invoke(...)
yield self.finish_log_message(
    log=agent2_log,
    data={"output": agent2_response},
    metadata={
        "started_at": agent2_started_at,
        "finished_at": time.perf_counter(),
        "elapsed_time": time.perf_counter() - agent2_started_at,
        "provider": "qwen-max-latest",
    },
)

By logging each agent's execution separately and ensuring that each log message is yielded, you can track both agents' activities in the workflow execution trace [1].

To continue talking to Dosu, mention @dosu.


Help Dosu learn! Give it feedback: Great Response | Irrelevant Answer | Incorrect Sources | Too Verbose | Hallucination | Bug Report | Other

@dosubot[bot] commented on GitHub (Mar 31, 2025): <!-- Answer --> To address the issue of only one agent being displayed in the workflow execution trace when using parallel agents in Dify v1.1.0, you can utilize the logging functions provided by the Dify SDK. Specifically, you should use `create_log_message` and `finish_log_message` to log the execution of each agent separately. This will ensure that both agents' activities are tracked and displayed in the execution trace. Here's a sample approach: ```python # Create a log message for the first agent agent1_log = self.create_log_message( label="Agent 1 Execution", data={}, metadata={"start_at": agent1_started_at, "provider": "qwen-max-latest"}, status=ToolInvokeMessage.LogMessage.LogStatus.START, ) yield agent1_log # Invoke the first agent's model self.session.model.llm.invoke(...) yield self.finish_log_message( log=agent1_log, data={"output": agent1_response}, metadata={ "started_at": agent1_started_at, "finished_at": time.perf_counter(), "elapsed_time": time.perf_counter() - agent1_started_at, "provider": "qwen-max-latest", }, ) # Create a log message for the second agent agent2_log = self.create_log_message( label="Agent 2 Execution", data={}, metadata={"start_at": agent2_started_at, "provider": "qwen-max-latest"}, status=ToolInvokeMessage.LogMessage.LogStatus.START, ) yield agent2_log # Invoke the second agent's model self.session.model.llm.invoke(...) yield self.finish_log_message( log=agent2_log, data={"output": agent2_response}, metadata={ "started_at": agent2_started_at, "finished_at": time.perf_counter(), "elapsed_time": time.perf_counter() - agent2_started_at, "provider": "qwen-max-latest", }, ) ``` By logging each agent's execution separately and ensuring that each log message is yielded, you can track both agents' activities in the workflow execution trace <sup>[[1]](https://github.com/langgenius/dify-docs/blob/main/en/plugins/quick-start/develop-plugins/agent-strategy-plugin.md)</sup>. <!-- Dosu Comment Footer --> *To continue talking to [Dosu](https://dosu.dev), mention @dosu.* --- <sup>Help Dosu learn! Give it feedback: [Great Response](https://app.dosu.dev/response-feedback/6f986949-4dae-4e10-944e-fde40e208180?feedback_type=great_response) | [Irrelevant Answer](https://app.dosu.dev/response-feedback/6f986949-4dae-4e10-944e-fde40e208180?feedback_type=irrelevant_answer) | [Incorrect Sources](https://app.dosu.dev/response-feedback/6f986949-4dae-4e10-944e-fde40e208180?feedback_type=incorrect_sources) | [Too Verbose](https://app.dosu.dev/response-feedback/6f986949-4dae-4e10-944e-fde40e208180?feedback_type=too_verbose) | [Hallucination](https://app.dosu.dev/response-feedback/6f986949-4dae-4e10-944e-fde40e208180?feedback_type=hallucination) | [Bug Report](https://app.dosu.dev/response-feedback/6f986949-4dae-4e10-944e-fde40e208180?feedback_type=bug_report) | [Other](https://app.dosu.dev/response-feedback/6f986949-4dae-4e10-944e-fde40e208180?feedback_type=other)</sup>
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: langgenius/dify#12415