ragflow icon indicating copy to clipboard operation
ragflow copied to clipboard

[Question]: Agent Session first message

Open raminmardani opened this issue 4 months ago • 4 comments

Self Checks

  • [x] I have searched for existing issues search for existing issues, including closed ones.
  • [x] I confirm that I am using English to submit this report (Language Policy).
  • [x] Non-english title submitions will be closed directly ( 非英文标题的提交将会被直接关闭 ) (Language Policy).
  • [x] Please do not modify this template :) and fill in all the required fields.

Describe your problem

with Agent sessions, I have a simple loop of (begin(with id as input parameter), interact, generate( to just print id)). I want each session having a separate id that I pass. the issue is that I need to send 3 requests to get my answer instead of two. This is how I am doing it: to generate session_id: curl -X POST "https://******/api/v1/agents/*******/completions" -H "accept: application/json" -H "Authorization: ********" -H "Content-Type: application/json" -d "{\"id\":10}"

to get the id from LLM: curl -X POST "https://***************/api/v1/agents/*************/completions" -H "accept: application/json" -H "Authorization: ****************" -H "Content-Type: application/json" -d "{\"session_id\": \"e8065324739d11f092beaabd83257d03\",\"question\":\"what's the id?\",\"stream\":false}"

and this would be the output: data:{"code": 0, "message": "", "data": {"answer": "Hi, how can I help you?", "reference": {}, "id": "40fd0431-34fb-4bd9-9380-4e603b01a612", "session_id": "4026e73c73a111f088e1aabd83257d03"}}

running the same request again:

data:{"code": 0, "message": "", "data": {"answer": "*'Generate_0'* is running...🕞", "running_status": true}}

data:{"code": 0, "message": "", "data": {"answer": "The ID is 13.", "reference": {}, "id": "3f55eadb-e536-4c6d-88ca-ceaa77841c95", "session_id": "4026e73c73a111f088e1aabd83257d03"}}

which is correct but why after 2nd try?

raminmardani avatar Aug 07 '25 15:08 raminmardani

Hi @raminmardani! I'm Dosu and I’m helping the ragflow team.

This is expected behavior in RAGFlow. The first request with a new session initializes the agent and always returns the greeting or prologue from the 'Begin' component, regardless of your question. Only after this initial greeting does the workflow process your actual query, which is why you see the correct answer after the second or third request. This multi-step flow (session creation → greeting → actual answer) is by design and not a bug—it's how the agent session architecture is structured, and changing it would require a fundamental redesign. This pattern is documented and has been discussed by maintainers and other users as the current expected flow (source, source).

To reply, just mention @dosu.


How did I do? Good | Irrelevant | Incorrect | Verbose | Hallucination | Report 🐛 | Other  Chat with Dosu Join Discord Share on X

dosubot[bot] avatar Aug 07 '25 15:08 dosubot[bot]

Thank you for your feedback. Have you sorted out the issue yet? Your issue is on our list—really appreciate your input! Feel free to ping us if you need more support!

Llala0928 avatar Aug 15 '25 05:08 Llala0928

not yet.

raminmardani avatar Nov 19 '25 16:11 raminmardani

The first is the start message. The second is the actual answer. Try web ui, that might help you understand.

Magicbook1108 avatar Nov 27 '25 03:11 Magicbook1108

Since there has been no further activity for over three weeks, we will proceed to close this issue. If the problem persists or you have additional questions, please feel free to reopen the issue or create a new one. We’re happy to assist anytime.

Magicbook1108 avatar Dec 12 '25 02:12 Magicbook1108