ladderlore
  • 输入服务名称,例如 S3 或 IAM。

概念

Agent state and memory management

Keep short-term session state and long-term memory for agents, and respect the context window.

本课尚未翻译,暂以英文显示。

  • Short-term

    Kept in
    AgentCore events, or session attributes
    Lasts
    One session
  • Long-term

    Kept in
    AgentCore Memory strategies, or Agents memory
    Lasts
    Across sessions
  • Prompt attributes

    Kept in
    Agents Classic prompt session attributes
    Lasts
    One turn
  • Custom state

    Kept in
    DynamoDB or ElastiCache
    Lasts
    As long as you keep it
Four kinds of agent state.

1 / 2

  • Short-term

    Kept in
    AgentCore events, or session attributes
    Lasts
    One session
  • Long-term

    Kept in
    AgentCore Memory strategies, or Agents memory
    Lasts
    Across sessions
  • Prompt attributes

    Kept in
    Agents Classic prompt session attributes
    Lasts
    One turn

2 / 2

  • Custom state

    Kept in
    DynamoDB or ElastiCache
    Lasts
    As long as you keep it
Four kinds of agent state.
User
Agent
Short-term events
Long-term memory
  1. 1The user sends a turn.
  2. 2The agent reads recent events and writes the new turn as an event.
  3. 3Memory extracts facts, preferences and summaries in the background.
  4. 4A later session searches long-term memory.
Turns are stored as events, then distilled into long-term memory.

分步说明

  1. 1The user sends a turn.
  2. 2The agent reads recent events and writes the new turn as an event.
  3. 3Memory extracts facts, preferences and summaries in the background.
  4. 4A later session searches long-term memory.

是什么

An agent has no memory unless you give it some. Short-term state is the current conversation: the turns so far, tool results and values for this task. Long-term memory is what should outlive the session, such as a user preference or a summary of past help. Both compete for the model context window, because everything the agent sees must fit in it. Long histories get slow, costly and then cut off.

是什么

Amazon Bedrock AgentCore Memory is managed for both. Short-term memory stores each turn as an event in a session. Long-term memory extracts insights such as facts, preferences and summaries from conversations in the background, so a later session can search them. Bedrock Agents Classic has session attributes that last for one session, prompt session attributes that last for one turn, and optional memory that keeps summaries of past sessions for a retention period.

是什么

For custom state use your own store. Amazon DynamoDB gives durable key-value state with a time to live (TTL), such as an order being collected. Amazon ElastiCache gives very fast shared state, for example a cache of recent turns, but it is not durable unless you design it so. Manage the window by keeping recent turns, summarizing older ones and moving facts to long-term memory.

要记住

  • Short-term: this session. Long-term: across sessions.
  • AgentCore Memory: events for the short term, extracted facts, preferences and summaries for the long term.
  • Bedrock Agents Classic: session attributes (session), prompt session attributes (one turn), memory summaries.
  • DynamoDB for durable custom state with TTL. ElastiCache for fast shared state.

要记住

  • The context window is limited: trim, summarize, and store the rest.

考试中

  • “Remember a customer preference across separate conversations” points to long-term memory, such as AgentCore Memory.
  • “Pass a value to the agent for one turn only” points to prompt session attributes.
  • “Durable per-user state with automatic expiry” points to Amazon DynamoDB with TTL.
  • “Conversation too long for the model” points to summarizing and trimming history.