Models
All models are defined inmemproof.models.core and re-exported from the top-level memproof package. Every model is a Pydantic BaseModel (or str, Enum for enumerations).
Enumerations
OperationType
Identifies the kind of memory operation.OperationStatus
Tracks the lifecycle state of an operation as it moves through the pipeline.| Value | Meaning |
|---|---|
received | The request has been accepted but processing has not completed. |
pending_approval | The policy engine returned require_approval. A human reviewer must call approve() or deny(). |
committed | The operation completed successfully and the memory has been persisted (or deleted). |
blocked | The policy engine denied the operation. |
quarantined | The operation was quarantined for later review. |
failed | An unexpected error occurred during processing. |
RiskLevel
Categorical risk level derived from the numeric risk score.DecisionAction
The action taken by the policy engine after evaluating rules against the risk assessment.ActorType
Identifies the type of actor performing an operation.Value Objects
MemoryScope
Identifies the multi-tenant hierarchy a memory belongs to. Every memory is scoped to at least a tenant, project, and agent.Top-level tenant identifier.
Project within the tenant.
Agent that owns or created the memory.
Optional session identifier. Use this to scope memories to a specific conversation session.
Optional subject identifier. Use this to scope memories to a specific end-user or entity the memory is about.
Example
OperationContext
Captures the identity and metadata of the actor performing an operation.The type of actor:
"agent", "user", or "system".Unique identifier of the actor performing the operation.
The originating system or framework (e.g.,
"langgraph", "web-ui", "api").Optional request-level identifier for tracing.
Optional correlation identifier for linking related operations across services.
ISO 8601 timestamp of when the operation was initiated. Accepts both
datetime objects and ISO 8601 strings (Pydantic coerces strings automatically).Arbitrary key-value metadata associated with the operation context.
Example
Record Models
MemoryRecord
The persisted memory object as returned by the adapter.Unique identifier for the memory record.
The stored memory content.
Tags associated with the memory.
The scope hierarchy this memory belongs to.
Arbitrary metadata attached to the memory.
Time-to-live in seconds, if set.
Timestamp when the memory was first created.
Timestamp of the most recent update.
Risk and Policy Models
RiskFactor
A single contributing factor to the overall risk score.Machine-readable name of the risk factor (e.g.,
"pii_detected", "cross_tenant").Numeric contribution to the overall risk score, between 0.0 and 1.0.
Human-readable explanation of why this factor was triggered.
Optional supporting evidence or details.
RiskAssessment
The output of the risk engine, combining individual factors into an overall score and level.Overall risk score between 0.0 (no risk) and 1.0 (maximum risk).
Categorical risk level:
"low", "medium", "high", or "critical".Individual risk factors that contributed to the score.
Identifier of the risk scoring algorithm or engine version that produced this assessment.
PolicyDecision
The output of the policy engine after evaluating rules.The decided action:
"allow", "deny", "require_approval", or "quarantine".Machine-readable codes explaining why this decision was made (e.g.,
["pii_detected", "high_risk"]).IDs of the policy rules that matched and triggered this decision.
Version string of the policy configuration that was evaluated.
Response Models
MemoryOperationResponse
Returned byremember() and update(). Contains the full result of a create or update operation.
Unique identifier for this operation. Use this to track status via
get_operation_status(), approve(), or deny().Current status of the operation.
The created or updated memory record. This is
None when the operation was blocked, quarantined, or is pending approval.The risk assessment produced during pipeline execution.
The policy engine’s decision for this operation.
Example
OperationStatusResponse
Returned byforget(), approve(), deny(), and get_operation_status().
Unique identifier of the operation.
The type of operation:
"remember", "update", "forget", "search", or "get".Current lifecycle status.
The ID of the affected memory, if applicable.
The policy decision that governed this operation.
The risk assessment, if one was performed.
When the operation was first received.
When the operation status was last updated.
MemorySearchResponse
Returned bysearch(). Contains ranked search results.
Ordered list of search results, ranked by relevance score (highest first).
MemorySearchHit
A single search result pairing a memory record with its relevance score.The matching memory record.
Relevance score between 0.0 and 1.0.
Example
Audit Trail Models
TrailEvent
An immutable audit event emitted at each stage of the orchestration pipeline. Events are stored in the Trailproof audit trail with SHA-256 hash chains and optional HMAC signing for tamper evidence.Unique identifier for this event.
Namespaced event type (e.g.,
"memproof.pipeline.received", "memproof.pipeline.committed").When the event was created.
The actor who triggered the event, if available.
Event-specific data including
operation_id, tenant_id, project_id, and stage-specific payload (e.g., risk assessment result, policy decision).SHA-256 hash of this event for chain integrity.
Hash of the previous event in the chain.
None for the first event.HMAC-SHA256 signature if signing is enabled.
None otherwise.Request Models
These models are used internally by theMemproof class to structure requests before passing them to the orchestrator. You generally do not need to construct them directly — the Memproof methods accept raw dictionaries and build these internally.