Tenant Isolation¶
Tenant isolation is a design constraint across the library. Every package should receive an explicit scope or tenant-qualified reference rather than inferring tenancy from global state.
Scope Shapes¶
| Package | Scope shape | Purpose |
|---|---|---|
coactra |
Scope(tenant_id, namespace, agent_id, session_id) |
Canonical scope shared by every package. |
coactra[agent] |
canonical Scope |
Agent runtime and collaboration policy scope. |
coactra[memory] |
canonical Scope |
Memory partitioning across tenant/shared/agent/session levels. |
coactra[workspace] |
canonical Scope |
Path-safe filesystem/sandbox root at the workspace boundary. |
coactra[workflow] |
canonical Scope |
Procedure, workflow, and durable ledger partition. |
coactra[team] |
tenant on root/org/store operations | Tenant is the team directory isolation boundary. |
Isolation Mechanisms¶
- Memory encodes tenant into backend-specific keys such as in-process scope keys, mem0 user/agent/run ids, or Graphiti group ids.
- Workspace confines file paths under tenant/agent roots and rejects traversal.
- Workflow ledger stores list/get/save by canonical
Scopeand tenant-indexed columns in SQL. - Team directory repositories require tenant arguments and filter by tenant.
- Agent collaboration uses tenant-qualified
AgentRefand denies cross-tenant talk by default. - Tenant routers select a physical backend/runtime per tenant where hard silos are needed.
Rules for New Code¶
- Accept explicit scope arguments at public boundaries.
- Do not use process-global tenant state.
- Do not convert tenant IDs with ad hoc string parsing when a scope DTO exists.
- Keep cross-tenant collaboration denied by default unless a host policy explicitly allows it.
- Add tests where a value written under one tenant cannot be read from another.
- For routers, forward only the memory/tool/workspace contracts the wrapped object supports.
Router Inventory¶
TenantReasoningStoreRouterTenantMemoryRouterTenantWorkspaceBackendRouterTenantWorkStoreRouterTenantProcedureStoreRouterTenantWorkflowEngineRouterTenantOrgStoreRouter
Routers are a production silo tool, so protocol conformance tests should cover every method they forward.
App-Facing Rule¶
Application code should start with from coactra import Scope and pass that same value across package boundaries. Shared pools use agent_id=None; private memory/workspaces set agent_id; sessions set session_id.