Dify 0.9.1 - Agent - Using via API session problem #5912

Closed
opened 2026-02-21 18:13:11 -05:00 by yindo · 4 comments
Owner

Originally created by @wilsonfe on GitHub (Oct 3, 2024).

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

0.9.1

Cloud or Self Hosted

Self Hosted (Docker)

Steps to reproduce

I created an Agent and I am accessing the agent via API. When I start the conversation with the bot, the message history session does not remain. The bot always starts the conversation from the beginning. This same error does not occur when I test the bot within Dify. The problem occurs when I use it via API. Webhook.

✔️ Expected Behavior

That the bot would continue with the memory without restarting the conversation.

Actual Behavior

The bot should continue to respond to messages as the user converses with it and not restart the conversation.

Do not test with chatflow and this problem only started to occur in version 0.9.1, the same problem does not occur in version 0.8.3.

Originally created by @wilsonfe on GitHub (Oct 3, 2024). ### 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 0.9.1 ### Cloud or Self Hosted Self Hosted (Docker) ### Steps to reproduce I created an Agent and I am accessing the agent via API. When I start the conversation with the bot, the message history session does not remain. The bot always starts the conversation from the beginning. This same error does not occur when I test the bot within Dify. The problem occurs when I use it via API. Webhook. ### ✔️ Expected Behavior That the bot would continue with the memory without restarting the conversation. ### ❌ Actual Behavior The bot should continue to respond to messages as the user converses with it and not restart the conversation. Do not test with chatflow and this problem only started to occur in version 0.9.1, the same problem does not occur in version 0.8.3.
yindo added the 🐞 bug🤖 feat:agent labels 2026-02-21 18:13:11 -05:00
yindo closed this issue 2026-02-21 18:13:11 -05:00
Author
Owner

@dosubot[bot] commented on GitHub (Oct 3, 2024):

Hello @wilsonfe! I'm here to assist you with any bugs, questions, and contributions you might have regarding Dify. Let's squash those bugs together! 😊

I found some similar issues and discussions that might be relevant to your problem with session management in Dify 0.9.1:

  1. There is an open issue titled Custom API Chatbot with nodejs no history of the conversation Included, which discusses a similar problem where the chatbot does not remember the previous conversation when using the API. The suggested solution is to ensure that the conversation_id is correctly managed in your API requests. You should retrieve the conversation_id after the initial chat request and use the same conversation_id for subsequent requests to maintain the conversation context [1].

  2. Another related issue is Agent bot was lack of history conversation messages, which is closed. It suggests using the Context and History variables to maintain the context of each agent query. These variables allow you to reference the content and historical dialogue records for generating responses. This approach is applicable to the Text completion model of conversational applications [2].

These solutions might help you address the session persistence issue you're experiencing with Dify 0.9.1. Make sure to manage the conversation_id properly in your API requests to maintain the conversation history.

To continue talking to Dosu, mention @dosu.

@dosubot[bot] commented on GitHub (Oct 3, 2024): <!-- Greeting --> Hello @wilsonfe! I'm here to assist you with any bugs, questions, and contributions you might have regarding Dify. Let's squash those bugs together! 😊 <!-- Answer --> I found some similar issues and discussions that might be relevant to your problem with session management in Dify 0.9.1: 1. There is an open issue titled [Custom API Chatbot with nodejs no history of the conversation Included](https://github.com/langgenius/dify/issues/7327), which discusses a similar problem where the chatbot does not remember the previous conversation when using the API. The suggested solution is to ensure that the `conversation_id` is correctly managed in your API requests. You should retrieve the `conversation_id` after the initial chat request and use the same `conversation_id` for subsequent requests to maintain the conversation context <sup>[[1]](https://github.com/langgenius/dify/issues/7327)</sup>. 2. Another related issue is [Agent bot was lack of history conversation messages](https://github.com/langgenius/dify/issues/6046), which is closed. It suggests using the `Context` and `History` variables to maintain the context of each agent query. These variables allow you to reference the content and historical dialogue records for generating responses. This approach is applicable to the Text completion model of conversational applications <sup>[[2]](https://github.com/langgenius/dify/issues/6046)</sup>. These solutions might help you address the session persistence issue you're experiencing with Dify 0.9.1. Make sure to manage the `conversation_id` properly in your API requests to maintain the conversation history. <!-- Dosu Comment Footer --> *To continue talking to [Dosu](https://dosu.dev), mention @dosu.*
Author
Owner

@JVini0166 commented on GitHub (Oct 3, 2024):

I'm experiencing the same thing for version 1.9.0

@JVini0166 commented on GitHub (Oct 3, 2024): I'm experiencing the same thing for version 1.9.0
Author
Owner

@averyyan commented on GitHub (Oct 4, 2024):

me too

@averyyan commented on GitHub (Oct 4, 2024): me too
Author
Owner

@crazywoola commented on GitHub (Oct 4, 2024):

Duplicated fixed in #8965

@crazywoola commented on GitHub (Oct 4, 2024): Duplicated fixed in #8965
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: langgenius/dify#5912