diff --git a/README.md b/README.md index cd54c11..3a52d94 100644 --- a/README.md +++ b/README.md @@ -103,7 +103,7 @@ Discover creative implementations and diverse applications of the Multi-Agent Or - **[Speak Up, AI: Voicing Your Agents with Amazon Connect, Lex, and Bedrock](https://community.aws/content/2mt7CFG7xg4yw6GRHwH9akhg0oD/speak-up-ai-voicing-your-agents-with-amazon-connect-lex-and-bedrock)** - This article demonstrates how to build an AI customer call center. It covers the architecture and setup of specialiazed AI agents using the Multi-Agent Orchestrator framework interacting with voice via **Amazon Connect** and **Amazon Lex**. + This article demonstrates how to build an AI customer call center. It covers the architecture and setup of specialized AI agents using the Multi-Agent Orchestrator framework interacting with voice via **Amazon Connect** and **Amazon Lex**. ### TypeScript Version @@ -299,8 +299,14 @@ We welcome contributions! Please see our [Contributing Guide](https://raw.github - [Corneliu Croitoru](https://www.linkedin.com/in/corneliucroitoru/) - [Anthony Bernabeu](https://www.linkedin.com/in/anthonybernabeu/) -# Contributors -[![contributors](https://contrib.rocks/image?repo=awslabs/multi-agent-orchestrator&max=2000)](https://github.com/awslabs/multi-agent-orchestrator/graphs/contributors) +# 👥 Contributors + +Big shout out to our awesome contributors! Thank you for making this project better! 🌟 ⭐ 🚀 + +[![contributors](https://contrib.rocks/image?repo=awslabs/multi-agent-orchestrator&max=2000&time=1700573333)](https://github.com/awslabs/multi-agent-orchestrator/graphs/contributors) + + +Please see our [contributing guide](./CONTRIBUTING.md) for guidelines on how to propose bugfixes and improvements. ## 📄 LICENSE diff --git a/python/setup.cfg b/python/setup.cfg index dc37b52..47f50bc 100644 --- a/python/setup.cfg +++ b/python/setup.cfg @@ -1,6 +1,6 @@ [metadata] name = multi_agent_orchestrator -version = 0.0.20 +version = 0.0.21 author = Anthony Bernabeu, Corneliu Croitoru author_email = brnaba@amazon.com, ccroito@amazon.com description = Multi-agent orchestrator framework diff --git a/python/src/multi_agent_orchestrator/agents/amazon_bedrock_agent.py b/python/src/multi_agent_orchestrator/agents/amazon_bedrock_agent.py index 0230b79..b208a49 100644 --- a/python/src/multi_agent_orchestrator/agents/amazon_bedrock_agent.py +++ b/python/src/multi_agent_orchestrator/agents/amazon_bedrock_agent.py @@ -59,12 +59,18 @@ async def process_request( :param additional_params: Optional additional parameters as key-value pairs. :return: A ConversationMessage object containing the agent's response. """ + + session_state = {} + if (additional_params and 'sessionState' in additional_params): + session_state = additional_params['sessionState'] try: + print(session_state) response = self.client.invoke_agent( agentId=self.agent_id, agentAliasId=self.agent_alias_id, sessionId=session_id, - inputText=input_text + inputText=input_text, + sessionState=session_state ) completion = "" diff --git a/python/src/multi_agent_orchestrator/storage/in_memory_chat_storage.py b/python/src/multi_agent_orchestrator/storage/in_memory_chat_storage.py index 293bf0e..67116d6 100644 --- a/python/src/multi_agent_orchestrator/storage/in_memory_chat_storage.py +++ b/python/src/multi_agent_orchestrator/storage/in_memory_chat_storage.py @@ -59,6 +59,9 @@ async def fetch_all_chats( if stored_user_id == user_id and stored_session_id == session_id: for message in messages: new_content = message.content if message.content else [] + + if len(new_content) > 0 and message.role == "assistant": + new_content = [{'text':f"[{agent_id}] {new_content[0]['text']}"}] all_messages.append(TimestampedMessage( role=message.role, content=new_content, diff --git a/python/src/tests/agents/test_amazon_bedrock_agent.py b/python/src/tests/agents/test_amazon_bedrock_agent.py index d34b658..0c62873 100644 --- a/python/src/tests/agents/test_amazon_bedrock_agent.py +++ b/python/src/tests/agents/test_amazon_bedrock_agent.py @@ -50,7 +50,8 @@ async def test_process_request_success(bedrock_agent): agentId='test_agent_id', agentAliasId='test_agent_alias_id', sessionId='test_session', - inputText='Test input' + inputText='Test input', + sessionState={} ) @pytest.mark.asyncio @@ -116,4 +117,4 @@ async def test_process_request_with_additional_params(bedrock_agent): assert isinstance(result, ConversationMessage) assert result.role == ParticipantRole.ASSISTANT.value - assert result.content == [{"text": "Response with additional params"}] \ No newline at end of file + assert result.content == [{"text": "Response with additional params"}] diff --git a/typescript/src/agents/amazonBedrockAgent.ts b/typescript/src/agents/amazonBedrockAgent.ts index 5836722..2a997bd 100644 --- a/typescript/src/agents/amazonBedrockAgent.ts +++ b/typescript/src/agents/amazonBedrockAgent.ts @@ -52,14 +52,15 @@ export class AmazonBedrockAgent extends Agent { userId: string, sessionId: string, chatHistory: ConversationMessage[], - additionalParams?: Record + additionalParams?: Record ): Promise { // Construct the command to invoke the Amazon Bedrock agent with user input const command = new InvokeAgentCommand({ agentId: this.agentId, agentAliasId: this.agentAliasId, - sessionId, - inputText + sessionId: sessionId, + inputText: inputText, + sessionState: additionalParams ? additionalParams.sessionState? additionalParams.sessionState : undefined : undefined, }); try { diff --git a/typescript/src/orchestrator.ts b/typescript/src/orchestrator.ts index f78a27c..f76f69b 100644 --- a/typescript/src/orchestrator.ts +++ b/typescript/src/orchestrator.ts @@ -345,7 +345,7 @@ export class MultiAgentOrchestrator { userInput: string, userId: string, sessionId: string, - additionalParams: Record = {} + additionalParams: Record = {} ): Promise { this.executionTimes = new Map(); let classifierResult: ClassifierResult;