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
Python Package
If you haven’t already installed the AWS-related dependencies, make sure to install them:
pip install "multi-agent-orchestrator[aws]"
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'});
from multi_agent_orchestrator.agents import LexBotAgent, LexBotAgentOptions
agent = LexBotAgent(LexBotAgentOptions( name='My Basic Lex Bot Agent', description='An agent specialized in flight booking', bot_id='your-bot-id', bot_alias_id='your-bot-alias-id', locale_id='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 theAWS_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:
- First, ensure you have created an instance of the orchestrator:
import { MultiAgentOrchestrator } from 'multi-agent-orchestrator';
const orchestrator = new MultiAgentOrchestrator();
from multi_agent_orchestrator.orchestrator import MultiAgentOrchestrator
orchestrator = MultiAgentOrchestrator()
- Then, add the LexBotAgent to the orchestrator:
orchestrator.addAgent(agent);
orchestrator.add_agent(agent)
- 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");
response = await orchestrator.route_request( "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.