-
Notifications
You must be signed in to change notification settings - Fork 634
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, I'm currently implementing a chatbot to help our customers execute actions, and I've setup a test agent in AWS with a single action (defined in a group action) that is triggered when the customer asks to open a ticket.
This action is defined with the option return of control, which means I should get the payload so I can handle the action the user is trying to achieve.
Though I couldn't find any documentation that is providing the ability to do that, except in Python where the SDK provides a field in the InvokeAgent command response.
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
v20.15.0
Reproduction Steps
import { InvokeAgentCommand } from '@aws-sdk/client-bedrock-agent-runtime';
import { getClient } from '../client';
import { AGENT_CONFIG } from '../config';
export const askAgent = async (prompt: string, sessionId: string) => {
const client = getClient();
const command = new InvokeAgentCommand({
agentId: AGENT_CONFIG.agentId,
agentAliasId: AGENT_CONFIG.agentAlias,
sessionId: sessionId + '-bedrock',
inputText: prompt
});
try {
let completion = '';
const response = await client.send(command);
// ? There is no field in the response that provide the payload of the action that is triggered
for await (const chunkEvent of response.completion) {
const chunk = chunkEvent.chunk;
console.log(chunk);
const decodedResponse = new TextDecoder('utf-8').decode(chunk.bytes);
completion += decodedResponse;
}
return { sessionId: sessionId, completion };
} catch (err) {
console.error(err);
}
};
Observed Behavior
There is no field in the response that provide the payload of the action that is triggered
Response type is :
export interface InvokeAgentResponse {
/**
* <p>The agent's response to the user prompt.</p>
* @public
*/
completion: AsyncIterable<ResponseStream> | undefined;
/**
* <p>The MIME type of the input data in the request. The default value is <code>application/json</code>.</p>
* @public
*/
contentType: string | undefined;
/**
* <p>The unique identifier of the session with the agent.</p>
* @public
*/
sessionId: string | undefined;
/**
* <p>The unique identifier of the agent memory.</p>
* @public
*/
memoryId?: string;
}
Expected Behavior
We should have a nullable returnControl field like the python library does
Possible Solution
No response
Additional Information/Context
No response