-
Notifications
You must be signed in to change notification settings - Fork 485
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Amazon Bedrock Agent support #2007
Comments
@martinsafsten Good afternoon. Lambda input event from Amazon Bedrock specifies the structure of Lambda input event that is sent when an action group using a Lambda function is invoked. This appears to be a good candidate for event package for Bedrock (refer similar package https://github.com/aws/aws-lambda-dotnet/tree/master/Libraries/src/Amazon.Lambda.LexV2Events), which would implement custom POCO classes for input and response formats for Lambda function. Please review your request and confirm if this is the case. Thereafter, feel free to contribute PR to contribute the new events package Thanks, |
Hello Ashish! Thanks for looking into this. I have worked on it for a few days, and I have a fork with an implementation, which includes a new event package with the bedrock request and response, and added support in Amazon.Lambda.AspNetCoreServer and Amazon.Lambda.AspNetCoreServer.Hosting for a new LambdaEventSource that would simplify the setup. I think I worked out most of the hard parts with the actual conversion and serialization. Here is the commit: martinsafsten@ccadcef |
If you want to keep the AspNetCoreServer packages free of this Bedrock specific code, maybe a refactoring to a separate library |
I tried deploying a test lambda with the new code and used it in my test bedrock agent. Some tweaks required, which I updated in the commit above, but it looks good. Maybe a integration test is in order to validate and secure it? Here is a excerpt from the trace in the agent: "invocationInput": [
{
"actionGroupInvocationInput": {
"actionGroupName": "agda-assistant",
"apiPath": "/api/employees/search",
"executionType": "LAMBDA",
"parameters": [
{
"name": "term",
"type": "string",
"value": "John Smith"
}
],
"verb": "get"
},
"invocationType": "ACTION_GROUP",
"traceId": "b11e80a3-d835-4baa-8619-d3fb1828424d-0"
}
],
"observation": [
{
"actionGroupInvocationOutput": {
"text": "[{\"id\":1,\"name\":\"John Smith\",\"department\":\"Engineering\",\"position\":\"Senior Developer\",\"vacationDaysRemaining\":15,\"directReports\":[{\"id\":2,\"name\":\"Alice Johnson\",\"department\":\"Engineering\",\"position\":\"Developer\",\"vacationDaysRemaining\":12,\"directReports\":[]},{\"id\":3,\"name\":\"Bob Williams\",\"department\":\"Engineering\",\"position\":\"Developer\",\"vacationDaysRemaining\":10,\"directReports\":[]}]}]"
},
"traceId": "b11e80a3-d835-4baa-8619-d3fb1828424d-0",
"type": "ACTION_GROUP"
}
] |
Describe the feature
Add support for receiving JSON requests from a Amazon Bedrock Agent, with a Action Group configured with an OpenAPI specification. The JSON structures between the HttpApi/RestApi via API Gateway are incompatible with the current setup.
Use Case
Creating a .NET Core Web API that can be used by a Amazon Bedrock Agent. The API can generate the Swagger/OpenAPI specification that can be uploaded to the Agent as is
Proposed Solution
The general idea is to add a new EventSource specifically for Bedrock Agents, that translates that format into a AspNetCore request. It should make the setup as seamless as for HttpApi and RestApi for the end user.
The end result should look something like this:
builder.Services.AddAWSLambdaHosting(LambdaEventSource.BedrockAgentApi)
Other Information
I created a Repost question detailing the issue: https://repost.aws/questions/QUXj8PAYBRQiKqd5VRWHNQfQ/amazon-lambda-aspnetcoreserver-hosting-as-bedrock-agent-action-group-lambda
Acknowledgements
AWS .NET SDK and/or Package version used
latest
Targeted .NET Platform
.NET 6, .NET 8
Operating System and version
any
The text was updated successfully, but these errors were encountered: