Alcuni prodotti e funzionalitร sono in fase di rinominazione. Anche le funzionalitร di playbook e flusso generativi sono in fase di migrazione a un'unica console consolidata. Consulta i dettagli.
Mantieni tutto organizzato con le raccolte
Salva e classifica i contenuti in base alle tue preferenze.
Una sessione rappresenta una conversazione tra un agente Conversational Agents (Dialogflow CX) e un utente finale.
Creando una sessione all'inizio di una conversazione, la utilizzi per ogni turno della conversazione.
Al termine della conversazione,
interrompi l'utilizzo della sessione.
Non utilizzare la stessa sessione per conversazioni simultanee con utenti finali diversi.
Una sessione rimane attiva e i suoi dati archiviati per 30 minuti
dopo l'invio dell'ultima richiesta per la sessione.
Ogni sessione รจ identificata in modo univoco da un ID sessione generato dal sistema.
Puoi creare una nuova sessione fornendo un nuovo ID sessione
in una richiesta di rilevamento dell'intenzione e in altri metodi di sessione.
Un ID sessione รจ una stringa di massimo 36 byte.
Il sistema รจ responsabile della generazione di ID sessione univoci.
Possono essere numeri casuali, identificatori dell'utente finale sottomessi ad hashing o qualsiasi altro valore che ti รจ comodo generare.
Consulta la documentazione sulla regionalizzazione per informazioni sul valore ID posizione nel nome della sessione.
Sessioni durature
Per impostazione predefinita, Conversational Agents (Dialogflow CX) conserva i dati della sessione per 30 minuti. Esistono due modi per estendere la durata delle sessioni:
(Opzione preferita) Imposta il TTL della sessione utilizzando QueryParameters.session_ttl. Il valore massimo consentito รจ 24 ore.
Puoi ripristinare lo stato della sessione precedente impostando QueryParameters.current_page e QueryParameters.parameters in DetectIntentRequest.
Un esempio di flusso di lavoro รจ il seguente:
L'utente finale parla con l'agente nella sessione A.
Il codice registra lo stato associato alla sessione A restituito nella risposta dell'API, ovvero QueryResult.current_page e QueryResult.parameters.
L'utente finale interrompe l'interazione con l'agente dopo 50 minuti.
L'utente finale parla di nuovo con l'agente.
Il codice invia l'input utente finale, insieme a QueryParameters.current_page e QueryParameters.parameters registrati in precedenza nella richiesta, per rilevare l'intenzione con lo stato della sessione precedente. Non รจ necessario utilizzare lo stesso ID sessione utilizzato dalla sessione A.
Riferimenti
Per informazioni sui prezzi delle sessioni, consulta la pagina dei prezzi.
Per ulteriori informazioni sulle sessioni:
Seleziona un protocollo e una versione per il riferimento sessione:
[[["Facile da capire","easyToUnderstand","thumb-up"],["Il problema รจ stato risolto","solvedMyProblem","thumb-up"],["Altra","otherUp","thumb-up"]],[["Difficile da capire","hardToUnderstand","thumb-down"],["Informazioni o codice di esempio errati","incorrectInformationOrSampleCode","thumb-down"],["Mancano le informazioni o gli esempi di cui ho bisogno","missingTheInformationSamplesINeed","thumb-down"],["Problema di traduzione","translationIssue","thumb-down"],["Altra","otherDown","thumb-down"]],["Ultimo aggiornamento 2025-09-04 UTC."],[[["\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"]]