modelscope / agentscope

Start building LLM-empowered multi-agent applications in an easier way.

Home Page:https://modelscope.github.io/agentscope/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

How to access the memory of a RPC agent?

cwingho opened this issue · comments

I am trying access the memory of a distributed agent, but it consistently results in an empty list. How to resolve this problem? Thanks.

Example:

assistant = DialogAgent(name='assistant', sys_prompt="You are a helpful assistant.", model_config_name='llama3').to_dist()
msg = assistant(Msg(name='user', role='user', content="hi"))
print(assistant.memory.get_memory())

# print result: []

Currently, getting the memory of distributed agents is not supported.
After using to_dist, the agent is transferred to other processes, and only a proxy (assistant in your example) is left locally, which is empty and doesn't have a memory field. It will only forward the call method (assistant(x) in your example) to the original agent.

If you really want to get the memory of the distributed agent, you can check your local log dir in ./runs/{runtime id}. All messages in your application are saved in the log.

Currently, getting the memory of distributed agents is not supported. After using to_dist, the agent is transferred to other processes, and only a proxy (assistant in your example) is left locally, which is empty and doesn't have a memory field. It will only forward the call method (assistant(x) in your example) to the original agent.

If you really want to get the memory of the distributed agent, you can check your local log dir in ./runs/{runtime id}. All messages in your application are saved in the log.

Got it. Thanks