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.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.str
required
Top-level tenant identifier.
str
required
Project within the tenant.
str
required
Agent that owns or created the memory.
str | None
default:"None"
Optional session identifier. Use this to scope memories to a specific conversation session.
str | None
default:"None"
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.ActorType
required
The type of actor:
"agent", "user", or "system".str
required
Unique identifier of the actor performing the operation.
str
required
The originating system or framework (e.g.,
"langgraph", "web-ui", "api").str | None
default:"None"
Optional request-level identifier for tracing.
str | None
default:"None"
Optional correlation identifier for linking related operations across services.
datetime
required
ISO 8601 timestamp of when the operation was initiated. Accepts both
datetime objects and ISO 8601 strings (Pydantic coerces strings automatically).dict[str, Any] | None
default:"None"
Arbitrary key-value metadata associated with the operation context.
Example
Record Models
MemoryRecord
The persisted memory object as returned by the adapter.str
Unique identifier for the memory record.
str
The stored memory content.
list[str]
default:"[]"
Tags associated with the memory.
MemoryScope
The scope hierarchy this memory belongs to.
dict[str, Any] | None
default:"None"
Arbitrary metadata attached to the memory.
int | None
default:"None"
Time-to-live in seconds, if set.
datetime
Timestamp when the memory was first created.
datetime
Timestamp of the most recent update.
Risk and Policy Models
RiskFactor
A single contributing factor to the overall risk score.str
Machine-readable name of the risk factor (e.g.,
"pii_detected", "cross_tenant").float
Numeric contribution to the overall risk score, between 0.0 and 1.0.
str
Human-readable explanation of why this factor was triggered.
str | None
default:"None"
Optional supporting evidence or details.
RiskAssessment
The output of the risk engine, combining individual factors into an overall score and level.float
Overall risk score between 0.0 (no risk) and 1.0 (maximum risk).
RiskLevel
Categorical risk level:
"low", "medium", "high", or "critical".list[RiskFactor]
Individual risk factors that contributed to the score.
str
Identifier of the risk scoring algorithm or engine version that produced this assessment.
PolicyDecision
The output of the policy engine after evaluating rules.DecisionAction
The decided action:
"allow", "deny", "require_approval", or "quarantine".list[str]
Machine-readable codes explaining why this decision was made (e.g.,
["pii_detected", "high_risk"]).list[str] | None
default:"None"
IDs of the policy rules that matched and triggered this decision.
str
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.
str
Unique identifier for this operation. Use this to track status via
get_operation_status(), approve(), or deny().OperationStatus
Current status of the operation.
MemoryRecord | None
The created or updated memory record. This is
None when the operation was blocked, quarantined, or is pending approval.RiskAssessment | None
The risk assessment produced during pipeline execution.
PolicyDecision
The policy engine’s decision for this operation.
Example
OperationStatusResponse
Returned byforget(), approve(), deny(), and get_operation_status().
str
Unique identifier of the operation.
OperationType
The type of operation:
"remember", "update", "forget", "search", or "get".OperationStatus
Current lifecycle status.
str | None
The ID of the affected memory, if applicable.
PolicyDecision
The policy decision that governed this operation.
RiskAssessment | None
The risk assessment, if one was performed.
datetime | None
When the operation was first received.
datetime | None
When the operation status was last updated.
MemorySearchResponse
Returned bysearch(). Contains ranked search results.
list[MemorySearchHit]
Ordered list of search results, ranked by relevance score (highest first).
MemorySearchHit
A single search result pairing a memory record with its relevance score.MemoryRecord
The matching memory record.
float
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.str
Unique identifier for this event.
str
Namespaced event type (e.g.,
"memproof.pipeline.received", "memproof.pipeline.committed").datetime
When the event was created.
str | None
The actor who triggered the event, if available.
dict[str, Any]
Event-specific data including
operation_id, tenant_id, project_id, and stage-specific payload (e.g., risk assessment result, policy decision).str
SHA-256 hash of this event for chain integrity.
str | None
Hash of the previous event in the chain.
None for the first event.str | None
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.