BackendSlots
The BackendSlots dataclass holds the two backend references used by ChatObject at runtime for data I/O.
Description
BackendSlots is a simple dataclass that bundles an AbilityBackend and a MemoryBackend together so they can be passed as a single argument to ChatObject or AgentRuntime.
Fields
ability(AbilityBackend): Backend responsible for loading tools, MCP clients, and presetsmemory(MemoryBackend): Backend responsible for loading and committing conversation memorybilling(BillingBackend): Optional sink for per-request billing records. Defaults to aLegacyBackend, so the slot is neverNone
Usage
python
from amrita_core.base.backend import BackendSlots
from amrita_core.builtins.backends import LegacyBackend
bkd = LegacyBackend()
slot = BackendSlots(ability=bkd, memory=bkd)
# Pass to ChatObject
chat = ChatObject(
train=train,
user_input="Hello",
session_id="my_session",
backend=slot,
)Default Behavior
When backend=None is passed to ChatObject or AgentRuntime, BackendSlots.default() builds all three slots from one shared LegacyBackend instance:
python
bkd = LegacyBackend()
slot = BackendSlots(ability=bkd, memory=bkd, billing=bkd)This uses in-process containers for ability, memory and billing storage.
billingis the only field with a default, and it has its own independent fallback: leaving it out of a hand-builtBackendSlotsconstructs a freshLegacyBackendjust for billing, which does not share state with theability/memorybackends you passed in.
