Skip to main content

Quickstart: REST API

Learn how to build an AI agent with persistent memory using Memanto’s REST API.

What You’ll Build

A simple customer support agent that:
  • Remembers customer preferences
  • Recalls relevant context
  • Uses memories to provide personalized responses

Prerequisites

  • Memanto server running (memanto serve) with MOORCHEH_API_KEY configured in its environment
  • Python 3.10+
  • httpx library: pip install httpx
Memanto authenticates with Moorcheh on the server using the configured MOORCHEH_API_KEY. API clients do not send an Authorization header — they only send X-Session-Token for memory operations.

Architecture

Step 1: Start Memanto Server

In a terminal:
Expected output:

Step 1.5: Create the Agent Once

Create the agent ID used by the example before running the script:

Step 2: Create the Agent

Create customer_agent.py:

Step 3: Use Your Agent

Create main.py:

Step 4: Run Your Agent

Expected output:

Step 5: Use Memory Types Effectively

Different memory types help organize information:

Step 6: Extend Your Agent

Batch Store Memories

Store multiple memories at once:

Temporal Queries

Recall memories from specific time periods:

Recall the Latest Memories

/recall/recent returns memories sorted newest-first (no query needed):

Session Renewal

Sessions are auto-renewed on memory requests when they’re near expiry. To start a fresh session explicitly, call /activate again — the new token replaces the old one. There is no separate /extend endpoint.

Complete Example

For a production-ready example, see the API Reference with all endpoints documented.

Next Steps


Congratulations! You’ve built your first memory-enabled agent. Now explore advanced features!