Skip to content

more precise docs on memory #58

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
xpluscal opened this issue Jan 10, 2025 · 4 comments
Open

more precise docs on memory #58

xpluscal opened this issue Jan 10, 2025 · 4 comments
Labels
documentation Improvements or additions to documentation

Comments

@xpluscal
Copy link

Memory is great, its unclear however how messages get added.

in most of the examples only the initial message is added, not any subsequent runs - is this automatic?
how would you handle lets say a loop where one agent does a thing, the second evaluates and then passes the result to memory for the first agent to do again.

@KennyVaneetvelde
Copy link
Member

Yes new messages are automatically added to the memory.

I agree we could use some better docs on that, for now I'd advise to have a look in the source file of the memory, there is an elaborate mainguard that, if you run it, demos everything memory can do...

how would you handle lets say a loop where one agent does a thing, the second evaluates and then passes the result to memory for the first agent to do again.

I would just do something like:

agent_one.memory.add_message("system", OUTPUT OF AGENT TWO)
OR
agent_one.memory.add_message("user", OUTPUT OF AGENT TWO)

depending on what is allowed by your LLM provider/client (some don't allow system messages past the first message, for example)

I will leave this issue open for now as it pertains to improving the docs

@KennyVaneetvelde KennyVaneetvelde added the documentation Improvements or additions to documentation label Jan 12, 2025
@jonchun
Copy link
Contributor

jonchun commented Jan 28, 2025

@KennyVaneetvelde - I was going to open a new issue but this one is related enough that we may be able to address it here. When I was poking through AgentMemory I didn't see any place where the turn gets reset. I didn't see it in the BaseAgent either. My understanding is that a "turn" is generally a single exchange User -> Assistant. Is that the same definition atomic-agents wants to go with or is a "turn" equivalent to something closer to a "session"?

@cmardiros
Copy link

I'd be interested in knowing this too. My understanding of turn is same as @jonchun

@KennyVaneetvelde
Copy link
Member

Wow I am so so sorry for missing this question

So, the .run() method in an agent can be used in two ways. Either you have an input parameter, or you don't. If you have an input parameter, this is a new user message, and a new user message is a new interaction, so a new turn.

If for some reason you do something more (semi or fully) autonomous, like (pseudocode)

output = agent.run(input)
while (output.some_condition):
   output = agent.run()
   if not (output.some_condition):
      break

Then that means that as long as you don't exit that while loop and do another .run() with some input, that is still one turn, but now that one turn has a user message followed by maybe the agent executing a tool, contemplating, executing another tool, ...

Just visualize it as if it is a chat window, really, and every time you type its a turn

Anyways, came here to say this issue and #115 should be picked up together

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
documentation Improvements or additions to documentation
Projects
None yet
Development

No branches or pull requests

4 participants