In order to maintain a virtual agent locally, the first step to do is to clone the virtual agent.

Install Cognigy-CLI

One needs to install the CLI:

  1. Open a Terminal on Linux / Mac or the PowerShell on Windows.
  2. Make sure that NPM is installed.
  3. Run the following command:
npm install -g @cognigy/cognigy-cli

Now, one should be able to open a

Configure Agent

Configuration can be provided either as environment variables or inside a config.json file. The config.json can be created by executing cognigy init.

The Cognigy.AI CLI needs the following configuration:

Key Description Environment Var
baseUrl The base URL of your Cognigy.AI environment API CAI_BASEURL
apiKey The Cognigy.AI API Key to use CAI_APIKEY
agent The ID of your agent project CAI_AGENT
agentDir The folder where you want to store the agent locally CAI_AGENTDIR

Both environment configuration and file-based configuration can be used together. Environment configuration takes priority.

How it works

First, the developer will be asked to provide a name for the configuration. This name does not need to fit the agent's name. Thus, one can call it, for example, "Help Center". The second required value is the Cognigy.AI 4.0 API Key. This value can be created in the Profile section inside Cognigy.AI:

URL: https://trial.cognigy.ai/me

cognigyProfileAPIKey.png

Now, in the third step, the ID of the virtual agent needs to be provided. With this information, the CLI will now which specific agent should be cloned from Cognigy:

cognigyAgentId.png

In this case, this ID is: 5f7329ba556a08007327f9d0

After that, one needs to insert the base URL of the related API. This is used to get all the agents' resources for the cloning process. There are the following base URLs:

  1. api-trial.cognigy.ai
  2. api-app.cognigy.ai
  3. <On Premises URL will be different>

This tutorial uses the Trial environment, the base URL is https://api-trial.cognigy.ai/. The last two questions can be answered by hitting the Enter key on the keyboard.

Now, there will be a config.json file in the current folder. This file contains the following configured information:

{
"name": "Help Center",
"apiKey": "234lkj234kjh234",
"agent": "5f7329ba556a08007327f9d0",
"baseUrl": "https://api-trial.cognigy.ai",
"agentDir": "./agent",
"filePath": "./config.json"
}

Clone the Agent 

All the previous steps were related to the configuration to set up a local environment. Now, this configuration will be used to finally clone the actual agent. 

  1. Open a Terminal on Linux / Mac or the PowerShell on Windows.
  2. Run the following command:
cognigy clone

This command uses the config.json file which needs to be located in the same directory. Last but not least, one has to follow the instructions displayed in the command line. the cloned agent will be stored in the ./agent folder and looks like this:

.
├── endpoints
│   └── Webchat
│       ├── config.json
│       └── transformer.ts
├── flows
│   ├── Gatekeeper\ (GDPR)
│   │   ├── config.json
│   │   └── en-US
│   │       ├── chart.json
│   │       └── intents.json
│   ├── Last\ Question\ Result\ Lookup
│   │   ├── config.json
│   │   └── en-US
│   │       ├── chart.json
│   │       └── intents.json
│   ├── Main
│   │   ├── config.json
│   │   └── en-US
│   │       ├── chart.json
│   │       └── intents.json
│   ├── Repeat\ Last\ Intent
│   │   ├── config.json
│   │   └── en-US
│   │       ├── chart.json
│   │       └── intents.json
│   └── locales.json
└── lexicons

This will be different for your virtual agent.

 

This locally stored agent now could be used to maintain and versioning the conversational AI project. How to do this, is explained in the next articles.


Comments

0 comments

Please sign in to leave a comment.

Was this article helpful?
0 out of 0 found this helpful