-
Notifications
You must be signed in to change notification settings - Fork 633
Description
Checkboxes for prior research
- I've gone through Developer Guide and API reference
- I've checked AWS Forums and StackOverflow.
- I've searched for previous similar issues and didn't find any solution.
Describe the bug
Hi guys,
I have a lambda function chat_ask_bot_fnc
that runs InvokeAgentCommand
(as for the example code from docs https://github.com/awsdocs/aws-doc-sdk-examples/blob/main/javascriptv3/example_code/bedrock-agent-runtime/actions/invoke-agent.js):
....
const command = new InvokeAgentCommand({
agentId,
agentAliasId,
sessionId,
inputText: prompt,
});
const response = await client.send(command);
...
The agent is configured to invoke the action-group/lambda query-pm-values-fnc
(to get data from dynamo):
I see the agent response in logs from lambda chat_ask_bot_fnc
returned by await client.send(command)
:
>> Agent response:
{
'$metadata': {
httpStatusCode: 200,
requestId: '761e6612-8325-41fc-9a98-1bb584121d32',
extendedRequestId: undefined,
cfId: undefined,
attempts: 1,
totalRetryDelay: 0
},
contentType: 'application/json',
sessionId: '12345',
completion: SmithyMessageDecoderStream {
options: {
messageStream: [MessageDecoderStream],
deserializer: [AsyncFunction (anonymous)]
}
}
}
... and the agent response.completion
"I attempted to retrieve the latest pollution data but was unable to due to an error with the function call format"
So looks like the agent called the query-pm-values-fnc
as required, but I don't have any invocation log stream for that function. So to me the Agent actually did not invoke the action/lambda.
Also, when I test the agent from AWS Console the test goes well. The agent invokes the query-pm-values-fnc
and returns the answer with the values from the query.
My understanding of the issue is that there is somethings wrong with the InvokeAgentCommand
execution, since the agent thinks he has invoked the action/lambda, while it did not.
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
nodejs 20
Reproduction Steps
Included above...
Observed Behavior
Agent response.completion
"I attempted to retrieve the latest pollution data but was unable to due to an error with the function call format".
Registered action/lambda is actually not called.
Expected Behavior
Agent response.completion
contains data from the result of the invoked lambda.
Lambda should be invoked.
Possible Solution
No response
Additional Information/Context
No response