Configuration
MemproofConfig is a Pydantic BaseModel that holds all configuration for a Memproof instance. You can construct it directly, pass individual keyword arguments to the Memproof constructor, or load defaults from environment variables using load_config().
MemproofConfig
Fields
Core
Path to the Memproof policy YAML file. This file defines the rules, risk thresholds, and actions that govern memory operations. The path is resolved relative to the current working directory unless an absolute path is provided.
Which memory adapter backend to use. This determines where memories are physically stored.Supported values:
| Value | Backend |
|---|---|
"in_memory" | Ephemeral dictionary-backed store. Data is lost when the process exits. Suitable for testing and development. |
"langgraph" | LangGraph checkpoint API. Requires langgraph_url to be set. |
"openai_sessions" | OpenAI Sessions API. Requires openai_api_key to be set. |
"mcp" | MCP memory server. Requires mcp_server_url to be set. |
Attesta Approval Service
These fields configure the external Attesta approval service, which handles human-in-the-loop approval workflows when the policy engine returns arequire_approval decision.
Enable integration with the Attesta approval service. When
False, approval requests are handled by the local ApprovalBroker without an external service.Base URL of the Attesta approval service (e.g.,
"https://attesta.example.com/api/v1"). Only used when attesta_enabled=True.Bearer token for authenticating requests to the Attesta service. Only used when
attesta_enabled=True.Trailproof Audit Trail
These fields configure the Trailproof-powered audit trail that records every step of every memory operation for auditing and compliance. Trailproof provides SHA-256 hash chains, HMAC signing, and tamper detection.Trailproof audit trail storage backend.
| Value | Backend |
|---|---|
"memory" | In-memory store. Events are lost on process exit. Suitable for testing. |
"jsonl" | JSONL file-backed persistent store. Events are appended to a JSON Lines file on disk. |
File path for the JSONL trail store. Required when
trail_store="jsonl". The file is created automatically if it does not exist.HMAC-SHA256 secret key for signing trail events. When provided, each event in the audit trail includes a cryptographic signature that can be verified later to detect tampering. This should be a strong, random secret kept outside of version control.
Adapter Backends
These fields provide connection details for the supported adapter backends. Only the fields relevant to the selectedadapter value need to be configured.
Base URL for the LangGraph checkpoint API (e.g.,
"https://langgraph.example.com"). Required when adapter="langgraph".API key for authenticating with the LangGraph checkpoint API. Used when
adapter="langgraph".OpenAI API key. Required when
adapter="openai_sessions".OpenAI organization ID. Optional, used when
adapter="openai_sessions" to scope requests to a specific organization.URL of the MCP memory server (e.g.,
"http://localhost:8200"). Required when adapter="mcp".Constructing a Config
Direct Construction
Passing to Memproof
Using Convenience kwargs
If you do not need a separate config object, pass the fields directly to theMemproof constructor:
load_config()
Load aMemproofConfig from environment variables with sensible defaults. Every field maps to an environment variable with the MEMPROOF_ prefix.
A fully populated configuration object.
Environment Variable Mapping
| Field | Environment Variable | Default |
|---|---|---|
policy_path | MEMPROOF_POLICY_PATH | "memproof.yaml" |
adapter | MEMPROOF_ADAPTER | "in_memory" |
attesta_enabled | MEMPROOF_ATTESTA_ENABLED | "false" |
attesta_url | MEMPROOF_ATTESTA_URL | "" |
attesta_token | MEMPROOF_ATTESTA_TOKEN | "" |
trail_store | MEMPROOF_TRAIL_STORE | "memory" |
trail_store_path | MEMPROOF_TRAIL_STORE_PATH | None |
trail_signing_key | MEMPROOF_TRAIL_SIGNING_KEY | None |
langgraph_url | MEMPROOF_LANGGRAPH_URL | "" |
langgraph_api_key | MEMPROOF_LANGGRAPH_API_KEY | "" |
openai_api_key | MEMPROOF_OPENAI_API_KEY | "" |
openai_organization | MEMPROOF_OPENAI_ORGANIZATION | "" |
mcp_server_url | MEMPROOF_MCP_SERVER_URL | "" |
"true" or "false" (case-insensitive). Numeric fields are parsed as floats.
Example
Configuration Precedence
When constructing aMemproof instance, configuration is resolved in the following order:
- Explicit
configparameter — If aMemproofConfigis passed to the constructor, it is used directly. All keyword arguments (exceptpolicy_schema_path) are ignored. - Constructor keyword arguments — If no
configis passed, aMemproofConfigis built from the keyword arguments with their defaults. load_config()— Reads from environment variables. You must call it explicitly and pass the result as theconfigparameter.