tooluniverse.memory_manager 模块

多代理系统的内存管理器 管理基于会话的多代理工作流内存

class tooluniverse.memory_manager.MemoryManager[源代码]

基类:object

Manages session-based memory for multi-agent systems.

__init__(max_sessions=1000, session_timeout=3600)[源代码]
create_session(user_id=None, session_name=None)[源代码]

Create a new session and return its ID.

get_session(session_id)[源代码]

Retrieve session data by ID, updating last-accessed timestamp.

update_session_context(session_id, updates)[源代码]

Update the context dictionary for an existing session.

add_agent_result(session_id, agent_name, result, phase=None)[源代码]

Record an agent execution result in the session history.

get_context_for_agent(session_id, agent_name)[源代码]

Build a JSON context string suitable for passing to an agent.

set_current_phase(session_id, phase)[源代码]

Set the current execution phase for a session.

get_session_summary(session_id)[源代码]

Return a summary dictionary for the given session.

list_user_sessions(user_id)[源代码]

List all sessions for a given user, sorted by last access time.

close_session(session_id)[源代码]

Mark a session as closed.