Skip to main content

Identity Verification in Conversational Agents - Context & Flow Control

· 5 min read
Julia Schröder Langhaeuser
Julia Schröder Langhaeuser
Product Director

One of the most powerful features when designing LLM-driven conversational agents with connected tools is their ability to handle persistent context and multi-step validation flows. In this article, we explore how we implemented an identity verification flow within a customer support agent for online order management, leveraging conversation context, dynamic prompting, and agent skills.

🔧 The Use Case

The agent is defined as a Customer Support Agent for online orders, structured into three main stages:

  1. Agent introduction. The agent greets the user, introduces itself, and explains what it can help with.

  2. Identity verification.

    • Sends a 6-digit verification code using an API (SendVerificationCode).
    • Saves the MessageId returned by the API as a conversation variable.
    • Once the user enters the code, it executes a second skill (ValidateVerificationCode) using that same MessageId and the verification code provided.
  3. Open conversation. After validation, the agent unlocks the rest of the prompt, allowing free-form interactions such as checking orders, reporting issues, or submitting claims.

🧩 Conversation Context Structure

The conversation context includes a set of variables used to maintain state across the chat and control the logic flow:

VariableTypeDescription
Validated_IdentitybooleanIndicates if the user has completed identity verification.
MessageIdstringID returned by the SendVerificationCode API.
Full_NamestringFull name provided by the user.
Order_NumberstringThe user’s order number.
IssuestringDescription of the issue reported.

Each of these variables is updated dynamically based on the outcome of each skill. For instance, when ValidateVerificationCode runs successfully, it sets Validated_Identity = true, which dynamically expands the prompt to the next section.

Conversation Variables Configuration

Need step-by-step setup instructions? See the Conversation Context docs: Conversation Context documentation

⚙️ Step-by-Step Execution

1. Sending the Verification Code

The flow begins with SendVerificationCode, which receives the user’s Order_Number and returns a MessageId. The details of this execution can be seen in the skill execution details:

Skill execution details

The MessageId obtained is stored automatically in the conversation and referred in the prompt. This way, the agent can reference it later without exposing it to the user.

2. Validating the Code

When the user enters the received code (e.g., “123456”), the agent executes ValidateVerificationCode with:

{
"MessageId": "ABC123",
"verificationCode": "123456"
}

If the API returns success (true), the system sets:

{
"Validated_Identity": true
}

The prompt then expands dynamically, unlocking the next part of the agent’s capabilities. This is achieved using Dynamic Prompting with Liquid templating. The agent's core instructions are wrapped in a conditional block that checks the value of our conversation variable:

{% if conversationVariables.Validated_Identity == "true" %}
... rest of the prompt with full capabilities ...
{% endif %}

This ensures that the agent only gains access to its full set of instructions (e.g., checking orders or reporting issues) after the Validated_Identity variable is set to true. Before validation, it is restricted to only the identity verification flow, making the process secure and controlled.

3. Final Context and Stored Data

At the end of the flow, the agent has collected and stored all relevant data in its context:

{
"MessageId": "ABC123",
"Full_Name": "Julia Demo",
"Order_Number": "111AAA",
"Validated_Identity": true,
"Issue": "Customer received a bag on 7th October 2025 that has a scratch on the front. The scratch is not very large, but the item arrived damaged. No photographs of the damage are available."
}

This data remains available throughout the conversation lifecycle, enabling subsequent actions — such as creating a support ticket, checking order status, or escalating the case to a human agent.

Visualize Conversation Context

🧠 Technical Insight

This example demonstrates how an LLM-based agent can manage stateful, conditional conversations while maintaining natural flow. By combining LLM reasoning with structured conversation context, the agent can:

  • Keep coherence across multiple steps.
  • Reuse results from previous skill executions.
  • Dynamically control prompt visibility based on context variables.

This hybrid approach allows the agent to understand natural language while also operating within a deterministic, context-driven logic layer — creating secure, reliable automation.

✨ Conclusion

This verification workflow highlights how intelligent conversational agents can go beyond text responses — integrating identity validation, process automation, and secure logic control, all through natural conversation. The key lies in persistent context and logical orchestration across skills, forming the backbone of robust conversational experiences.

For more details on configuring Conversation Variables and Conversation Context in your agent, see the specific documentation.

Want to have this exact use case in your tenant?

  1. Sign up or sign in to your Serenity account.
  2. Click the link below to import the agent and copy this identity verification flow directly into your tenant:

👉 Import the agent: Import Verification Flow (Copy to my tenant)

After importing, you can customize conversation variables, skills, and API integrations to match your processes.

Enhancing RAG with Hybrid Search and Metadata

· 8 min read
Julia Schröder Langhaeuser
Julia Schröder Langhaeuser
Product Director

In today's data-driven world, organizations maintain vast knowledge bases containing information about similar products, services, or concepts. Traditional semantic search often struggles to distinguish between closely related content, leading to mixed or confusing results. Serenity* AI Hub offers a powerful solution: hybrid search with document metadata that enhances RAG-based agents with structured fields for more precise information retrieval across any domain.

For instance, imagine managing documentation for multiple similar products—like user manuals for different smartphone models, technical specifications for competing software tools, or guides for various financial services. Without proper filtering, agents might mix information from different sources, causing confusion. Hybrid search with metadata solves this by adding structured context to documents, ensuring accurate, targeted responses.

This approach is particularly valuable in scenarios where content structures are similar but details differ, such as:

  • Product documentation across multiple versions or variants
  • Technical manuals for related but distinct equipment
  • Knowledge bases covering similar services or offerings
  • Research papers on comparable technologies or methodologies

As a concrete example, let's explore how this applies to LLM model documentation, where organizations manage extensive knowledge bases about numerous AI models with similar structures but different capabilities, pricing, and specifications.

Understanding Document Metadata in AI Hub

Document metadata introduces structured fields that work alongside semantic search to improve retrieval accuracy. The system uses two key components:

  1. Tags: Key-value pairs that categorize documents (e.g., model: Qwen3-Next-80B-A3B-Thinking)
  2. Descriptions: Concise summaries that provide context about the document's content and purpose

These metadata fields enhance the retrieval process in two critical ways:

  • Hybrid Filtering: Tags are matched to conversation context to filter and rank relevant documents
  • LLM Grounding: Descriptions provide additional context during answer generation

Important Note: Custom metadata is only available with the "Large Context Knowledge" or "AI Hybrid Search" integration modes. For optimal performance with metadata filtering, select "Knowledge with AI Hybrid Search (recommended)" in your Advanced Settings.

AI-Enhanced Search Query Generation

One of the key advantages of the "AI Hybrid Search" mode is its intelligent query optimization. Instead of using the user's literal text for embedding searches, the system:

  1. Analyzes the user's intent and extracts key concepts
  2. Generates optimized search text specifically designed for better embedding matching
  3. Combines this with metadata filtering to retrieve the most relevant sections

For example, if a user asks: "Can you tell me about the thinking capabilities of that Qwen model?", the AI might generate a more targeted search query like "Qwen3-Next-80B-A3B-Thinking reasoning capabilities specifications" for the embedding search, while simultaneously filtering by the model: Qwen3-Next-80B-A3B-Thinking tag.

This dual approach significantly improves retrieval accuracy compared to using the user's original text directly.

Setting Up Metadata-Enhanced Knowledge Base

To implement metadata-enhanced retrieval, follow these key steps using Serenity* AI Hub:

Prerequisites

  • Access to Serenity* AI Hub
  • A collection of documents to use as knowledge in your agent

Step 1: Plan Your Metadata Strategy

Before adding metadata, identify the key dimensions that differentiate your LLM model documents. For this example, we'll use a simple but effective approach:

Primary Tag Strategy:

  • Model name as the main differentiator (Qwen3-Next-80B-A3B-Thinking, DeepSeek-R1, Llama-3.1-8B, gemma-3-270m, etc.)

This simple tagging approach is often the most practical because:

  • It directly addresses the main challenge: preventing information mixing between models
  • It's easy to maintain and scale as you add more model documentation
  • It provides clear filtering that users can understand and rely on

Step 2: Access the Knowledge Management Interface

Navigate to your agent's Knowledge tab in AI Hub.

Upload Files Interface

Click on "Knowledge" to access your document library where you can upload your LLM model documentation files.

Step 3: Add Metadata to Documents

For each document in your knowledge base, you can add structured metadata by clicking the configure metadata icon:

Configure Metadata Icon

As shown in the example, for a document like Qwen3-Next-80B-A3B-Thinking.pdf, you would add the description "Model specification for Qwen3 Next 80B A3B Thinking" and use the tag Qwen3-Next-80B-A3B-Thinking.

Note the important message that appears: "Custom metadata is only available with the 'Large Context Knowledge' or 'AI Hybrid Search' integration modes. We recommend choosing one of these modes in Knowledge > 'Advanced Settings'."

Adding Tags

Tags should follow a consistent key-value structure. In this case, we're using a simple but effective approach:

Model Name Tags

model: Qwen3-Next-80B-A3B-Thinking
model: DeepSeek-R1
model: Llama-3.1-8B
model: gemma-3-270m

This straightforward tagging strategy ensures that when users ask about a specific model, the hybrid search will only retrieve sections from documents tagged with that exact model name, preventing confusion between different models.

Define Metadata Example

Writing Effective Descriptions

Descriptions should be concise (1-2 lines) but provide meaningful context:

Good Examples:

  • "Technical specifications and capabilities for Qwen3-Next-80B-A3B-Thinking model including context length and performance benchmarks"
  • "Comprehensive guide to DeepSeek-R1 features, reasoning capabilities, and implementation details"
  • "NVIDIA-Nemotron-Nano-9B-v2 model documentation covering efficiency optimizations and deployment strategies"

Poor Examples:

  • "LLM documentation" (too vague)
  • "This document contains detailed information about..." (too wordy)

Step 4: Configure Agent for Metadata Usage

The metadata enhancement works automatically with existing agents, but you can optimize performance by configuring your agent's knowledge settings:

Agent Knowledge Settings

Notice that "Knowledge with AI Hybrid Search (recommended)" is selected as the integration mode. This is essential for metadata filtering to work effectively.

Ensure your agent's instructions reference the types of models or AI capabilities it supports, which helps with metadata matching.

Step 5: Test Metadata-Enhanced Retrieval

Use the preview chat to test how metadata improves document retrieval:

Test Query Example: "What are the reasoning capabilities of DeepSeek-R1?"

With the simple model: DeepSeek-R1 tag, the agent will use AI Hybrid Search to provide accurate, model-specific information without mixing details from other models like Qwen3-Next-80B-A3B-Thinking or Llama-3.1-8B.

Understanding Retrieval Modes: Hybrid Search vs. Large Context

One of the key benefits of using metadata with hybrid search is how it affects which document sections are retrieved and added to the conversation context. In the following example, we'll demonstrate this by querying information about specific LLM models like NVIDIA Nemotron and DeepSeek-R1, showing how metadata filtering ensures only relevant model documentation is retrieved instead of mixing information from different models.

Large Context Mode (Without Metadata Filtering)

When not using hybrid search with metadata, the system may retrieve sections from multiple different models, potentially causing confusion:

Sections Retrieved with Large Context

In this mode, you might see sections about different models mixed together, making it difficult for the LLM to provide accurate, model-specific information.

Hybrid Search Mode (With Metadata Filtering)

With hybrid search and metadata enabled, the system only retrieves sections that are relevant to the specific model being discussed:

Sections Retrieved with Hybrid Search

Notice how hybrid search mode ensures that only sections corresponding to the queried model are included in the context, leading to more accurate and focused responses.

Viewing Retrieved Sections in Instance Details

You can monitor which sections are being retrieved by viewing the instance details of your conversation. This transparency allows you to:

  • Verify that the correct model information is being retrieved
  • Debug any issues with metadata filtering
  • Understand how your agent is selecting relevant content

The instance details show exactly which document sections were added to the message context, displaying the specific PDFs and their relevance scores (as shown in the images above where you can see files like NVIDIA-Nemotron-Nano-9B-v2.pdf, gpt-oss-120b.pdf, and Qwen3-Next-80B-A3B-Instruct.pdf with their respective relevance scores), helping you validate that hybrid search is working effectively.

Advanced Metadata Implementation

Starting Simple: Model Name Only

Start with the simplest approach that solves your core problem - in this case, preventing cross-model information contamination:

model: Qwen3-Next-80B-A3B-Thinking
model: DeepSeek-R1
model: NVIDIA-Nemotron-Nano-9B-v2
model: Llama-3.1-8B

This single-tag strategy provides immediate benefits while being easy to implement and maintain. As your knowledge base grows, you can expand with additional dimensions:

model: Qwen3-Next-80B-A3B-Thinking
variant: Instruct

Implementation Best Practices

  • Consistency is key: Whatever tagging strategy you choose, maintain it across all documents
  • Start simple: A consistently applied simple system beats a complex, inconsistent one
  • Test regularly: Use real user queries to validate retrieval accuracy
  • Focus on quality: Meaningful tags are better than extensive but irrelevant tagging

Scaling Beyond LLM Documentation

This hybrid search approach applies to any domain with similar content structures:

  • Product catalogs with variant-specific information
  • Compliance documentation across different regulations
  • Technical manuals for equipment families
  • Process documentation across departments or regions

The key is identifying the primary dimension that differentiates your content and using that as your metadata foundation.

Conclusion

Document metadata transforms RAG-based agents from simple search tools into intelligent assistants. By providing structured context through tags and descriptions, you enable precise, targeted information retrieval across any domain.

The investment in organizing your knowledge base with metadata pays dividends in improved user experience and more effective AI-powered assistance. Start by adding simple tags to your documents and see the immediate improvement in response accuracy!

Integrating Google Calendar with your Serenity* AI Agent

· 3 min read

This guide walks you through integrating Google Calendar with your Serenity* Star agent using OAuth 2.0 authentication. You'll learn how to set up an HTTP Request skill that can create calendar events by making authenticated API calls to the Google Calendar API.

You can use this integration to interact with your Google Calendar in any way you like, such as creating and deleting events, retrieving event details, or updating existing events, all by asking your AI agent to perform these tasks.

Add an HTTP Request Skill

  1. From the agent designer, add a new HTTP Request skill. In the following example, I'm preparing a skill to add new events to my calendar.

    HTTP Request Skill Form

    Configure the following settings:

    • Code: CreateCalendarEvent
    • Description: POST HTTP request that adds an event to the calendar by specifying start date, end date, summary, and description in the body.
    • Method: POST
    • URL: https://www.googleapis.com/calendar/v3/calendars/<google-email-here>/events
  2. Select OAuth2 as your authentication type and press "Create new"

    OAuth2 Authentication Selection

Configuring the OAuth 2.0 Connection

Complete the OAuth 2.0 Connection Configuration form:

OAuth2 Connection Configuration Form

Configure the following settings:

  • Name: Google Calendar (this is just to identify the connection)
  • Auth URL: https://accounts.google.com/o/oauth2/v2/auth
  • Token URL: https://oauth2.googleapis.com/token
  • Client ID: Your Google OAuth app client ID (generated via Google Cloud Console)
  • Client Secret: Your Google OAuth app client secret
  • Scopes: https://www.googleapis.com/auth/calendar

For Google OAuth, you also need to add two additional Auth Request Parameters:

Access Type Parameter:

  • Key: access_type
  • Value: offline

Prompt Parameter:

  • Key: prompt
  • Value: consent

Important: Make sure to add the Redirect URI to your Google OAuth app as specified at the top of the form:

OAuth2 Redirect URI Configuration

Once the OAuth connection is complete, click "Continue" and go through Google's login and consent screens. You should see this success message:

OAuth2 Connection Success Message

Close the tab and return to the OAuth 2.0 Connection form. You should see the new connection configured in the OAuth 2.0 selector:

OAuth2 Connection Selector

Finish Configuring the HTTP Request

Press "Continue" to set up the rest of the request information. In this step, you may need to configure the request body. For my "Create Event" request, I used an AI-generated body like this:

HTTP Request Body Configuration

What's Next?

You can now try your Agent from the Preview panel. Ask it to create a calendar event, and it should respond with a confirmation message.

Once you're sure that's working correctly, you can reuse this OAuth 2.0 connection in other HTTP Request skills to provide your Agent with other ways to interact with your Google Calendar, such as retrieving events or deleting them.

Keep in Mind

  • Permissions: Ensure your Google OAuth app has the necessary permissions to access the Calendar API. You can manage these in the Google Cloud Console.
  • Your Agent will act on your behalf: When you set up the OAuth connection, your agent will be able to create, modify, and delete events in your Google Calendar. Keep this in mind before sharing your agent publicly.

Additional Resources

Advanced ATM Security Assistant

· 3 min read
Guillermo Ezquer
Guillermo Ezquer
Software Engineer

Introduction

In high-risk environments such as Automated Teller Machines (ATMs), the need to detect suspicious behavior in real time is critical. This article explores a concrete use case: extending an existing helmet-detection system with a natural language agent (LLM) that interprets, classifies, and responds to risk scenarios captured in images.

From Visual Detection to Semantic Understanding

The system builds upon an already functional infrastructure that identifies individuals wearing helmets. On top of this, an "activity agent" is trained with a specific prompt designed to:

  • Analyze images for unlawful or suspicious behavior
  • Classify the event (e.g., armed robbery, forced entry, vandalism)
  • Count and describe individuals (age, gender, clothing, height, tattoos)
  • Generate a structured JSON output with tags, confidence scores, timestamps, and recommended actions

Step-by-Step Agent Setup in Serenity* Star

Creating this kind of agent in Serenity* Star is straightforward. Below is a visual walkthrough:

  1. Create a new agent
    Create new agent

  2. Select the 'Advanced ATM Security Assistant' template
    Choose template

  3. Customize the endpoint name and configuration
    Configure endpoint

  4. Finalize creation
    Create agent

  5. Enable image processing capabilities
    Activate vision

  6. Upload an image to test the agent
    Upload test image

Execution and Results

Once deployed, the agent can analyze ATM surveillance images with impressive speed and accuracy.

  • Test Image 1 – Normal ATM usage scenario:

    Test image 1
    Agent response 1

    The system correctly identifies that no unlawful activity is occurring, with a low-risk score and a recommendation to ignore.

  • Test Image 2 – Forced entry attempt:

    Test image 2
    Agent response 2

    Here, the agent classifies the situation as “forced entry,” detects visible vandalism, and recommends dispatching security with a high-confidence score.

  • Test Image 3 – Attempted ATM break-in with tools:

    Test image 3
    Agent response 3

    The agent detects a masked suspect attempting to breach the ATM using bolt cutters, with high alert level and immediate action recommendation.

Integration with Serenity* Star

The activity agent operates entirely within Serenity* Star, enabling seamless monitoring and continuous refinement of its performance. Once deployed, it enables:

  • Centralized incident management across multiple camera feeds
  • Automated action flows (alerts, escalations, reports)
  • Continuous training via real-world feedback loops

API Access and Execution

To retrieve the API Key and execute the agent via code, Serenity* Star provides auto-generated code snippets. Here's how to find and use them:

  • Step 1: Locate the "Code Snippets" section in the agent configuration
    Code Snippets button

  • Step 2: Copy the cURL command to execute your agent via API
    cURL example with API Key

Systems Integration with Serenity* Star

  1. Upload the images to analyze to AI Hub through the volatile knowledge endpoint:
    Upload Volatile Knowledge

    curl --location 'https://api.serenitystar.ai/api/v2/VolatileKnowledge' \
    --header 'X-API-KEY: <YOUR_API_KEY>' \
    --form '<YOUR_IMAGE_FILE>'

  2. Check image processing status:
    Check Volatile Knowledge

    curl --location 'https://api.serenitystar.ai/api/v2/VolatileKnowledge/<VOLATILE_KNOWLEDGE_ID>' \
    --header 'X-API-KEY: <YOUR_API_KEY>'

  3. Execute the agent with the uploaded image ID:
    Execute Agent

    curl --location 'https://api.serenitystar.ai/api/v2/agent/ATMassistant/execute' \
    --header 'Content-Type: application/json' \
    --header 'X-API-KEY: <YOUR_API_KEY>' \
    --data '[{
    "Key": "volatileKnowledgeIds",
    "Value": ["<YOUR_IMAGE_VOLATILE_KNOWLEDGE_ID>"]
    }]'

  4. Integrate the resulting JSON response with your target system.

Conclusion

This use case demonstrates how combining LLMs with computer vision elevates security from passive monitoring to intelligent, operational interpretation. By generating structured, actionable insights in real time, Serenity Star is ready to scale these solutions into critical infrastructure environments.

Using Forms to collect leads

· 5 min read
Julia Schröder Langhaeuser
Julia Schröder Langhaeuser
Product Director

In today's competitive digital landscape, generating high-quality leads is crucial for business growth. AI Agents can transform your lead generation process by engaging with visitors in a conversational manner while seamlessly collecting valuable information. In this article, we'll explore how to use the Forms capability in Serenity* AI Hub to create an effective lead collection system.

Why Use Forms for Lead Generation?

Traditional lead forms can be static and impersonal, often leading to high abandonment rates. Conversational AI offers several advantages:

  • Natural Interaction: Visitors engage in a conversation rather than filling out fields on a form
  • Progressive Data Collection: Information is gathered gradually throughout the conversation
  • Personalized Experience: The agent adapts its questions based on previous responses
  • Higher Completion Rates: Less intimidating than lengthy traditional forms
  • 24/7 Availability: Collect leads around the clock without human intervention

Setting Up Your Lead Generation Form

Let's create an Assistant Agent that will engage with website visitors and collect lead information for your sales team.

Prerequisites

  • Access to Serenity* AI Hub
  • A clear understanding of what lead information you need to collect

Step 1: Create a Lead Generation Agent

Start by creating a new Assistant Agent specifically designed for lead collection. You can either use a template or create one from scratch.

Configure your agent with a personality that aligns with your brand. For lead generation, a friendly and helpful tone usually works best.

Step 2: Configure the Forms Feature

Navigate to the Forms tab in your agent configuration.

Forms Tab

Click on "Add Field" to begin building your lead capture form.

Step 3: Define Lead Information Fields

For an effective lead generation form, consider adding these essential fields:

  1. Name (Text type)

    • Set as required
    • Instructions: "Ask for the person's full name"
  2. Email (Email type)

    • Set as required
    • Instructions: "Collect a valid email address for follow-up"
  3. Phone Number (Phone type)

    • Optional
    • Instructions: "Request phone number including country code if the lead seems interested in a call"
  4. Company (Text type)

    • Set as required
    • Instructions: "Ask for the company name"
  5. Role/Position (Text type)

    • Optional
    • Instructions: "Inquire about their position or role in the company"
  6. Interest Level (Select type)

    • Options: High, Medium, Low
    • Instructions: "Based on the conversation, assess their interest level"
  7. Product Interest (Select type)

    • Options: [Your specific products/services]
    • Instructions: "Determine which of our products or services they're most interested in"
  8. Additional Notes (Text type)

    • Optional
    • Instructions: "Capture any other relevant information shared during the conversation"

For each field, configure how it should be collected:

Field Configuration Example Field Configuration Example

Step 4: Set Collection Instructions

For a lead generation use case, it's usually best to select "After a Few Messages" as the collection timing. This allows the agent to build rapport before asking for information.

Collection Timing

For custom instructions, you might use:

"Engage in a natural conversation first. Ask about the visitor's challenges or needs. After establishing rapport, begin collecting lead information in a conversational way. Don't ask for all information at once - spread questions throughout the conversation."

Step 5: Test Your Lead Generation Agent

Use the preview chat to test how your agent collects lead information. Pay attention to:

  • How naturally the questions are integrated into the conversation
  • Whether the agent collects all required information
  • How the agent handles objections or hesitations

Testing Lead Form

Make adjustments to your form fields and instructions based on the test results.

Step 6: Deploy Your Lead Generation Agent

Once you're satisfied with your lead generation agent, publish it to make it available for use. You can integrate it with your website, landing pages, or other digital channels.

Accessing and Managing Lead Data

After your agent has been collecting leads, you can access this valuable information from the agent card by clicking the "Forms" button.

Access Forms Button

On the forms page, you'll see all the lead data organized in a grid format:

Lead Data Grid

You can:

  • Sort and filter leads
  • Export lead data to Excel for integration with your CRM
  • View different versions of your form to track performance over time

Best Practices for Conversational Lead Generation

  1. Start with Value: Have your agent provide helpful information before asking for contact details
  2. Be Transparent: Clearly communicate why you're collecting information and how it will be used
  3. Progressive Disclosure: Start with simple questions and gradually move to more detailed ones
  4. Offer Incentives: Consider offering something valuable in exchange for contact information
  5. Follow Up: Ensure leads are promptly followed up by your sales team
  6. Continuous Improvement: Regularly review conversations and adjust your form fields and agent instructions

Conclusion

Forms in AI Hub provide a powerful way to collect leads through conversational AI. By creating a natural, engaging experience, you can increase both the quantity and quality of leads while gathering rich contextual information that helps your sales team close more deals.

Ready to revolutionize your lead generation process? Start by creating your first lead collection agent today!

Using Serenity* Visual Studio Code Chat to Create Automated Tests

· 6 min read
Carolina De Cono
Carolina De Cono
QA Analyst

In today's fast-paced development environment, automated testing is essential for ensuring software quality and efficiency. The Serenity* VSCode Chat extension offers a powerful solution for developers looking to streamline their testing processes.

This blog post will guide you through the process of using the Serenity* VSCode Chat extension in Visual Studio Code to create automated test cases, enhancing both efficiency and effectiveness in your projects.

Introduction to Serenity* VSCode Chat

Serenity* VSCode Chat is a Visual Studio Code extension that brings AI assistance directly into your development environment. Configure custom AI agents with project-specific instructions and documentation, turning them into pair-programming companions that understand your project's context.

image.png

The Serenity QA team uses this extension to facilitate E2E test development. The configured AI agent ensures tests follow our naming conventions and Arrange-Act-Assert pattern, adds meaningful comments, and suggests appropriate reusable components that were custom-built to use Selenium to interact with Serenity* Star.

By using the VSCode extension, the team has access to the agent and can quickly ask for help and iterate with the tests directly in VSCode.

Successful use case

By utilizing this tool, we were able to reduce the time spent on manual testing by over 50%. The team reported improved test coverage and faster feedback loops, which ultimately led to a more stable and reliable product release.

In a recent project, the Katalon Chrome extension was used to record the steps necessary for testing essential functions in our application. After recording the interactions, the scripts were exported in the programming language used by our development team. This script was then run through the Serenity* VSCode Chat extension, which refactored the code to reduce errors and align it with our coding standards. The result was a cleaner, more efficient test script that significantly improved our testing workflow.

Katalon export example, with languages available for exporting:

image.png

C# code block to be exported:

using System;
using System.Text;
using System.Text.RegularExpressions;
using System.Threading;
using NUnit.Framework;
using OpenQA.Selenium;
using OpenQA.Selenium.Firefox;
using OpenQA.Selenium.Support.UI;

namespace SeleniumTests
{
[TestFixture]
public class CheckConditionPlugin
{
private IWebDriver driver;
private StringBuilder verificationErrors;
private string baseURL;
private bool acceptNextAlert = true;

[SetUp]
public void SetupTest()
{
driver = new FirefoxDriver();
baseURL = "https://www.google.com/";
verificationErrors = new StringBuilder();
}

[TearDown]
public void TeardownTest()
{
try
{
driver.Quit();
}
catch (Exception)
{
// Ignore errors if unable to close the browser
}
Assert.AreEqual("", verificationErrors.ToString());
}

[Test]
public void TheCheckConditionPluginTest()
{
driver.Navigate().GoToUrl("https://<URL>/MyAgents");
driver.FindElement(By.XPath("//div[@id='my-agents-grid']/div/div[6]/div/div/div/div/table/tbody[2]/div/a/div")).Click();
driver.Navigate().GoToUrl("https://<URL>/AssistantAgent/Edit/85B09A36-E17E-C359-3D4D-3A18738550EE");
driver.FindElement(By.XPath("//a[@id='skills-tab']/span[2]")).Click();
driver.FindElement(By.Id("btn-add-plugin-empty")).Click();
driver.FindElement(By.XPath("//div[@id='skills-grid']/div/div/div/a/div/p")).Click();
driver.FindElement(By.XPath("//form[@id='default-plugin-configuration-form']/div/div[2]/ignite-input/div/input")).Click();
driver.FindElement(By.XPath("//form[@id='default-plugin-configuration-form']/div/div[2]/ignite-input/div/input")).Clear();
driver.FindElement(By.XPath("//form[@id='default-plugin-configuration-form']/div/div[2]/ignite-input/div/input")).SendKeys("01");
driver.FindElement(By.XPath("//div[@id='plugin-description-section']/div[2]/ignite-textarea-extension/div/textarea")).Clear();
driver.FindElement(By.XPath("//div[@id='plugin-description-section']/div[2]/ignite-textarea-extension/div/textarea")).SendKeys("evalua si el usuario dice hola");
driver.FindElement(By.XPath("//div[@id='plugin-configuration-form']/div/div/div[3]/button[4]")).Click();
driver.FindElement(By.Id("btn-submit-assistant-agent")).Click();
driver.FindElement(By.LinkText("Save Changes")).Click();
driver.Navigate().GoToUrl("https://<URL>/AssistantAgent/Edit/85b09a36-e17e-c359-3d4d-3a18738550ee");
}

private bool IsElementPresent(By by)
{
try
{
driver.FindElement(by);
return true;
}
catch (NoSuchElementException)
{
return false;
}
}

private bool IsAlertPresent()
{
try
{
driver.SwitchTo().Alert();
return true;
}
catch (NoAlertPresentException)
{
return false;
}
}

private string CloseAlertAndGetItsText() {
try {
IAlert alert = driver.SwitchTo().Alert();
string alertText = alert.Text;
if (acceptNextAlert) {
alert.Accept();
} else {
alert.Dismiss();
}
return alertText;
} finally {
acceptNextAlert = true;
}
}
}
}

The script is then run though our VSCode extension:

image.png

Code scripts can be iterated to completion using VSCode Chat extension, that can solve issues and propose solutions:

image.png

Examples of successful tests after iterating with VSCode Chat:

image.png

Configuring Serenity* VSCode Chat and Katalon

To get started with this powerful combination, follow these steps:

  1. Install Visual Studio Code: If you haven't already, download and install Visual Studio Code.

  2. Install the Serenity* VSCode Chat Extension:

    1. Open Visual Studio Code.
    2. Click on the Extensions icon in the Activity Bar.
    3. Search for Serenity* VSCode Chat and click Install.
  3. Install Katalon Extension for Chrome:

    1. Open Google Chrome and navigate to the Chrome Web Store.
    2. Search for Katalon and click Add to Chrome.
  4. Set Up Your Project:

    1. Create a new project or open an existing one in Visual Studio Code.
    2. Ensure that your project is configured to use the Serenity* Star framework.

Creating and Executing Automated Tests

Now that you have both tools set up, let's create and execute automated tests:

  1. Record Your Test Steps:

    1. Open the Katalon extension in Chrome.
    2. Click on Record and perform the actions you want to test.
    3. Once finished, click Stop Recording.
  2. Export the Test Script:

    1. Click on the Export button and choose the appropriate programming language for your development team.
  3. Refactor the Script with Serenity* VSCode Chat:

    1. Copy and paste the export script in the integrated chat and ask the agent to refactor it.
  4. Run Your Tests:

    1. Make sure you have the following extension installed: image.png
    2. After building your project, run your tests with the play button on each test.
    3. Review the output for test results and any errors that may have occurred.

How to Configure your Agent and Associate it with Serenity Star Chat

First we need to create an AI Agent in Serenity* AI Hub:

  1. Get a Free Serenity* Star Account and Login

  2. Click on “AI Agents”

    image.png

  3. Click over the “New Agent” button

    image.png

  4. Search for the VSCode agent template

    image.png

  5. Adjust anything you need and click on the "Create" button at the bottom-right corner of your screen.

💡 Tip: You can freely adjust your agent’s personality, knowledge, and skills. Keep in mind, AI Agents perform best when provided with rich and relevant context.

Getting your API Key

  1. Now that the agent is created, from the AI Agents grid, click over the new agent’s card to go to the Agent Designer view.

  2. Once in the Designer for the Coding expert agent, click on the Code Snippets button at the top-right of your screen.

  3. You can get your API Key from the CURL snippet:

    Api Key

Setting up the VSCode extension

  1. Go to VSCode

  2. Install the Serenity* VSCode extension

    image.png

  3. Open the Serenity* Chat View and click on the Setup Serenity button.

    image.png

  4. This will guide you through a short process to setup your API Key and default agent.

    image.png

  5. Once done, you can start chatting with your Agent from the Serenity* Chat View:

    image.png

Tips and Best Practices

By integrating the Serenity* VSCode Chat extension, you can significantly enhance your automated testing process. This extension allows for efficient test creation, refactoring, and execution, ultimately leading to higher quality software and faster release cycles. Embrace these tools to streamline your development workflow and improve your testing outcomes!

For more information on using the Serenity* VSCode Chat extension, visit the Serenity* VS Code Documentation.

Giving an AI Agent access to your emails

· 3 min read
Julia Schröder Langhaeuser
Julia Schröder Langhaeuser
Product Director

We want to provide an agent with the capability of accessing our Microsoft account to help us process our emails. We will take advantage of the Http request skill, and configure the OAuth authentication to use Microsoft Graph APIs. We will be configuring both the access in Microsoft Entra and the agent in Serenity* Star.

Follow this steps to configure the OAuth authentication method.

  1. We need to start by having an application registered in Microsoft. To do this, in the Microsoft Entra page, we will access the App registration section:

    image.png

  2. And click on New registration:

    image.png

    It is important to add https://hub.serenitystar.ai/OAuth2Connection/AuthorizationCallback as a Redirect Uri to give the required permissions for the authentication.

    image.png

  3. On Serenity* Star, we add a new HTTP request skill, and start configuring our integration. We will choose OAuth2 as authentication type and click on Create New to define it:

    image.png

    You will see something like this, and we will go step by step through each of the fields:

    image.png

    • Name: it is for using this configuration within the AI Hub.

    • Auth URL and Token URL: we will obtain it from Microsoft Entra. On your app registration, you can access the Endpoints list:

      image.png

      In particular, we need the OAuth 2.0 authorization endpoint (v2) and the OAuth 2.0 token endpoint (v2)

      image.png

    • Client Id: We obtain it directly from the app registration definition:

      image.png

    • Client Secret: we will create a new secret from Microsoft Entra and link it on Serenity* Star:

      image.png

      Be aware that the expiration defined here will impact the actions that can be performed by the agent.

    • Scope: this will define which endpoints can be accessed with this authentication. The definition in Serenity* Star has to match the permissions that were given to this application in Microsoft Entra. To do this, we go to the API permissions section:

      image.png

      In this case, I want to use Microsoft Graph API, but from here it will depend on the implementation.

      image.png

      image.png

      image.png

      image.png

      In the Scope configuration in the AI Hub, we need to add all of this permissions separated by a white space.

      Important: apart from the scope you want to enable, always add “offline_access” to your scope to enable the authentication.

  4. Now you are ready to test the connection. You should see a new tab opened, and if everything was configured correctly, it will have a message like this one:

    image.png

  5. Now we can finish configuring the Http request skill, to access our emails.

    In the Microsoft Graph documentation, you can see all of the different endpoints that are available. In particular, we will configure our skill to read our mailbox, and we will use this endpoint:

    https://learn.microsoft.com/en-us/graph/api/user-list-messages?view=graph-rest-1.0&tabs=http

    The parameters of the endpoint can be fully configured following this documentation: https://learn.microsoft.com/en-us/graph/query-parameters?tabs=http

    The following configuration for example, retrieves the sender and subject of 50 emails received since a variable date. The agent will decide the correct date based on the parameters.

    image.png

    TIP: we recommend testing the requests from the Graph Explorer tool https://developer.microsoft.com/en-us/graph/graph-explorer?request=me%2Fmessages&version=v1.0

  6. We will use a basic prompt, but ensure to (with the help of liquid) let the agent know what day it is today.

    Help the user process his emails.
    You only have access to the sender and subject of those emails.
    Take into account that today is {{ "now" | date: "%Y-%m-%d %H:%M" }}
  7. We can try it out with a simple request:

    image.png

And see the execution of the tool:

image.png

Create an AI Agent with Alibaba Cloud

· 2 min read
Máximo Flugelman
Máximo Flugelman
Project Manager

Serenity* AI Hub provides easy access to a variety of Large Language Models (LLM) powering your AI Agents. The LLM can be thought of as the brain powering your agent.
In this article, you will learn how to integrate models though Alibaba Cloud to power your AI solutions.

Introduction

Qwen is a family of foundational models by Alibaba, available in a variety of sizes, use cases and techologies, designed for fast usage and scaling

alt text

Creating an agent

  1. Register for free on Serenity* AI Hub.
  2. On the home screen, use the integrated chat with Serena to create a new agent.
  3. Once Serena correctly identifies the use case for the agent, you will be taken to the Agent Designer, where you can fully customize your agent.

alt text alt text

Selecting Alibaba Qwen Models

In the Agent Designer, go to the Model tab. From the model dropdown, you can easily select Alibaba Qwen Models. Once the selected model is chosen, the agent is ready to be used and evaluated. Changing between different Qwen models is as easy as selecting the appropriate model from the dropdown menu.

alt text

Integrating with your client application

Exporting your agent and integrating it with your application is as simple as executing an HTTP request to AI Hub. For a quick example, click on Code Snippets in the top right corner, and a sample CURL command will be generated to execute the agent. You can easily integrate this CURL command with your system and start enhancing your applications.

alt text alt text

Integrate AI Agents in Zapier

· 3 min read
Máximo Flugelman
Máximo Flugelman
Project Manager

Integrating Serenity* AI Hub Agents with Zapier is a straightforward way to automate tasks and trigger Agent actions through a wide range of options and workflows. This guide will walk you through the simple steps to configure your Agents in your Zaps!

Steps

  1. Sign up for free to create your first AI agent and get your API key.

  2. Log in to Zapier to create or edit an existing Zap.

  3. Create a new step in your workflow and search for the Serenity* Star connector. Select Serenity* Star Connector

  4. Sign in to Serenity* AI Hub by creating a new connection in Zapier. Create a new Connection

  5. Insert your Serenity* AI Hub API key credentials. Entering credentials

  6. Select the event you want to execute in this step.

  7. Complete the mandatory parameters and automate your workflow! alt text

Available Events

Execute Activity Agent

A simplified event that executes any activity agent from a list of your available agents on AI Hub.

  • Agent Code (required): Select from the provided list the Activity Agent you want to execute.
  • Input Parameters: The parameters defined in the Parameters tab on the Agent Designer allow you to configure agent behavior and functionality. For more details on how to define and use parameters, refer to the Serenity Input Parameters Guide. Be sure to provide values for all required parameters.
  • Agent Version: The specific version of the agent to be executed. If no value is specified, the published version will be used.

alt text

Create Assistant Conversation

This event is used for starting a new conversation with a given Assistant Agent. It returns the necessary chatId for sending messages in a conversation.

Configuring parameters:

  • Agent Code (required): Select from the provided list the Assistant Agent you want to start the conversation with.
  • Input Parameters: The parameters defined in the Parameters tab on the Agent Designer allow you to configure agent behavior and functionality. For more details on how to define and use parameters, refer to the Serenity Input Parameters Guide. Be sure to provide values for all required parameters.
  • Agent Version: The specific version of the agent to be executed. If no value is specified, the published version will be used.
  • User Identifier: An optional identifier used to associate the conversation with a specific user in Serenity* AI Hub.

alt text

Execute Assistant Conversation

This event is used to send messages to the selected agent through a given chat instance. Use this event to send and receive messages with the agent.

Configuring parameters:

  • Agent Code (required): Select from the provided list the Assistant Agent you want to message. Be sure to select the same agent you have already started a conversation with.
  • Chat Id (required): The chat ID of the conversation where the messages will be sent. It's recommended to map this value to the data output of the Create Assistant Conversation event.
  • Message (required): The message to send to the agent.
  • Input Parameters: The parameters defined in the Parameters tab on the Agent Designer allow you to configure agent behavior and functionality. For more details on how to define and use parameters, refer to the Serenity Input Parameters Guide. Be sure to provide values for all required parameters.

alt text

Create an AI Agent with IBM's new LLM Granite

· 2 min read
Máximo Flugelman
Máximo Flugelman
Project Manager

Serenity* AI Hub provides easy access to a variety of Large Language Models (LLM) powering your AI Agents. The LLM can be thought of as the brain powering your agent.
In this article, you will learn how to integrate IBM foundational models from the Granite family to power your AI solutions.

Introduction

Granite is a family of foundational models by IBM, available in a variety of sizes: 2, 8, and 20 billion parameters. The new IBM Granite 3.0 models deliver state-of-the-art performance relative to model size while maximizing safety, speed, and cost-efficiency for enterprise use cases.

alt text

Creating an agent

  1. Register for free on Serenity* AI Hub.
  2. On the home screen, use the integrated chat with Serena to create a new agent.
  3. Once Serena correctly identifies the use case for the agent, you will be taken to the Agent Designer, where you can fully customize your agent.

alt text alt text

Selecting IBM Granite Models

In the Agent Designer, go to the Model tab. From the model dropdown, you can easily select IBM Granite models. Once the selected model is chosen, the agent is ready to be used and evaluated. Changing between different Granite models is as easy as selecting the appropriate model from the dropdown menu.

alt text

Integrating with your client application

Exporting your agent and integrating it with your application is as simple as executing an HTTP request to AI Hub. For a quick example, click on Code Snippets in the top right corner, and a sample CURL command will be generated to execute the agent. You can easily integrate this CURL command with your system and start enhancing your applications.

alt text alt text