Middleware for loading agent memory from AGENTS.md files.
Loads memory content from configured sources and injects into the system prompt.
Supports multiple sources that are combined together.
MemoryMiddleware(
self,
*,
backend: BACKEND_TYPES,
sources: list[str]
)| Name | Type | Description |
|---|---|---|
backend* | BACKEND_TYPES | Backend instance or factory function for file operations. |
sources* | list[str] | List of |
| Name | Type |
|---|---|
| backend | BACKEND_TYPES |
| sources | list[str] |
Load memory content before agent execution (synchronous).
Loads memory from all configured sources and stores in state. Only loads if not already present in state.
Load memory content before agent execution.
Loads memory from all configured sources and stores in state. Only loads if not already present in state.
Inject memory content into the system message.
Wrap model call to inject memory into system prompt.
Async wrap model call to inject memory into system prompt.