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
- Register each agent with
shared_memory_lanes declaring which lanes it participates in.
- Ingest data with
lane= to tag items to a specific lane.
- Query with
lane_filter= to retrieve only lane-scoped entries.
- Context assembly respects the same
lane_filter for token-budgeted prompts.
Minimal implementation example
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)
import { Client } from "@mubit-ai/sdk";
const runId = "multi-agent:task-42";
const client = new Client({
endpoint: process.env.MUBIT_ENDPOINT ?? "https://api.mubit.ai",
apiKey: process.env.MUBIT_API_KEY,
runId,
transport: "http",
});
await client.registerAgent({
agentId: "planner",
role: "planner",
sharedMemoryLanes: ["planning", "shared"],
});
await client.remember({
content: "Task A depends on Task B",
intent: "fact",
lane: "planning",
agentId: "planner",
});
// Query only the planning lane
const result = await client.recall({
query: "task dependencies",
lane: "planning",
});
How lanes interact with scopes
Lanes and scopes are independent filtering mechanisms that compose:
| Mechanism | What it filters | Set at |
|---|
Lane (lane / lane_filter) | Which memory partition an item belongs to | Ingest time / query time |
Scope (read_scopes / write_scopes) | Which entry types an agent can read or write | Agent registration time |
| User isolation | Which authenticated user owns the data | Authentication 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
| Symptom | Root cause | Fix |
|---|
| Lane-filtered query returns nothing | Lane name mismatch between ingest and query | Verify the exact lane string matches at both ends |
| Agent sees data from other lanes | Querying without lane_filter | An empty lane_filter returns all entries including unscoped ones |
| Items without lanes are invisible to lane queries | Items ingested without lane are unscoped | Unscoped items are visible to all queries regardless of lane_filter |
| Context assembly ignores lanes | lane_filter not passed to get_context() | Pass lane_filter explicitly in context requests |
Next steps