Skip to content

[mason] Per-user memory/session isolation + agent.toml store bindings - #533

Merged
elainewang-db merged 4 commits into
databricks:mainfrom
elainemwang:mason-per-user-actor
Sep 3, 2026
Merged

[mason] Per-user memory/session isolation + agent.toml store bindings#533
elainewang-db merged 4 commits into
databricks:mainfrom
elainemwang:mason-per-user-actor

Conversation

@elainewang-db

@elainewang-db elainewang-db commented Sep 3, 2026

Copy link
Copy Markdown
Contributor

Two related changes to how a mason agent resolves its memory/session config.

Per-user isolation (e2b044d): managed memory and session data now partition by the signed-in user (X-Forwarded-Email) instead of one shared "agent" actor, so a deployed multi-user agent no longer pools everyone's memory/transcripts. The actor is a factory parameter closed over in the tools — not a tool argument — so the model can't set or spoof it. Falls back to "agent" locally.

Store bindings in agent.toml (56b5113): mason memory bind <store> / mason sessions bind <store> (+unbind) declare a [memory_store] / [session_store] table in agent.toml, creating the store if needed. The runtime resolves the store name explicit arg → AGENT_*_STORE env → agent.toml binding → none (conventional precedence; env overrides the committed default). A bind takes effect with no env plumbing.

Both templates + adapters updated; app.yaml unchanged. Tests: 231 unit, 21 openai + 25 langgraph scaffold; ruff + ty clean.

Tested e2e dev on e2-dogfood.

@elainemwang
elainemwang force-pushed the mason-per-user-actor branch 2 times, most recently from 2cd7b8d to 6ea9742 Compare September 3, 2026 20:15
@elainewang-db
elainewang-db enabled auto-merge (squash) September 3, 2026 20:23
auto-merge was automatically disabled September 3, 2026 20:58

Head branch was pushed to by a user without write access

@elainewang-db
elainewang-db enabled auto-merge (squash) September 3, 2026 21:00
elainewang-db and others added 4 commits September 3, 2026 21:08
Long-term memory and the durable session store were keyed by a single static actor
(AGENT_*_ACTOR_ID env, default "agent"), so every user of a deployed agent shared
one memory/session namespace — a privacy and relevance problem for multi-user apps.

Make the actor the request's signed-in user instead:

- The SDK adapters take actor as an explicit parameter — memory_tools(actor),
  session_store(session_id, actor), thread_config(session_id, actor). The memory
  tools close over the actor (it is NOT a tool argument the model can set/spoof).
- The templates resolve the actor per request from the forwarded-identity header
  (X-Forwarded-Email) in runtime.py and pass it through agent.py's _actor(); it
  falls back to "agent" locally. The demo UI's state routes use the same actor so
  its memory/session panels show the signed-in user's own data.
- Drop the now-dead AGENT_*_ACTOR_ID env vars and `mason deploy --actor-id` (the
  actor is no longer a static deploy-time value). The low-level `mason memory
  entries` / `mason sessions` --actor-id args are unchanged (direct store access).

Both templates (openai + langgraph). Tests + docs updated; per-user actor is
invisible to agent authors — they call the same memory_tools()/session_store().

Co-authored-by: Isaac <no-reply@databricks.com>
Store bindings become part of the agent manifest instead of only living as app.yaml
env. `mason memory bind <store>` / `mason sessions bind <store>` (+ unbind) declare a
`[memory_store]` / `[session_store]` table in agent.toml, creating the managed store
if it doesn't exist. The runtime resolves the store name explicit-arg > AGENT_*_STORE
env > agent.toml binding > none — the conventional precedence (env overrides the
committed default), read via a new runtime.tool_manifest.store_binding() so a bind
takes effect with no env plumbing.

Co-authored-by: Isaac <no-reply@databricks.com>
Store create/resolve is a network round-trip that can stall (the agents/v1 create
endpoint is slow and occasionally drops the response), so `mason memory/sessions bind`
and `stores create` looked hung. Add a `render.status()` spinner around those calls.

Co-authored-by: Isaac <no-reply@databricks.com>
The scaffolds need the per-user-actor + agent.toml store-binding runtime (memory_tools(actor),
resolve_*_store, thread_config(actor)), which ships in 0.1.3.dev0. Bump both template pins so a
scaffold resolves a package new enough to read its bindings. The package version bump itself lands
separately.

Co-authored-by: Isaac <no-reply@databricks.com>
auto-merge was automatically disabled September 3, 2026 21:13

Head branch was pushed to by a user without write access

@elainewang-db
elainewang-db enabled auto-merge (squash) September 3, 2026 21:14
@elainewang-db
elainewang-db merged commit 9559546 into databricks:main Sep 3, 2026
50 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.

2 participants