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

# API Reference Overview

> Complete API reference for the Memproof memory control layer.

# API Reference

Memproof exposes a single entry point -- the `Memproof` class -- that wires together policy evaluation, risk assessment, event auditing, and adapter-backed storage behind a small async API.

```python theme={"theme":{"light":"github-light","dark":"github-dark-dimmed"}}
from memproof import Memproof

mp = Memproof(policy="./memproof.yaml")
```

All memory operations (`remember`, `get`, `update`, `forget`, `search`) flow through the same internal pipeline:

1. The request is validated and a scope/context is built.
2. A risk score is computed by the **RiskEngine**.
3. The **PolicyEngine** evaluates the configured rules and returns an allow/deny/quarantine/require-approval decision.
4. If allowed, the operation is forwarded to the configured **MemoryAdapter** (LangGraph, OpenAI Sessions, MCP, or in-memory).
5. An immutable **TrailEvent** is written to the Trailproof audit trail for every step.

## Core Classes

| Class                     | Description                                                                                                              | Reference                                       |
| ------------------------- | ------------------------------------------------------------------------------------------------------------------------ | ----------------------------------------------- |
| `Memproof`                | Primary entry point. Wraps the full pipeline behind `remember()`, `get()`, `update()`, `forget()`, and `search()`.       | [Memproof Class](/api-reference/memproof-class) |
| `MemproofConfig`          | Pydantic configuration model. Controls adapter selection, audit trail storage, signing, and external service URLs.       | [Configuration](/api-reference/config)          |
| `MemoryScope`             | Identifies the tenant, project, agent, and optional session/subject a memory belongs to.                                 | [Models](/api-reference/models)                 |
| `OperationContext`        | Captures who is performing an operation, from which source, and when.                                                    | [Models](/api-reference/models)                 |
| `MemoryRecord`            | The persisted memory object returned by the adapter.                                                                     | [Models](/api-reference/models)                 |
| `MemoryOperationResponse` | Response from `remember()` and `update()` -- includes the operation ID, status, risk assessment, and policy decision.    | [Models](/api-reference/models)                 |
| `OperationStatusResponse` | Response from `forget()`, `approve()`, `deny()`, and `get_operation_status()`.                                           | [Models](/api-reference/models)                 |
| `MemorySearchResponse`    | Response from `search()` -- contains ranked `MemorySearchHit` entries.                                                   | [Models](/api-reference/models)                 |
| `MemproofError`           | Base exception. All Memproof errors carry a machine-readable `code`, a human-readable `message`, and optional `details`. | [Errors](/api-reference/errors)                 |

## Quick Start

```python theme={"theme":{"light":"github-light","dark":"github-dark-dimmed"}}
import asyncio
from memproof import Memproof

async def main():
    mp = Memproof(
        policy="./memproof.yaml",
        adapter="in_memory",
    )

    # Store a memory
    result = await mp.remember(
        content="user prefers dark mode",
        scope={
            "tenant_id": "acme",
            "project_id": "assistant",
            "agent_id": "agent-1",
        },
        context={
            "actor_type": "agent",
            "actor_id": "agent-1",
            "source": "langgraph",
            "timestamp": "2026-01-15T10:30:00Z",
        },
        tags=["preference", "ui"],
    )

    print(result.status)         # OperationStatus.committed
    print(result.operation_id)   # unique operation ID
    print(result.memory.content) # "user prefers dark mode"

    # Retrieve it
    record = await mp.get(result.memory.memory_id)
    print(record.content)

    # Search
    search_result = await mp.search(
        query="dark mode",
        scope={
            "tenant_id": "acme",
            "project_id": "assistant",
            "agent_id": "agent-1",
        },
        context={
            "actor_type": "agent",
            "actor_id": "agent-1",
            "source": "langgraph",
            "timestamp": "2026-01-15T10:31:00Z",
        },
    )
    for hit in search_result.hits:
        print(hit.memory.content, hit.score)

asyncio.run(main())
```

## Enumerations

Memproof defines several enums that appear throughout the API:

| Enum              | Values                                                                                                                                                                                                                                          | Used In                   |
| ----------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------- |
| `OperationType`   | `remember`, `update`, `forget`, `search`, `get`                                                                                                                                                                                                 | `OperationStatusResponse` |
| `OperationStatus` | `received`, `pending_approval`, `committed`, `blocked`, `quarantined`, `failed`                                                                                                                                                                 | Responses                 |
| `RiskLevel`       | `low`, `medium`, `high`, `critical`                                                                                                                                                                                                             | `RiskAssessment`          |
| `DecisionAction`  | `allow`, `deny`, `require_approval`, `quarantine`                                                                                                                                                                                               | `PolicyDecision`          |
| Event types       | `memproof.pipeline.received`, `memproof.pipeline.risk_assessed`, `memproof.pipeline.policy_decided`, `memproof.pipeline.approval_requested`, `memproof.pipeline.provider_attempted`, `memproof.pipeline.committed`, `memproof.pipeline.blocked` | `TrailEvent`              |
| `ActorType`       | `agent`, `user`, `system`                                                                                                                                                                                                                       | `OperationContext`        |

See [Models](/api-reference/models) for full details on every enum and model.
