> ## Documentation Index
> Fetch the complete documentation index at: https://praison.ai/docs/llms.txt
> Use this file to discover all available pages before exploring further.

# Memory Adapter • Rust AI Agent SDK

> MemoryAdapter: Trait for memory adapters

# MemoryAdapter

> Defined in the [**memory**](../modules/memory) module.

<Badge color="orange">Rust AI Agent SDK</Badge>

Trait for memory adapters

## Methods

### `store_short_term`

```rust theme={"theme":{"light":"vitesse-light","dark":"vitesse-dark"}}
async fn store_short_term(&mut self, message: Message) -> Result<()>
```

Store a message in short-term memory

**Parameters:**

| Name      | Type      |
| --------- | --------- |
| `message` | `Message` |

### `search_short_term`

```rust theme={"theme":{"light":"vitesse-light","dark":"vitesse-dark"}}
async fn search_short_term(&self, query: &str, limit: usize) -> Result<Vec<Message>>
```

Search short-term memory

**Parameters:**

| Name    | Type    |
| ------- | ------- |
| `query` | `&str`  |
| `limit` | `usize` |

### `get_short_term`

```rust theme={"theme":{"light":"vitesse-light","dark":"vitesse-dark"}}
async fn get_short_term(&self) -> Result<Vec<Message>>
```

Get all short-term messages

### `clear_short_term`

```rust theme={"theme":{"light":"vitesse-light","dark":"vitesse-dark"}}
async fn clear_short_term(&mut self) -> Result<()>
```

Clear short-term memory

### `store_long_term`

```rust theme={"theme":{"light":"vitesse-light","dark":"vitesse-dark"}}
async fn store_long_term(
        &mut self,
        _text: &str,
        _metadata: Option<serde_json::Value>,
    ) -> Result<()>
```

Store in long-term memory (optional)

**Parameters:**

| Name        | Type                              |
| ----------- | --------------------------------- |
| `_text`     | `&str`                            |
| `_metadata` | `Option&lt;serde_json::Value&gt;` |

## Source

<Card title="View on GitHub" icon="github" href="https://github.com/MervinPraison/PraisonAI/blob/main/src/praisonai-rust/praisonai/src/memory/mod.rs">
  `praisonai/src/memory/mod.rs` at line 0
</Card>

***

## Related Documentation

<CardGroup cols={2}>
  <Card title="Rust Memory" icon="database" href="/docs/rust/memory" />

  <Card title="Rust Sessions" icon="clock" href="/docs/rust/sessions" />

  <Card title="Rust Knowledge" icon="book" href="/docs/rust/knowledge" />
</CardGroup>
