nat.agent.auto_memory_wrapper.register#
Attributes#
Classes#
Wraps any NAT agent to provide automatic memory capture and retrieval. |
Functions#
|
Build the auto-memory agent that wraps another agent. |
Module Contents#
- logger#
- class AutoMemoryAgentConfig(/, **data: Any)#
Bases:
nat.data_models.agent.AgentBaseConfigWraps any NAT agent to provide automatic memory capture and retrieval.
This agent automatically captures user messages, retrieves relevant context, and stores agent responses without requiring the LLM to invoke memory tools.
Use this when: - You want guaranteed memory capture (not dependent on LLM tool calling) - You need consistent memory operations across all interactions - Your memory backend (Zep, Mem0) is designed for automatic memory management
Use tool-based memory when: - You want the LLM to decide when to access memory - Memory operations should be selective based on context
Example:
functions: my_react_agent: _type: react_agent llm_name: nim_llm tool_names: [calculator, web_search] memory: zep_memory: _type: nat.plugins.zep_cloud/zep_memory workflow: _type: auto_memory_agent inner_agent_name: my_react_agent memory_name: zep_memory llm_name: nim_llm verbose: true
Multi-tenant User Isolation:
User ID is automatically extracted from runtime context (user_manager.get_id()) for proper multi-tenant memory isolation. Set user_manager via SessionManager.session() in production. Defaults to “default_user” for testing/development. See README.md for deployment examples.
Create a new model by parsing and validating input data from keyword arguments.
Raises [
ValidationError][pydantic_core.ValidationError] if the input data cannot be validated to form a valid model.selfis explicitly positional-only to allowselfas a field name.- memory_name: nat.data_models.component_ref.MemoryRef = None#
- inner_agent_name: nat.data_models.component_ref.FunctionRef = None#
- async auto_memory_agent(
- config: AutoMemoryAgentConfig,
- builder: nat.builder.builder.Builder,
Build the auto-memory agent that wraps another agent.
The inner agent is retrieved as a Function that receives a ChatRequest with multiple messages (including system messages with memory context). It manages its own internal state (ReActGraphState, etc.) and the wrapper never manipulates that state.