How to retain conversation history as context for Bedrock agent after current session expires

0

I want to retain conversation history as context for my bedrock agent even after the current session has expired. Is there a way to feed the agent with the conversation history using the bedrock agent. We are calling bedrock agent using boto3 bedrock runtime.

2개 답변
3

Hello,

To retain the conversation context of an Amazon Bedrock agent after the session expires, you can use session state attributes. There are two types of session state attributes:

  • SessionAttributes
  • PromtSessionAttributes

Refer the below link for more info https://docs.aws.amazon.com/bedrock/latest/userguide/agents-session-state.html

Additionally, you can view the conversation history by enabling tracing for the InvokeAgent call. The trace tracks the agent's actions, queries and observations at each step, including context passed between prompts.****

profile picture
답변함 한 달 전
  • Hi, can you elaborate how I can get the conversation history using a session attribute and send it to Lambda function? In the documentation example the parameters are requested from user, while I just need a log of questions from users and generated answers.

0

Hi,

You may want to read this deck of this presentation of last re:Invent: Build a WebSocket API with conversation history for Amazon Bedrock

The deck is here: https://d1.awsstatic.com/events/Summits/reinvent2023/FWM311_Build-a-WebSocket-API-with-conversation-history-for-Amazon-Bedrock.pdf

Also, read in depth this blog post. It shows how to store conversations for agends in DynamoDB: https://aws.amazon.com/blogs/machine-learning/build-generative-ai-agents-with-amazon-bedrock-amazon-dynamodb-amazon-kendra-amazon-lex-and-langchain/

Best,

Didier

profile pictureAWS
전문가
답변함 한 달 전

로그인하지 않았습니다. 로그인해야 답변을 게시할 수 있습니다.

좋은 답변은 질문에 명확하게 답하고 건설적인 피드백을 제공하며 질문자의 전문적인 성장을 장려합니다.

질문 답변하기에 대한 가이드라인

관련 콘텐츠