Skip to content

Bug: AgentCoreMemoryStore _handle_put not using op.key #708

Description

@ltoniazzi

Error

I cannot retrieve something that I store running this basic example:

from langgraph_checkpoint_aws import AgentCoreMemoryStore
from langchain_core.messages import HumanMessage

MEMORY_ID = "a-memory-id"
ACTOR_ID = "a-actor-id"
THREAD_ID = "a-thread-id"
REGION = "us-west-1"

store = AgentCoreMemoryStore(memory_id=MEMORY_ID, region_name=REGION)

namespace = (ACTOR_ID, THREAD_ID)
key = "mem-" + "1"*40
# Put
store.put(namespace, key, {"message": HumanMessage(content="User preference")})     
# Get
fetched_message = store.get(namespace, key)

assert fetched_message, "No message found!"  # This gets raised

Bug here?

It seems to me that there might be an issue here as events are created as:

self.client.create_event(
            memoryId=self.memory_id,
            actorId=actor_id,
            sessionId=session_id,
            eventTimestamp=datetime.now(timezone.utc),
            payload=conversational_payloads,
        )
        logger.debug(f"Created event for message in namespace {op.namespace}")

where actor_id, session_id = op.namespace.

But op.key does not seem to be passed in any way to self.client.create_event.

Then, store.get, tries to do:

response = self.client.get_memory_record(
                memoryId=self.memory_id, memoryRecordId=op.key
            )

But op.key seem to have never being passed.

(Also event and memory record seem different storage locations from the aws docs)

Am I getting confused? Or if it's a bug I can help fix it, let me know 😃

Versions

langgraph-checkpoint-aws = 0.2.0

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions