aws-powertools / powertools-lambda-python

A developer toolkit to implement Serverless best practices and increase developer velocity.
https://docs.powertools.aws.dev/lambda/python/latest/
MIT No Attribution
2.87k stars 394 forks source link

Feature request: Add support for the Bedrock Agent event and response formats #3261

Closed rubenfonseca closed 12 months ago

rubenfonseca commented 1 year ago

Use case

As a user, I want to create a Bedrock Agent using Lambda. I will receive a new payload type specific for this integration, and Bedrock expects my Lambda function to output a certain format.

https://docs.aws.amazon.com/bedrock/latest/userguide/agents-create.html

NOTE: As of October 26, 2023, the payload structure of the Lambda input event and response format is changing.

Current payload

Input

{
    "messageVersion": "1.0",
    "agent": {
        "name": "string",
        "id": "string",
        "alias": "string",
        "version": "string"
    },
    "inputText": "string",
    "sessionId": "string",
    "actionGroup": "string",
    "apiPath": "string",
    "httpMethod": "string",
    "parameters": [
        {
            "name": "string",
            "type": "string",
            "value": "string"
        },
    ...
    ],
    "requestBody": {
        "content": {
            "<content_type>": {
                "properties": [
                   {
                       "name": "string",
                       "type": "string",
                       "value": "string"
                    },
                            ...
                ]
            }
        }
    },
    "sessionAttributes": {
        "string": "string",
    }
}

Output

{
    "messageVersion": "1.0",
    "response": {
        "actionGroup": "string",
        "apiPath": "string",
        "httpMethod": "string",
        "httpStatusCode": number,
        "responseBody": {
            "<contentType>": {
                "body": "string" 
            }
        }
    }
}

Solution/User Experience

Add event source data class and parser support for the input and output events.

Alternative solutions

No response

Acknowledgment

github-actions[bot] commented 12 months ago

⚠️COMMENT VISIBILITY WARNING⚠️

This issue is now closed. Please be mindful that future comments are hard for our team to see.

If you need more assistance, please either tag a team member or open a new issue that references this one.

If you wish to keep having a conversation with other community members under this issue feel free to do so.

github-actions[bot] commented 11 months ago

This is now released under 2.26.1 version!