Skip to content

feat(langgraph): add ebbmem-langgraph BaseStore, middleware, and LangMem tools (P1-06) - #9

Merged
sbharatjoshi merged 1 commit into
mainfrom
feat/p1-06-langgraph
Nov 22, 2026
Merged

sbharatjoshi merged 1 commit into
mainfrom
feat/p1-06-langgraph

Conversation

@sbharatjoshi

Copy link
Copy Markdown
Member

What and Why

Adds the ebbmem-langgraph Python package under packages/langgraph-python/ (P1-06), built directly on top of ebbmem-integration-core (packages/python/, untouched):

  • EbbmemStore(BaseStore) (ebbmem_langgraph.store): Implements LangGraph's full async and sync BaseStore contract (abatch/batch, aput/put, aget/get, adelete/delete, asearch/search with semantic query and JSONB-style operator filters, alist_namespaces/list_namespaces, supports_ttl=False). Keeps no process-local item dictionary; all state lives in EbbMem.
    • IC-1 Namespace Mapping: Resolves EbbMem's top-level namespace via ScopeResolver ({tenant}:u:{user_id}, explicit app_namespace, or optional user_id_from_namespace), avoiding per-tuple namespace explosion while mapping LangGraph hierarchy tuples to normalized IC-1 tags (session:<id> extracted to session_id) and metadata.
    • Released ebbmem-client 0.2.0 Gaps: Defaults to ebbmem-integration-core's StdlibHttpTransport / AsyncStdlibHttpTransport for full IC-1 REST parity, and provides client-side fallback (within scan_limit) plus strict_sdk_capabilities=True (UnsupportedCapabilityError) when wrapping ebbmem-client 0.2.0.
    • Cognitive Memory Semantics: get and search (recall) remain strictly read-only (reinforce=False); explicit reinforce/areinforce and reinforce_from_exposure/areinforce_from_exposure methods support post-use reinforcement (injected=False default); delete/adelete always maps to soft-tombstone forget, never physical purge.
  • EbbmemMemoryMiddleware(AgentMiddleware) (ebbmem_langgraph.middleware): Sync/async wrap_model_call middleware for LangChain create_agent that recalls memories before model execution, injects them wrapped in <ebbmem_untrusted_memory_context> delimiters, reinforces only cited/used memories after execution, and optionally captures turns with deterministic idempotency keys and secret redaction (fail-open).
  • LangMem-Compatible Tools (ebbmem_langgraph.tools): create_ebbmem_manage_memory_tool, create_ebbmem_search_memory_tool, and create_ebbmem_reinforce_memory_tool, plus verified compatibility with langmem.create_memory_store_manager(store=EbbmemStore(...)), langmem.create_manage_memory_tool, and langmem.create_search_memory_tool.
  • Package Docs: packages/langgraph-python/README.md documenting install-from-source, IC-1 namespace tuple mapping, middleware/tools, and 0.2.0 SDK / TTL / scan limits.

Nothing published.

Acceptance Commands

pip install -e "./conformance[dev]" -e "./packages/python[dev]" -e "./packages/langgraph-python[dev]"
ruff check packages/langgraph-python
ruff format --check packages/langgraph-python
pytest -v packages/langgraph-python/tests packages/python/tests conformance/tests
ebbmem-conformance --mode mock

Test Summary

  • ruff check packages/langgraph-python -> All checks passed! (exit 0)
  • ruff format --check packages/langgraph-python -> 11 files already formatted (exit 0)
  • pytest -v packages/langgraph-python/tests packages/python/tests conformance/tests -> 128 passed, 0 failed (including InMemoryStore side-by-side parity, IC-1 mock conformance, ebbmem-client 0.2.0 SDK adapter path, create_agent middleware with mocked chat models, langmem.create_memory_store_manager with mocked models, and conformance/tests/test_public_compliance.py)
  • ebbmem-conformance --mode mock -> 21/21 passed (exit 0)

Architecture Review Note

  • Cleanly scoped ebbmem-langgraph package off fresh origin/main (8b7aaf43, 13 files under packages/langgraph-python/, max 876 lines, zero edits to packages/python/ or conformance/, DCO sign-off).
  • EbbmemStore implements the full async/sync LangGraph BaseStore contract (abatch/batch, aput/put, aget/get, adelete/delete, asearch/search with semantic query and operator filters, alist_namespaces/list_namespaces, supports_ttl=False) with zero process-local item dictionary, IC-1 namespace mapping (avoiding per-tuple EbbMem namespace explosion), soft-tombstone forget on delete, and explicit fallback/strict handling for ebbmem-client 0.2.0 capability gaps.
  • EbbmemMemoryMiddleware (sync + async wrap_model_call for create_agent) and LangMem-compatible manage/search/reinforce tools enforce read-only recall, <ebbmem_untrusted_memory_context> framing, explicit post-use reinforcement (injected=False default), secret redaction, and fail-open behavior.
  • Verification: ruff check and ruff format --check clean, pytest -v packages/langgraph-python/tests conformance/tests/test_public_compliance.py 14/14 passed (covering InMemoryStore parity, IC-1 mock conformance, 0.2.0 SDK adapter path, create_agent middleware, and langmem.create_memory_store_manager with mocked models), README links verified. Nothing published.

Follow-ups

  1. When ebbmem-client publishes P0-09 exact-key (get_by_key, delete_by_key), server-side metadata filter, list_namespaces, and RecallRequestModel filter/limit parity (and ebbmem-integration-core updates StdlibHttpTransport / EbbmemClientSdkAdapter including MemoryRow deserialization), update ebbmem-integration-core so EbbmemStore leverages native server-side exact-key lookup and metadata filtering without scan_limit fallback.
  2. Add a packages/langgraph-python test job to .github/workflows/ci.yml (ci.yml left untouched per shared-file rules).

…Mem tools (P1-06)

Signed-off-by: Bharat Joshi <200157101+sbharatjoshi@users.noreply.github.com>
@sbharatjoshi
sbharatjoshi merged commit be8ba63 into main Nov 22, 2026
2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant