Skip to content

LexBotAgent

The LexBotAgent is a specialized agent class in the Multi-Agent Orchestrator System that integrates Amazon Lex bots.

Key Features

  • Seamless integration with Amazon Lex V2 bots
  • Support for multiple locales
  • Easy configuration with bot ID and alias

Creating a LexBotAgent

To create a new LexBotAgent with the required parameters, use the following code:

import { LexBotAgent } from 'multi-agent-orchestrator';
const agent = new LexBotAgent({
name: 'My Basic Lex Bot Agent',
description: 'An agent specialized in flight booking',
botId: 'your-bot-id',
botAliasId: 'your-bot-alias-id',
localeId: 'en_US',
region: 'us-east-1'
});

Parameter Explanations

  • name: (Required) Identifies the agent within your system.
  • description: (Required) Describes the agent’s purpose or capabilities.
  • bot_id: (Required) The ID of the Amazon Lex bot you want to use.
  • bot_alias_id: (Required) The alias ID of the Amazon Lex bot.
  • locale_id: (Required) The locale ID for the bot (e.g., ‘en_US’).
  • region: (Optional) The AWS region where the Lex bot is deployed. If not provided, it will use the AWS_REGION environment variable or default to ‘us-east-1’.

Adding the Agent to the Orchestrator

To integrate the LexBotAgent into your Multi-Agent Orchestrator, follow these steps:

  1. First, ensure you have created an instance of the orchestrator:
import { MultiAgentOrchestrator } from 'multi-agent-orchestrator';
const orchestrator = new MultiAgentOrchestrator();
  1. Then, add the LexBotAgent to the orchestrator:
orchestrator.addAgent(agent);
  1. Now you can use the orchestrator to route requests to the appropriate agent, including your Lex bot:
const response = await orchestrator.routeRequest(
"I would like to book a flight",
"user123",
"session456"
);

By leveraging the LexBotAgent, you can easily integrate pre-built Amazon Lex Bots into your Multi-Agent Orchestrator.