Skip to main content
When multiple agents share a run, not every agent should see every piece of memory. Lanes partition the memory space so each agent reads only what it needs while still operating within the same session.

Prerequisites

  • MuBit client initialized with a valid API key
  • A multi-agent system where agents have distinct responsibilities

Flow

  1. Register each agent with shared_memory_lanes declaring which lanes it participates in.
  2. Ingest data with lane= to tag items to a specific lane.
  3. Query with lane_filter= to retrieve only lane-scoped entries.
  4. Context assembly respects the same lane_filter for token-budgeted prompts.

Minimal implementation example

lane_scoped_memory.py
from mubit import Client
import os

run_id = "multi-agent:task-42"
client = Client(
    endpoint=os.getenv("MUBIT_ENDPOINT", "https://api.mubit.ai"),
    api_key=os.environ["MUBIT_API_KEY"],
    run_id=run_id,
    transport="http",
)

# Register agents with lane participation
client.register_agent(
    agent_id="planner",
    role="planner",
    shared_memory_lanes=["planning", "shared"],
    write_scopes=["fact", "trace", "handoff"],
)
client.register_agent(
    agent_id="executor",
    role="executor",
    shared_memory_lanes=["execution", "shared"],
    write_scopes=["fact", "trace", "observation"],
)

# Planner writes to the planning lane
client.remember(
    content="Task A depends on Task B completion before starting",
    intent="fact",
    lane="planning",
    agent_id="planner",
)

# Executor writes to the execution lane
client.remember(
    content="Task B completed in 2.3s with exit code 0",
    intent="observation",
    lane="execution",
    agent_id="executor",
)

# Shared data visible to both
client.remember(
    content="Project deadline is March 15",
    intent="fact",
    lane="shared",
)

# Planner queries only planning context
planning_context = client.recall(
    query="What are the task dependencies?",
    lane="planning",
)
# Returns: Task A depends on Task B — but NOT the execution trace

# Executor queries only execution context
execution_context = client.recall(
    query="What tasks have completed?",
    lane="execution",
)
# Returns: Task B completed — but NOT the planning dependencies

# Either agent can query shared context
shared_context = client.recall(
    query="What is the deadline?",
    lane="shared",
)

# Query without lane_filter returns everything
all_context = client.recall(query="task status", limit=10)

How lanes interact with scopes

Lanes and scopes are independent filtering mechanisms that compose:
MechanismWhat it filtersSet at
Lane (lane / lane_filter)Which memory partition an item belongs toIngest time / query time
Scope (read_scopes / write_scopes)Which entry types an agent can read or writeAgent registration time
User isolationWhich authenticated user owns the dataAuthentication time
An agent with read_scopes=["fact", "lesson"] and lane_filter="planning" sees only facts and lessons tagged with the planning lane.
lane (MAS memory isolation) is distinct from the core data-plane retrieval lane concept (direct_lane). They serve different purposes and do not interact.

Failure modes and troubleshooting

SymptomRoot causeFix
Lane-filtered query returns nothingLane name mismatch between ingest and queryVerify the exact lane string matches at both ends
Agent sees data from other lanesQuerying without lane_filterAn empty lane_filter returns all entries including unscoped ones
Items without lanes are invisible to lane queriesItems ingested without lane are unscopedUnscoped items are visible to all queries regardless of lane_filter
Context assembly ignores laneslane_filter not passed to get_context()Pass lane_filter explicitly in context requests

Next steps