컨텍스트 변수 사용 안내
컨텍스트 변수를 통해 에이전트는 외부 시스템에서 전달된 채널별 정보에 접근할 수 있습니다. 이 가이드에서는 Genesys Bot Connector를 실제 사례로 삼아 컨텍스트 변수를 구성하고 액세스하는 방법을 설명합니다.
컨텍스트 변수 활성화
에이전트에서 컨텍스트 변수를 사용하려면 에이전트 구성 YAML 파일에서 다음을 설정하십시오:
context_access_enabled: true
context_variables:
- channel
- other_variable_name
context_access_enabled: 컨텍스트 변수에 접근하려면true로 설정해야 합니다context_variables: 에이전트가 액세스할 수 있는 특정 컨텍스트 변수 키 목록
컨텍스트 변수에 접근하기
컨텍스트 변수는 중괄호 구문을 사용하여 접근합니다.
{variable_name}예:instructions: You have access to everything under the {channel} context variables.
Genesys Bot Connector 컨텍스트 구조
어떤 것이 전달되는가
매개변수(입력값)는 Genesys Bot Connector 요청의 필드를 "channel": {
"genesys_bot_connector": {
"bot_session_id": "<botSessionId>",
"conversation_id": "<genesysConversationId>",
"parameters": {
// Custom parameters from Genesys
}
}
}
parameters 통해 전달되며, 컨텍스트 변수로 사용할 수 있게 됩니다.Genesys의 입력 예시:
"parameters": {
"user_name": "Jon Snow",
"priority": "high"
}
에이전트가 데이터에 접근하는 방식
입력 매개변수가 user_name: "Jon Snow"주어지면, 에이전트 지침은 다음과 같을 수 있습니다(라는 이름의 간단한 도구가 get_hello_message 있다고 가정합니다).
옵션 1. 어떤 변수를 사용할지 명시적으로 지정하십시오.
guidelines:
- display_name: simple hello message
condition: If the user just wants a hello message
action: Use the get_hello_message tool to generate hello message, use {channel.genesys_bot_connector.parameters.user_name} for the name.옵션 2. 에이전트에게 서브 키의 “값 ”을 사용하도록 지시하십시오(‘값’을 사용하라고 명시하는 것이 중요합니다)guidelines:
- display_name: simple hello message
condition: If the user just wants a hello message
action: Use the get_hello_message tool to generate hello message, use {user_name} value in the context for the name.
에이전트 구성 예시
...
name: customer_service_agent
description: Agent that handles customer service inquiries
instructions: You are a helpful customer service agent. Access user information from {channel} context variables.
context_access_enabled: true
context_variables:
- channel
guidelines:
- display_name: Personalized greeting
condition: When starting a new conversation
action: Greet the customer using {user_name} value from the context.
- display_name: Priority handling
condition: If {channel.genesys_bot_connector.parameters.priority} is "high"
action: Acknowledge the urgent nature and expedite the request. Say "I see this is a high priority matter for you."
...