Skip to content

InvokeAgentCommand timeout (Bedrock) #7218

@abarone-btf

Description

@abarone-btf

Checkboxes for prior research

Describe the bug

Hi all, I'm invoking a custom agent created in Bedrock using the InvokeAgentCommand. However, when a model call (in this case, Claude Sonnet 4) takes longer than 60 seconds, it fails with an InternalServerException. The exception details are all undefined, so I'm unsure whether this is due to a timeout quota on the invoke command (which isn’t mentioned in the documentation) or something else.

InternalServerException: Internal Server Exception
    at de_InternalServerExceptionRes (file:///var/task/bundle.mjs:1118501:21)
    at de_InternalServerException_event (file:///var/task/bundle.mjs:1118686:10)
    at process.processTicksAndRejections (node:internal/process/task_queues:105:5)
    at async file:///var/task/bundle.mjs:1118591:34
    at async Object.deserializer (file:///var/task/bundle.mjs:1117256:37)
    at async SmithyMessageDecoderStream.asyncIterator (file:///var/task/bundle.mjs:1117151:28)
    at async BedrockClientAgentRuntimeService.invokeCallback (file:///var/task/bundle.mjs:1119921:24)
    at async DatadogBedrockAgentService.invokeWrapper (file:///var/task/bundle.mjs:1120387:20)
    at async BedrockClientAgentRuntimeService.invokeAgent (file:///var/task/bundle.mjs:1119882:53)
    at async BedrockAgentsServiceImpl.invokeAgent (file:///var/task/bundle.mjs:1132609:34) {
  '$fault': 'server',
  '$metadata': {
    httpStatusCode: undefined,
    requestId: undefined,
    extendedRequestId: undefined,
    cfId: undefined
  },
  reason: undefined

My trace call is:

{
    "level": "INFO",
    "time": "2025-07-21T19:13:52.867Z",
    "pid": 5,
    "hostname": "169.254.51.131",
    "callbackWaitsForEmptyEventLoop": true,
    "functionVersion": "$LATEST",
    "functionName": "dev-lambda",
    "memoryLimitInMB": "2048",
    "logGroupName": "/aws/lambda/dev-lambda",
    "logStreamName": "2025/07/21/dev-lambda[$LATEST]traceid",
    "invokedFunctionArn": "arn:aws:lambda:us-east-1:ACCOUNT:function:dev-lambda",
    "awsRequestId": "e74a12e1-14a4-5570-8c2c-7219857bdd23",
    "service": "dev-btf-main-agents",
    "orchestrationTrace": {
        "modelInvocationInput": {
            "foundationModel": "anthropic.claude-sonnet-4-20250514-v1:0",
            "inferenceConfiguration": {
                "stopSequences": [
                    "</answer>"
                ],
                "temperature": 1
            },
            "text": "{\"system\":"..."}",
            "traceId": "c010b976-465c-4568-a587-a82e61bed5f5-1",
            "type": "ORCHESTRATION"
        }
    }
}

Do you know what may be happening here?

Thanks!

Regression Issue

  • Select this option if this issue appears to be a regression.

SDK version number

@aws-sdk/[email protected]

Which JavaScript Runtime is this issue in?

Node.js

Details of the browser/Node.js/ReactNative version

Node 22

Reproduction Steps

Custom agente that calls a model that takes longer than 60 seconds

Observed Behavior

The agent throws an InternalServerException

Expected Behavior

To finish the invoke agent call without problem

Possible Solution

No response

Additional Information/Context

No response

Metadata

Metadata

Assignees

Labels

bugThis issue is a bug.p2This is a standard priority issueservice-apiThis issue is due to a problem in a service API, not the SDK implementation.

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions