Tutorials

Building a Compliant Customer Support Copilot in 10 Minutes

Step-by-step guide to integrating MemHouse with LangGraph and Claude to create support bots that remember customer preferences while adhering to strict privacy scoping.

Aleksei Popov
Founder, MemHouse
July 20, 2026 5 min read

The official Python SDK and packaged MCP client are coming soon. This tutorial uses the documented HTTP API available today.

This example records a support observation and retrieves governed context from the same ticket scope. It deliberately stops at the memory boundary: pass the returned context to your model or orchestration framework only after applying your application’s own authorization and response policies.

Prerequisites

You need a running MemHouse server, an API key, and curl. Set the endpoint and key without putting either value into the script:

export MEMHOUSE_URL="http://localhost:4000"
export MEMHOUSE_API_KEY="replace-with-your-api-key"

1. Ingest a Support Observation

Use one stable scope_path for the ticket and a stable session_id for its conversation. The account is derived from the authenticated identity; do not use a caller-supplied account selector as an isolation boundary.

curl --fail-with-body \
  -X POST "$MEMHOUSE_URL/api/v1/ingest" \
  -H "Authorization: Bearer $MEMHOUSE_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "session_id": "support-INV-9042",
    "scope_path": "/support/tickets/INV-9042",
    "content": "Customer prefers invoices by email rather than postal mail."
  }'

--fail-with-body makes the command return a non-zero status for HTTP errors while preserving the response body for diagnosis. A successful response means the observation was accepted by the HTTP endpoint; it does not imply that every extracted fact is immediately active, because governance may hold or reject facts.

2. Retrieve Context for the Same Ticket

curl --fail-with-body \
  -X POST "$MEMHOUSE_URL/api/v1/context" \
  -H "Authorization: Bearer $MEMHOUSE_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "scope_path": "/support/tickets/INV-9042",
    "session_id": "support-INV-9042",
    "budget_chars": 4000
  }'

The response contains projection-backed context visible to the authenticated caller for that scope. Treat an empty result as a valid outcome: the observation may not have produced a fact, or a fact may not yet be visible under its lifecycle state.

3. Put It Behind Your Copilot

In a LangGraph, Claude, or other support workflow, make the two HTTP calls at explicit boundaries:

  1. Before generating a reply, call /api/v1/context with the current ticket scope and add only the returned context to the model input.
  2. After the customer or agent sends a new turn, call /api/v1/ingest with that turn as content.
  3. Keep ticket identifiers server-side and derive authorization from the signed-in support user. Never accept an arbitrary scope_path from an untrusted browser and forward it without an access check.

This is the complete MemHouse integration loop: ingest observations, retrieve governed context, and let your existing application own model invocation and customer-facing responses.

Tags: Tutorial LangGraph Python Customer Support

Related Articles & Release Notes

View All Posts →
Engineering Targeting 10,000 Ingests/Sec on PostgreSQL pgvector

An engineering target and the evidence we plan to publish for a reproducible pgvector ingest benchmark.

4 min read Read
Releases & Updates MemHouse Changelog

A concise index of releases documented on the MemHouse site, with roadmap items clearly separated from shipped interfaces.

2 min read Read
Comparisons MemHouse vs. Mem0: Architectural Differences in Agent Memory Governance

A focused comparison of MemHouse and Mem0 approaches to governance, fact lifecycle state, and tenant scoping.

3 min read Read