0

I have a Bedrock agent with an action group connected to a lambda, and defined with an API schema. Despite ensuring that my lambda response matches the schema from the documentation (https://docs.aws.amazon.com/bedrock/latest/userguide/agents-lambda.html#agents-lambda-response), I still see the following error when the agent attempts to call my endpoint:

ERROR DependencyFailedException: The server encountered an error processing the Lambda response. Check the Lambda response and retry the request

This is what the lambda returns:

{
 "messageVersion": "1.0",
 "response": {
 "actionGroup": "downstream-actions",
 "apiPath": "/hello",
 "httpMethod": "GET",
 "httpStatusCode": 200,
 "responseBody": {
 "application/json": {
 "body": "{\"message\":\"Hello, world!\"}"
 }
 }
 }
}

The lambda is Node. I have tried stringifying the entire object before returning it as well to the same result. Am I missing something?

Edit: including api schema:

{
 openapi: '3.0.0',
 info: {
 title: 'Downstream Action API',
 version: '1.0.0',
 description: 'API for invoking downstream actions',
 },
 paths: {
 '/hello': {
 get: {
 summary: 'Get a hello world message',
 description: 'Simple endpoint that returns a hello world message',
 operationId: 'getHello',
 responses: {
 '200': {
 description: 'Successful response',
 content: {
 'application/json': {
 schema: {
 type: 'object',
 properties: {
 message: {
 type: 'string',
 },
 },
 },
 },
 },
 },
 },
 },
 },
 },
}
asked Feb 5, 2025 at 17:37
2
  • hard to say without also seeing your API schema Commented Feb 9, 2025 at 4:44
  • @emmaray updated to include Commented Feb 10, 2025 at 18:52

2 Answers 2

0

If anyone stumbles upon this question, I got it to work by setting architecture: lambda.Architecture.ARM_64 on my agent-invoked lambda.

answered Feb 10, 2025 at 21:31
Sign up to request clarification or add additional context in comments.

Comments

0

The lambda function response should be in this format:

{
 messageVersion: event.messageVersion,
 response: {
 actionGroup: event.actionGroup,
 function: event.function,
 functionResponse: {
 responseBody: {
 "TEXT": { body: responseBody }
 }
 }
 }
}

P.S theresponseBody object should be a string so the agent can read it.

answered Apr 1, 2025 at 5:58

Comments

Your Answer

Draft saved
Draft discarded

Sign up or log in

Sign up using Google
Sign up using Email and Password

Post as a guest

Required, but never shown

Post as a guest

Required, but never shown

By clicking "Post Your Answer", you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.