Organiza tus páginas con colecciones
Guarda y categoriza el contenido según tus preferencias.
Los contextos de Dialogflow son similares al contexto del lenguaje natural.
Si una persona le dice "es de color naranja", necesita contexto para saber qué es de ese color.
Del mismo modo, para que Dialogflow maneje una expresión de usuario final como esa, debe proporcionarse un contexto con el fin de que coincida de forma correcta con un intent.
Mediante los contextos, puedes controlar el flujo de una conversación.
Si quieres configurar contextos para un intent, debes establecer contextos de entrada y salida, que se identifican mediante nombres de strings.
Cuando coincide un intent, se activan los contextos de salida configurados para ese intent.
Mientras existan contextos activos, es más probable que Dialogflow coincida con intents configurados con contextos de entrada que correspondan a los contextos activos en ese momento.
En el siguiente diagrama, se muestra un ejemplo en el que se usa un contexto de un agente bancario.
El usuario final solicita información sobre su cuenta corriente.
Dialogflow hace coincidir esta expresión del usuario final con el intent CheckingInfo.
Este intent tiene un contexto de salida checking, por lo que ese contexto se activa.
El agente solicita al usuario final el tipo de información que desea obtener sobre su cuenta corriente.
El usuario final responde “mi saldo”.
Dialogflow hace coincidir esta expresión del usuario final con el intent CheckingBalance.
Este intent tiene un contexto de entrada checking, que debe estar activo para que coincida con este intent.
También puede existir un intent SavingsBalance similar para que coincida con la misma expresión del usuario final cuando un contexto savings está activo.
Después de que tu sistema realiza las consultas de base de datos necesarias, el agente responde con el saldo de la cuenta corriente.
[[["Fácil de comprender","easyToUnderstand","thumb-up"],["Resolvió mi problema","solvedMyProblem","thumb-up"],["Otro","otherUp","thumb-up"]],[["Difícil de entender","hardToUnderstand","thumb-down"],["Información o código de muestra incorrectos","incorrectInformationOrSampleCode","thumb-down"],["Faltan la información o los ejemplos que necesito","missingTheInformationSamplesINeed","thumb-down"],["Problema de traducción","translationIssue","thumb-down"],["Otro","otherDown","thumb-down"]],["Última actualización: 2025-09-04 (UTC)"],[[["\u003cp\u003eDialogflow's contexts are used to understand user expressions by providing necessary conversational context, similar to how humans understand natural language.\u003c/p\u003e\n"],["\u003cp\u003eContexts control conversation flow by setting input and output contexts for intents, identified by string names.\u003c/p\u003e\n"],["\u003cp\u003eWhen an intent is matched, its output contexts become active, influencing which intents are more likely to be matched next.\u003c/p\u003e\n"],["\u003cp\u003eDialogflow matches intents with specific input contexts only when those contexts are currently active, allowing for tailored responses.\u003c/p\u003e\n"],["\u003cp\u003eThe banking agent example shows how the "checking" output context from the \u003ccode\u003eCheckingInfo\u003c/code\u003e intent enables the \u003ccode\u003eCheckingBalance\u003c/code\u003e intent to be matched later when a user asks for their balance.\u003c/p\u003e\n"]]],[],null,["# Contexts\n\nDialogflow\n\n*contexts*\n\nare similar to natural language context.\nIf a person says to you \"they are orange\",\nyou need context in order to understand what \"they\" is referring to.\nSimilarly, for Dialogflow to handle an end-user expression like that,\nit needs to be provided with context in order to correctly match an intent.\n\n\nUsing contexts,\nyou can control the flow of a conversation.\nYou can configure contexts for an intent by setting\n[input and output contexts](/dialogflow/docs/contexts-input-output),\nwhich are identified by string names.\nWhen an intent is matched,\nany configured *output contexts* for that intent become active.\nWhile any contexts are active,\nDialogflow is more likely to match intents\nthat are configured with *input contexts* that correspond to\nthe currently active contexts.\n\n\nThe following diagram shows an example that uses context for a banking agent.\n\n1. The end-user asks for information about their checking account.\n2. Dialogflow matches this end-user expression to the `CheckingInfo` intent. This intent has a `checking` output context, so that context becomes active.\n3. The agent asks the end-user for the type of information they want about their checking account.\n4. The end-user responds with \"my balance\".\n5. Dialogflow matches this end-user expression to the `CheckingBalance` intent. This intent has a `checking` input context, which needs to be active to match this intent. A similar `SavingsBalance` intent may also exist for matching the same end-user expression when a `savings` context is active.\n6. After your system performs the necessary database queries, the agent responds with the checking account balance."]]