

# amazon-opensearch-memory skill

`amazon-opensearch-memory` is a skill in the Agent Toolkit for Amazon that helps your AI coding agent integrate an application with Amazon OpenSearch Memory. With the skill, the agent can create a space, write conversation turns as events, and search the memories that OpenSearch Memory extracts from them. A skill is a curated package of instructions and reference material that helps an agent complete a task correctly. The agent loads the skill when your request names OpenSearch Memory, an OpenSearch Memory space, or the `aws opensearchmemory` commands.

For how the service works, see [What is Amazon OpenSearch Memory?](memory.md).

## Capabilities
<a name="opensearch-memory-skill-capabilities"></a>

The skill covers the following tasks.

### Spaces and memory strategies
<a name="opensearch-memory-skill-spaces"></a>

Create a space, add or change its memory strategies (`SEMANTIC`, `SUMMARY`, and `CUSTOM`), set event and memory retention, and delete a space.

```
Create an OpenSearch Memory space for my agent that extracts user facts and session summaries
```

### Events and memories
<a name="opensearch-memory-skill-events"></a>

Write conversation turns as events, read events back, write or update memories directly, and delete an end user's data.

```
Write this conversation turn for user-42 to my OpenSearch Memory space
```

### Search
<a name="opensearch-memory-skill-search"></a>

Search or list memories, build a search query, and filter results by time or metadata.

```
Search my OpenSearch Memory space for what user-42 said about where they live
```

### Access control and encryption
<a name="opensearch-memory-skill-security-tasks"></a>

Write IAM policies, isolate end users from each other, and use a customer managed Amazon KMS key for a space.

```
What IAM policy lets a read-only agent search memories in one OpenSearch Memory space but not write to it?
```

### Troubleshooting
<a name="opensearch-memory-skill-troubleshooting"></a>

Diagnose errors such as `ResourceNotFoundException` after a space reports `ACTIVE`, `ConflictException` while a space is `UPDATING`, or `ValidationException` on a search query, and find out why memories don't appear in search results.

```
I wrote events to my OpenSearch Memory space, but searching memories returns nothing
```

## How the agent gets the skill
<a name="opensearch-memory-skill-delivery"></a>

The skill is delivered through the Agent Toolkit for Amazon. You have two options:
+ **Discover it at runtime through the Amazon MCP Server.** With the Amazon MCP Server configured (see [Set up the Amazon MCP Server](aws-mcp-server.md)), your agent finds the skill on demand using the server's `search_documentation` tool and loads it with `retrieve_skill` – no local install required.
+ **Install it with the Amazon CLI.** The following command installs the skill to the AI coding agents that the Agent Toolkit for Amazon detects on your system. This command requires Amazon CLI version 2.35.0 or later. For more information, see [Amazon CLI](https://docs.amazonaws.cn/agent-toolkit/latest/userguide/aws-cli.html) in the Agent Toolkit for Amazon documentation.

  ```bash
  aws agent-toolkit add-skill --skill-name amazon-opensearch-memory
  ```

The source of the skill is in the [Agent Toolkit for Amazon repository](https://github.com/aws/agent-toolkit-for-aws/tree/main/skills/specialized-skills/analytics-skills/amazon-opensearch-memory) on GitHub.

## Using the skill with and without the Amazon MCP Server
<a name="opensearch-memory-skill-with-without-mcp"></a>

The skill is designed to run with the Amazon MCP Server, which provides authenticated API access and sandboxed script execution. Where the Amazon MCP Server is available, the agent uses its `run_script` tool to run OpenSearch Memory operations. For setup, see [Set up the Amazon MCP Server](aws-mcp-server.md).

The skill also works without the Amazon MCP Server. Every operation in the skill runs with the Amazon CLI alone (for example, `aws opensearchmemory create-space` or `aws opensearchmemory search-memories`). The skill includes instructions that work with both approaches.

## Prerequisites
<a name="opensearch-memory-skill-prerequisites"></a>
+ An AI coding agent that supports the Agent Toolkit for Amazon (such as Claude Code or Codex).
+ Amazon credentials configured with permission for the OpenSearch Memory operations you intend to run. See [Identity and Access Management for Amazon OpenSearch Memory](security-iam-memory.md).
+ An Amazon Web Services Region where OpenSearch Memory is available. See [Supported Amazon Web Services Regions](memory-how-it-works.md#memory-regions).
+ To run the skill without the Amazon MCP Server, Amazon CLI version 2.40.4 or later, the first version that includes the `aws opensearchmemory` commands.
+ For the recommended setup, the Amazon MCP Server. See [Set up the Amazon MCP Server](aws-mcp-server.md).

## Security considerations
<a name="opensearch-memory-skill-security"></a>

When the agent runs OpenSearch Memory operations, it acts with the credentials you provide. Anything those credentials are authorized to do, the agent can trigger on your behalf.
+ Use least-privilege credentials. Grant only the `osm:` actions the agent needs, scoped to specific space ARNs. For a read-only agent, grant only read actions such as `osm:SearchMemories`, `osm:GetMemory`, and `osm:ListMemories`.
+ Isolate end users. Use one actor ID per end user, and restrict principals with the `osm:actorId` condition key. See [Identity and Access Management for Amazon OpenSearch Memory](security-iam-memory.md).
+ Require explicit confirmation before the agent deletes a space, a memory, or an event. Deletions are permanent.
+ Don't put secrets or credentials in events, memories, or metadata.
+ Review tool output. MCP tool responses, including the events and memories the agent reads, are returned to the language model as context. Avoid running operations against spaces that contain sensitive data you don't want exposed to your model provider.