Genesys Cloud - Main

 View Only

Sign Up

Expand all | Collapse all

Agentic Virtual Agent: Returning a conversation-derived variable to Architect at the end of a session

  • 1.  Agentic Virtual Agent: Returning a conversation-derived variable to Architect at the end of a session

    Posted 16 days ago

    Hi folks,

    I am currently experimenting with Agentic Virtual Agents (AVA) and had a question about passing data back to Architect at the end of a session.

    For example, let's say we want the AVA to determine an ai_intent variable by the end of the interaction. The final value could be one of:

    • Sales

    • Support

    • Escalation

    Based on this final intent, we'd like our Genesys Architect flow to route the conversation accordingly.

    From my understanding, the AVA would need to call a tool to return this value. However, I'm struggling to understand how this would work when the value cannot be determined until the conversation is complete and the entire conversation needs to be analyzed before populating the variable.

    1. If the intent is only determined at the end of the conversation, how can the AVA update the value before returning control to Architect? Even if this requires a dedicated tool (essentially a Data Action), how would that Data Action determine the value? My understanding is that Data Actions don't have access to the conversation transcript to analyze it and infer the final intent.

    2. Another approach I was considering was passing variables into the AVA using Start Context and retrieving them using End Context. However, how can I get the AVA itself to modify or update the value of a context variable during the conversation so that the final value is returned to Architect at the end of the session?

    Has anyone implemented a similar pattern, or is there a recommended best practice for returning a conversation-derived variable from an AVA back to Architect for post-conversation routing?


    #AIConfiguration
    #ArchitectandDesign
    #ConversationalAI(Bots,VirtualAgent,etc.)

    ------------------------------
    Ramsha
    AI Engineer
    ------------------------------


  • 2.  RE: Agentic Virtual Agent: Returning a conversation-derived variable to Architect at the end of a session

    Posted 15 days ago

    Hello Ramsha, 

    You've run into a current limitation of AVA. At the moment, and to my knowledge, AVA can't populate End Context variables based solely on conversational reasoning. End Context variables can only be populated from Start Context variables passed in from Architect or from explicitly mapped tool or Data Action outputs. This means that even if you prompt AVA to determine an intent and store it in an End Context variable, it won't be set unless that value comes from a mapped tool response.

    The current workaround is to have AVA gather the required information during the conversation and then call a tool or Data Action that returns the value you want to map. As you noted, though, Data Actions don't have native access to the full conversation transcript, which limits what they can infer on their own.

    The good news is that this use case is already being considered as a future enhancement. The idea is to allow authors to define End Context variables using prompts, enabling the LLM to infer structured values from the conversation and return them to Architect without requiring a tool call.

    For now, your best options are to use AVA Exit Reasons where appropriate, have AVA explicitly pass conversationally gathered values to a tool, or use post-conversation summaries and Architect logic. While it isn't the ideal solution, the limitation you've found is a known gap in the current AVA-to-Architect integration.

    That said, this is an amazing community, and I'd love to hear if anyone has come up with a creative workaround or implementation pattern for this use case.

    Hope this helps!



    ------------------------------
    Cameron
    Online Community Manager/Moderator
    ------------------------------



  • 3.  RE: Agentic Virtual Agent: Returning a conversation-derived variable to Architect at the end of a session

    Posted 13 days ago

    Hi, thank you so much for the explanation. 

    One follow-up question:
     
    "For now, your best options are to use AVA Exit Reasons where appropriate, have AVA explicitly pass conversationally gathered values to a tool, or use post-conversation summaries and Architect logic."

    would you happen to have any documentation or an example that shows what this workflow looks like in practice? I'm trying to visualize the mechanics.

    If there isn't any documentation, would you mind outlining the high-level steps of the recommended workflow? That would really help me understand how it's intended to work.


    Thanks again for taking the time


    ------------------------------
    Ramsha Shaikh
    Engineer, AI
    ------------------------------



  • 4.  RE: Agentic Virtual Agent: Returning a conversation-derived variable to Architect at the end of a session

    Posted 13 days ago

    I haven't experimented with the AVAs much yet but from what I understand from your message, you're saying the only variables the AVAs can (natively) pass out are results from Data Actions or values that were passed in? That seems like a flaw.

    Can they keep variables in their "memory" while the AVA is running, but just not pass them out? Like, could you just create a tool which stores the in-memory variable to a row in a Data Table, then retrieve that from the Architect flow (and then run a Data Action to delete that row)?



    ------------------------------
    James Dunn
    Telecoms Specialist
    ------------------------------



  • 5.  RE: Agentic Virtual Agent: Returning a conversation-derived variable to Architect at the end of a session

    Posted 13 days ago
    Edited by Ramsha Shaikh 13 days ago

    On your memory question: yes, the AVA reasons over the full conversation in-context, it just has no writable variable it exposes on its own

    The workaround I discovered for my use case above is that End Context can pass out a tool's input, not just its output, and a tool input can be inferred by the LLM/LAM at call-time based on the whole conversation.

    Here's what I am testing:

    1. Create a tool and a Data Action since tool requires one (The Data Action itself doesn't need to do anything meaningful, in my case it just makes a throwaway call so it "executes successfully.") e.g: Set AI Intent, with an input field ai_intent.
    2. In the tool instructions, tell the agent to call it once, as the final step, and to determine ai_intent (Sales / Support / Escalation) from the entire conversation.
    3. The LLM composes the value at the moment it calls the tool, there's no variable being "updated," the tool call is where the value is populated.
    4. In End Context, select that tool's Input field (not the output).
    5. Read it in Architect and branch your routing.

    One real limitation to flag: this only works if the tool actually gets called. If the user abandons the chat or it ends before the agent fires the tool, ai_intent is never set and Architect gets nothing

    Still ironing out one error on my side around the Data Action's output handling, but the value does flow through. What are your thoughts on this approach?



    ------------------------------
    Ramsha Shaikh
    Engineer, AI
    ------------------------------



  • 6.  RE: Agentic Virtual Agent: Returning a conversation-derived variable to Architect at the end of a session

    Posted 13 days ago

    Use a Genesys Cloud Functions Data Action. It literally does nothing but capture what you tell it to. Create a JSON file or have AI do it, that is what i did.

    ChatGPT or Claude can give you the instructions. I use this to capture input utterance that I can export. You can have the AI capture the utterance or transform it.



    ------------------------------
    Steve Alix
    EDCi
    ------------------------------



  • 7.  RE: Agentic Virtual Agent: Returning a conversation-derived variable to Architect at the end of a session

    Posted 12 days ago

    Thank you for the suggestion, I will try and implement this!



    ------------------------------
    Ramsha Shaikh
    Engineer, AI
    ------------------------------



  • 8.  RE: Agentic Virtual Agent: Returning a conversation-derived variable to Architect at the end of a session

    Posted 13 days ago

    The best practice for returning a variable like ai_intent from the AVA back to Architect is to use the AVA's own "End Context" configuration. This lets you pass internal variables (set during the conversation) back to your Architect flow when the session ends. So, the AVA analyzes the whole interaction internally to figure out the final intent (Sales, Support, or Escalation), and at the end, it exposes that variable in the "End Context." In Architect, that variable will show up as an output from the "Call Agentic Virtual Agent" action, allowing you to route the conversation to the right queue, all without needing any external tools or Data Actions to analyze the transcript after the conversation is over.



    ------------------------------
    Camila Meneghini
    ------------------------------



  • 9.  RE: Agentic Virtual Agent: Returning a conversation-derived variable to Architect at the end of a session

    Posted 12 days ago

    Hi, by AVA's own "End Context" configuration. Are you referring to the "Exit Reasons"?




    ------------------------------
    Ramsha Shaikh
    Engineer, AI
    ------------------------------



  • 10.  RE: Agentic Virtual Agent: Returning a conversation-derived variable to Architect at the end of a session

    Posted 12 days ago

    Hi,

    When you configure a Tool for AVA, you define the outputs as well.

    After that, go to Configuration and choose which outputs you want to pass out of the agent and into another flow or component within Architect.




    ------------------------------
    David Toth
    Product Manager
    ------------------------------



  • 11.  RE: Agentic Virtual Agent: Returning a conversation-derived variable to Architect at the end of a session

    Posted 12 days ago

    Based on the community discussions, your understanding is correct. The AVA itself cannot directly populate an end context variable from the conversation alone. However, you can achieve this using a tool that acts as a bridge, combined with Genesys APIs to get the transcript for analysis .

    Here is a recommended pattern to implement your solution.

    The Recommended Pattern: Tool + API

    The key is to use a "dummy" tool, which can be a Genesys Cloud Function or a custom Data Action . This tool's sole purpose is to allow the AVA to send a value back to the Architect flow via the End Context. The final value of your ai_intent variable must be set as the output of this tool .

    To make this work, you'll need to create a specific type of tool that acts as a post-conversation analyzer . Here's how to build it.

    Step-by-Step Implementation

    1. Create a Specialized Analyzer Tool: This tool will be called by the AVA at the very end of the conversation. Its job is to perform the final intent analysis.

      • Build a Data Action/Function: This tool will need to make an API call to get the transcript of the interaction . For a conversation, you can use the /api/v2/speechandtextanalytics/conversations/{conversationId}/communications/{communicationId}/transcripturl endpoint . Keep in mind that accessing this data might require specific OAuth permissions . This tool will then run its logic to determine the final intent based on the retrieved transcript.

      • Provide the Conversation ID as Input: The tool needs the conversationId as an input variable. This is easily passed from the Architect flow via the Start Context .

    2. Call the Tool from the AVA: In your AVA's "Exit" behavior or as the final step in its conversation, you will call your custom tool. The AVA will pass the conversationId to it.

    3. Configure the End Context: The output of your custom tool (the final ai_intent value) must be mapped to an End Context variable . This is configured in your AVA's settings.

    4. Retrieve the Value in Architect: Back in your Genesys Architect flow, after the "Call Agentic Virtual Agent" action, you will have access to the End Context variables you set up. You can then use this ai_intent value in a decision block to route the interaction to the correct queue (e.g., Sales, Support, Escalation) .

    Summary of the Architecture

    Step Actor Action
    1 Genesys Cloud Conversation begins, and the conversationId is passed to the AVA via Start Context.
    2 Agentic Virtual Agent (AVA) Conducts the entire conversation with the user.
    3 Agentic Virtual Agent (AVA) At the end, calls the custom "Intent Analyzer" tool.
    4 Custom Tool Uses the conversationId to fetch the full transcript via the API. Analyzes the transcript and determines the final ai_intent. Returns this value to the AVA.
    5 Agentic Virtual Agent (AVA) Maps the tool's output to an End Context variable.
    6 Genesys Cloud Conversation ends, and control returns to the Architect flow.
    7 Architect Flow Reads the ai_intent value from the End Context and routes the conversation accordingly.

    This approach addresses the core challenge: the AVA is not analyzing the conversation to update a variable directly. Instead, it uses a tool that has the capability to perform this complex analysis at the precise moment it's needed.



    ------------------------------
    Camila Meneghini
    ------------------------------