awslabs / multi-agent-orchestrator

Flexible and powerful framework for managing multiple AI agents and handling complex conversations
https://awslabs.github.io/multi-agent-orchestrator/
Apache License 2.0
147 stars 25 forks source link

Feature request: AWS Lambda-Compatible Python Version of Multi-Agent Orchestrator #27

Closed valentin-dirken closed 1 month ago

valentin-dirken commented 1 month ago

Use case

I am working on integrating the Multi-Agent Orchestrator into a serverless architecture using AWS Lambda. My goal is to leverage AWS Lambda's scalability and cost-efficiency while utilizing the orchestrator's powerful multi-agent capabilities. However, deploying and managing the orchestrator within the AWS Lambda environment presents challenges, particularly with handling asynchronous operations and adapting to Lambda’s execution model.

Solution/User Experience

I would like to request a version of the orchestrator which can be deployed as a Lambda function.

Alternative solutions

No response

cornelcroi commented 1 month ago

Hi,

You can use the framework anywhere, in a Lambda Function included. There is a demo app included in the repository where the framework is used in a Lambda function. Have a look at the code here https://github.com/awslabs/multi-agent-orchestrator/blob/main/examples/chat-demo-app/lambda/multi-agent/index.ts.

The framework does not need anything special to be done in order to work inside a lambda. The library is available in python also , you can use it in your Lambda Function like any other library. Have you tried to create your function using the library and had any issues?

cornelcroi commented 1 month ago

I just made some changes to the documentation and now there is a section on how to use it inside a Lambda Function in python https://awslabs.github.io/multi-agent-orchestrator/deployment/aws-lambda-py/

Check it out and let me know if it helps.

valentin-dirken commented 1 month ago

Hi, Thank you ! I'm checking the code.

I have an error :

{
  "errorMessage": "Unable to import module 'lambda_function': No module named 'pydantic_core._pydantic_core'",
  "errorType": "Runtime.ImportModuleError",
  "requestId": "",
  "stackTrace": []
}

Lambda requires packages built for a specific architecture. Many packages have distributions for multiple architectures (see available distributions for pydantic-core). By default, pip installs the distribution suitable for the machine where you are running it on, which is not necessary the same architecture as your Lambda. But you can force pip to install packages for the architecture you want. If your Lambda uses x86_64, then you should select platform manylinux2014_x86_64:

https://github.com/pydantic/pydantic/issues/6557 https://docs.pydantic.dev/latest/integrations/aws_lambda/#troubleshooting

In the meantime :

cornelcroi commented 1 month ago

Thank you for letting me know. The documentation about using the framework inside a lambda function is mainly to show how the framework can be imported and used. Regarding the errors on the Lambda function itself you should check the official documentation. I've updated the documentation to highlight this point.