Skip to content

What would be an approach to implement basic memory, and have the agent act differently based on that memory? #2955

@gkpo

Description

@gkpo

Question

I have an agent with several tools and I want it to have basic memory - stored persistently (e.g., in a database) - so it can decide whether to call tools based on stored values.

For example, the memory might contain key - value pairs like:

userId: 543

userName: John

bookingNumber: 36dbsb-jd63dh-77fghds-abxhdg64-cbsj745js

I want the agent to make decisions based on this stored state. From what I’ve read, the typical approach is to use a dynamic master prompt that changes according to the memory object.

For example:

"You are a helpful assistant. If the username is not defined, ask for it and then store it using the store_username tool. The current user name is ---."

However, I don’t like this method because it relies on the agent holding mutable data in the prompt, which could be corrupted or altered during execution. For instance, I think the booking number is more error-prone than the user ID.

Does my goal make sense? Any ideas or advice would be appreciated.

Additional Context

No response

Metadata

Metadata

Assignees

Labels

StalequestionFurther information is requested

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions