- Newest
- Most votes
- Most comments
Hello.
In case of "RetrieveAndGenerate" API, "sessionId" is included in the response.
The first time you execute the "RetrieveAndGenerate" API, make the request without including the "sessionId" From the second time onward, include the "sessionId" received in the response as a parameter in your request, allowing you to continue the session for subsequent responses.
https://docs.aws.amazon.com/bedrock/latest/APIReference/API_agent-runtime_RetrieveAndGenerate.html#API_agent-runtime_RetrieveAndGenerate_ResponseSyntax
For "invoke_agent", please reuse any string.
In other words, as long as the ID is unique, there is no problem.
https://docs.aws.amazon.com/bedrock/latest/APIReference/API_agent-runtime_InvokeAgent.html
https://boto3.amazonaws.com/v1/documentation/api/latest/reference/services/bedrock-agent-runtime/client/invoke_agent.html
In the case of "invoke_agent", I think the code from the blog below will be helpful.
In the blog code below, "session_id" is created on line 86 of the code.
https://community.aws/content/2g8NsQl8CvJhxQ0635HKkg6hMga/agents-for-amazon-bedrock-handling-return-of-control-in-code
session_id = ''.join(random.choices(string.ascii_uppercase + string.digits, k=SESSION_ID_LENGTH))
Relevant content
- asked 4 months ago
- asked 6 months ago
- asked a year ago
- AWS OFFICIALUpdated 2 years ago
- AWS OFFICIALUpdated 7 months ago
- AWS OFFICIALUpdated 3 years ago
- AWS OFFICIALUpdated a year ago