generated from amazon-archives/__template_Apache-2.0
-
Notifications
You must be signed in to change notification settings - Fork 616
Add comprehensive agentic memory API documentation for OpenSearch 3.3 #11169
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
Merged
Merged
Changes from 21 commits
Commits
Show all changes
30 commits
Select commit
Hold shift + click to select a range
b08069d
Add comprehensive agentic memory API documentation for OpenSearch 3.3
dhrubo-os b0144d7
Consolidate agentic memory APIs and update with real response examples
dhrubo-os 10fb3cc
Complete agentic memory API documentation with missing container APIs
dhrubo-os 5ec0870
Document default llm_result_path and LLM connector requirements
dhrubo-os 8a8ef96
Merge branch 'main' into main
dhrubo-os eb75f4e
Address ylwu-amzn review comments
dhrubo-os 014d9ba
Add agentic memory cluster setting
dhrubo-os 7c976f2
update path parameters
dhrubo-os 7428307
Add comprehensive agentic memory API documentation for OpenSearch 3.3
dhrubo-os ab7fd46
Consolidate agentic memory APIs and update with real response examples
dhrubo-os c5a4cc8
Complete agentic memory API documentation with missing container APIs
dhrubo-os ee90e24
Document default llm_result_path and LLM connector requirements
dhrubo-os e82965d
Address ylwu-amzn review comments
dhrubo-os 56a10a2
Add agentic memory cluster setting
dhrubo-os f4d4bbf
update path parameters
dhrubo-os 1340f34
addressed comments
dhrubo-os b18236c
addressed comments
dhrubo-os fdbd793
Merge upstream changes
kolchfa-aws 0a258d2
Resolve merge conflicts
kolchfa-aws 2e2ed16
Doc review part 2
kolchfa-aws f7d8364
Apply suggestions from code review
natebower 32d60a6
Doc review part 3
kolchfa-aws e09a08e
Update _ml-commons-plugin/api/agentic-memory-apis/create-memory-conta…
natebower 7775179
Apply suggestions from code review
natebower a097c34
Update _ml-commons-plugin/api/agentic-memory-apis/add-memory.md
natebower 3f6e899
Merge branch 'main' into main
kolchfa-aws 8ad80e2
Add execute tool API doc (#11214)
nathaliellenaa 5bec8d3
add create-session
dhrubo-os 51926fd
Review of create session
kolchfa-aws f9e8b86
Apply suggestion from @natebower
natebower File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,208 @@ | ||
--- | ||
layout: default | ||
title: Agentic memory | ||
parent: Agents and tools | ||
nav_order: 30 | ||
--- | ||
|
||
# Agentic memory | ||
**Introduced 3.3** | ||
{: .label .label-purple } | ||
|
||
Agentic memory enables AI agents to learn, remember, and reason over structured information across conversations. Unlike simple conversation memory that only stores message history, agentic memory provides persistent, intelligent storage that helps agents maintain context, learn user preferences, and improve their responses over time. | ||
|
||
Using agentic memory, you can build AI agents that can do the following: | ||
|
||
- Remember user preferences across multiple conversation sessions | ||
- Learn from past interactions to provide more personalized responses | ||
- Maintain conversation context beyond simple message history | ||
- Store and retrieve factual knowledge extracted from conversations | ||
- Track agent execution traces for debugging and analysis | ||
- Organize information across different users, sessions, or agent instances | ||
|
||
## Memory containers | ||
|
||
Agentic memory is organized into _memory containers_ that hold all memory types for a specific use case, such as a chatbot, research assistant, or customer service agent. | ||
|
||
Each container can be configured with the following components: | ||
|
||
- Text embedding models: For semantic search capabilities. | ||
- Large language models (LLMs): For inference and knowledge extraction. | ||
- [Memory processing strategies](#memory-processing-strategies): For automatic content organization. | ||
- [Namespaces](#namespaces): For organizing memories within containers. | ||
|
||
|
||
For example, to create a memory container with two strategies, send the following request: | ||
|
||
```json | ||
POST /_plugins/_ml/memory_containers/_create | ||
{ | ||
"name": "customer-service-agent", | ||
"description": "Memory container for customer service agent", | ||
"configuration": { | ||
"embedding_model_type": "TEXT_EMBEDDING", | ||
"embedding_model_id": "your-embedding-model-id", | ||
"llm_id": "your-llm-model-id", | ||
"strategies": [ | ||
{ | ||
"type": "USER_PREFERENCE", | ||
"namespace": ["user_id"] | ||
}, | ||
{ | ||
"type": "SUMMARY", | ||
"namespace": ["user_id", "session_id"] | ||
} | ||
] | ||
} | ||
} | ||
``` | ||
{% include copy-curl.html %} | ||
|
||
## Memory types | ||
|
||
Each memory container can store four distinct types of memory: | ||
|
||
- `sessions` -- Manages conversation sessions and their metadata. Each session represents a distinct interaction context between users and agents, containing session-specific information such as start time, participants, and session state. | ||
|
||
- `working` -- Stores active conversation data and structured information that agents use during ongoing interactions. This includes recent messages, current context, agent state, execution traces, and temporary data needed for immediate processing. | ||
|
||
- `long-term` -- Contains processed knowledge and facts extracted from conversations over time. When inference is enabled, LLMs extract key insights, user preferences, and important information from working memory and store them as persistent knowledge. | ||
|
||
- `history` -- Maintains an audit trail of all memory operations (add, update, delete) across the memory container. This provides a comprehensive log of how memories have evolved and changed over time. | ||
|
||
## Payload types | ||
|
||
When adding memories, you can specify different payload types: | ||
|
||
- `conversational` -- Stores conversational messages between users and assistants. | ||
- `data` -- Stores structured, non-conversational data such as agent state, checkpoints, or reference information. | ||
|
||
To add a conversation memory with inference, send the following request: | ||
|
||
```json | ||
POST /_plugins/_ml/memory_containers/<container_id>/memories | ||
{ | ||
"messages": [ | ||
{ | ||
"role": "user", | ||
"content": "I prefer email notifications over SMS" | ||
}, | ||
{ | ||
"role": "assistant", | ||
"content": "I've noted your preference for email notifications" | ||
} | ||
], | ||
"namespace": { | ||
"user_id": "user123", | ||
"session_id": "session456" | ||
}, | ||
"payload_type": "conversational", | ||
"infer": true | ||
} | ||
``` | ||
{% include copy-curl.html %} | ||
|
||
To add agent state data, send the following request: | ||
|
||
```json | ||
POST /_plugins/_ml/memory_containers/<container_id>/memories | ||
{ | ||
"structured_data": { | ||
"agent_state": "researching", | ||
"current_task": "analyze customer feedback", | ||
"progress": 0.75 | ||
}, | ||
"namespace": { | ||
"agent_id": "research-agent-1", | ||
"session_id": "session456" | ||
}, | ||
"payload_type": "data", | ||
"infer": false | ||
} | ||
``` | ||
{% include copy-curl.html %} | ||
|
||
## Inference mode | ||
|
||
You can control how OpenSearch processes memories using the `infer` parameter: | ||
|
||
- `false` (default) -- Stores raw messages and data in `working` memory without LLM processing. | ||
- `true` -- Uses the configured LLM to extract key information and knowledge from the content. | ||
|
||
## Memory processing strategies | ||
|
||
Memory containers can use the following _strategies_ to automatically process and organize memories: | ||
|
||
- `SEMANTIC` -- Groups related memories by meaning and content similarity. | ||
- `USER_PREFERENCE` -- Extracts and stores user preferences from conversations. | ||
- `SUMMARY` -- Creates condensed summaries of conversation content. | ||
|
||
Strategies are optional; you can create containers without them for simple storage needs. | ||
|
||
## Namespaces | ||
|
||
_Namespaces_ organize memories within containers by grouping them with identifiers like `user_id`, `session_id`, or `agent_id`. This allows you to separate memories for different users or conversation sessions. | ||
|
||
To search memories by namespace, send the following request: | ||
|
||
```json | ||
GET /_plugins/_ml/memory_containers/<container_id>/memories/long-term/_search | ||
{ | ||
"query": { | ||
"bool": { | ||
"must": [ | ||
{ | ||
"term": { | ||
"namespace.user_id": "user123" | ||
} | ||
} | ||
] | ||
} | ||
} | ||
} | ||
``` | ||
{% include copy-curl.html %} | ||
|
||
## Example use cases | ||
|
||
The following examples demonstrate how you can use agentic memory. | ||
|
||
### Personalized chatbot | ||
|
||
Create a memory container that learns user preferences over time: | ||
|
||
- Store conversations in `working` memory with inference enabled. | ||
- Extract user preferences into `long-term` memory using the `USER_PREFERENCE` strategy. | ||
- Use namespaces to separate different users' memories. | ||
|
||
### Research assistant agent | ||
|
||
Build an agent that accumulates knowledge from research sessions: | ||
|
||
- Store research queries and results in `working` memory. | ||
- Use the `SEMANTIC` strategy to group related research topics. | ||
- Maintain `history` to track how knowledge evolved over time. | ||
|
||
### Customer service agent | ||
|
||
Develop an agent that remembers customer interactions: | ||
|
||
- Store customer conversations with inference to extract key issues. | ||
- Use `SUMMARY` strategy to create concise interaction summaries. | ||
- Organize by customer ID using namespaces. | ||
|
||
## Getting started | ||
|
||
To implement agentic memory in your agents: | ||
|
||
1. **[Create a memory container]({{site.url}}{{site.baseurl}}/ml-commons-plugin/api/agentic-memory-apis/create-memory-container/)** with appropriate models and strategies. | ||
2. **[Add memories]({{site.url}}{{site.baseurl}}/ml-commons-plugin/api/agentic-memory-apis/add-memory/)** during agent interactions. | ||
3. **[Search and retrieve]({{site.url}}{{site.baseurl}}/ml-commons-plugin/api/agentic-memory-apis/search-memory/)** relevant memories to inform agent responses. | ||
4. **[Update memories]({{site.url}}{{site.baseurl}}/ml-commons-plugin/api/agentic-memory-apis/update-memory/)** as conversations evolve. | ||
|
||
For detailed API documentation, see [Agentic Memory APIs]({{site.url}}{{site.baseurl}}/ml-commons-plugin/api/agentic-memory-apis/). | ||
|
||
## Next steps | ||
|
||
- Learn about [agent types]({{site.url}}{{site.baseurl}}/ml-commons-plugin/agents-tools/agents/) and how to integrate agentic memory. | ||
- Explore [memory container configuration]({{site.url}}{{site.baseurl}}/ml-commons-plugin/api/agentic-memory-apis/create-memory-container/) options. | ||
- Review the complete [Agentic Memory API reference]({{site.url}}{{site.baseurl}}/ml-commons-plugin/api/agentic-memory-apis/). |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
For defining how memories are processed or extracted