[[["易于理解","easyToUnderstand","thumb-up"],["解决了我的问题","solvedMyProblem","thumb-up"],["其他","otherUp","thumb-up"]],[["很难理解","hardToUnderstand","thumb-down"],["信息或示例代码不正确","incorrectInformationOrSampleCode","thumb-down"],["没有我需要的信息/示例","missingTheInformationSamplesINeed","thumb-down"],["翻译问题","translationIssue","thumb-down"],["其他","otherDown","thumb-down"]],["最后更新时间 (UTC):2025-08-18。"],[[["\u003cp\u003eA session in Conversational Agents (Dialogflow CX) represents a single conversation between an agent and an end-user, beginning at the start of the conversation and ending when the conversation is done.\u003c/p\u003e\n"],["\u003cp\u003eEach session is assigned a unique session ID, which is a string of up to 36 bytes, and it is generated by the user's system.\u003c/p\u003e\n"],["\u003cp\u003eSessions should not be shared between multiple end-users concurrently, as it may produce unpredictable behaviors and data corruption.\u003c/p\u003e\n"],["\u003cp\u003eBy default, session data is stored for 30 minutes after the last request; however, this can be extended up to 24 hours by setting the \u003ccode\u003eQueryParameters.session_ttl\u003c/code\u003e.\u003c/p\u003e\n"],["\u003cp\u003eYou can also revive a previous session state by setting \u003ccode\u003eQueryParameters.current_page\u003c/code\u003e and \u003ccode\u003eQueryParameters.parameters\u003c/code\u003e in a \u003ccode\u003eDetectIntentRequest\u003c/code\u003e for long-lasting sessions, allowing users to resume from a previous state even after the default 30-minute window has passed.\u003c/p\u003e\n"]]],[],null,["# Sessions\n\nA session represents a conversation between a Conversational Agents (Dialogflow CX) agent and an end-user.\nYou create a session at the beginning of a conversation\nand use it for each turn of the conversation.\nOnce the conversation has ended,\nyou discontinue using the session.\n\nYou should not use the same session for concurrent conversations\nwith different end-users.\nA session remains active and its data is stored for 30 minutes\nafter the last request is sent for the session.\n\nEach session is determined unique by a session ID generated by your system.\nYou create a new session by providing a new session ID\nin a detect intent request and other session methods.\nA session ID is a string of at most 36 bytes in size.\nYour system is responsible for generating unique session IDs.\nThey can be random numbers, hashed end-user identifiers,\nor any other values that are convenient for you to generate.\n\nCheck the [Regionalization](/dialogflow/cx/docs/how/region)\ndocumentation for information about the Location ID value in the session name.\n\nLong-lasting sessions\n---------------------\n\nBy default, Conversational Agents (Dialogflow CX) maintains the session data for 30 minutes. There are two ways to extend the lifetime of the sessions:\n\n- **(Preferred)** Set session TTL using `QueryParameters.session_ttl`. The maximum allowed value is 24 hours.\n- You can revive the previous session state by setting\n `QueryParameters.current_page` and `QueryParameters.parameters` in `DetectIntentRequest`.\n\n An example workflow looks like:\n 1. End-user talks with the agent under session A.\n 2. Your code records the state associated with session A returned in the API response, namely `QueryResult.current_page` and `QueryResult.parameters`.\n 3. End-user stops interacting with the agent after 50 minutes.\n 4. End-user talks with the agent again.\n 5. Your code sends the end-user input, together with the previously recorded `QueryParameters.current_page` and `QueryParameters.parameters` in the request, to detect intent with the previous session state. You do not need to use the same session ID as used by session A.\n\n | **Note:** [Handler call stack](/dialogflow/cx/docs/concept/handler#call-stack) will **not** be revived with this approach.\n\nReferences\n----------\n\nFor information on session pricing, see the\n[pricing page](/dialogflow/pricing).\n\nFor more information on sessions:\n\n\nGo to the Session API reference \n**Select a protocol and version for the Session reference:**\n\nClose\n\n\u003cbr /\u003e"]]