Client Configuration

This page documents how to configure the memory-service-langgraph package when connecting to Memory Service.

Configuration Approaches

The package supports two configuration styles:

Pass all connection settings directly to the constructor:

from memory_service_langgraph import MemoryServiceStore, AsyncMemoryServiceStore

store = MemoryServiceStore(
    base_url="http://memory-service:8082",
    token="my-bearer-token",
)

async_store = AsyncMemoryServiceStore(
    base_url="http://memory-service:8082",
    token="my-bearer-token",
)

This approach keeps your code self-contained and testable — no hidden dependencies on the process environment.

Use the from_env() class method to read configuration from MEMORY_SERVICE_* environment variables:

store = MemoryServiceStore.from_env()
async_store = AsyncMemoryServiceStore.from_env()

You can override individual settings while reading the rest from the environment:

store = MemoryServiceStore.from_env(
    base_url="http://custom-host:9090",
)

Environment Variable Reference

VariableDescriptionDefault
MEMORY_SERVICE_URLBase URL for REST API callshttp://localhost:8082
MEMORY_SERVICE_UNIX_SOCKETAbsolute path to a Unix domain socket (overrides URL for transport)(none)
MEMORY_SERVICE_TOKENBearer token sent in the Authorization header(none)

Unix Domain Sockets

When MEMORY_SERVICE_UNIX_SOCKET is set (or unix_socket= is passed), REST calls use the socket transport and the logical base URL becomes http://localhost.

See Unix Domain Sockets for a full walkthrough.

Authorization

The token parameter (or MEMORY_SERVICE_TOKEN env var) sets a static Bearer token. For per-request token forwarding (e.g., from incoming HTTP request headers), the LangGraph checkpointer and store classes also integrate with the authorization middleware described in Getting Started.