Configuration Hierarchy
Storage drivers are resolved in the following order (highest priority first):- Storage-specific method (e.g.,
historyStorageDrivers()) - Storage-specific property (e.g.,
$history) - Agent default method (
defaultStorageDrivers()) - Agent default property (
$storage) - Provider configuration (
config/laragent.php) - Global configuration (
config/laragent.php)
Default Storage Drivers
Set default drivers for all storages in an agent’s context using the$storage property or defaultStorageDrivers() method.
Using Property
Using Method Override
For dynamic configuration, override thedefaultStorageDrivers() method:
Storage-Specific Drivers
Override the default for specific storage types when you need different persistence strategies.Chat History Storage
Use$history property or historyStorageDrivers() method:
- Property
- Method Override
For chat history-specific configuration like truncation strategies, metadata storage, and force read/save flags, see the Chat History documentation.
Usage Storage
Use$usageStorage property or usageStorageDrivers() method:
- Property
- Method Override
For detailed usage tracking configuration, cost calculation, and custom models, see the Usage Tracking documentation.
String Aliases
Both$usageStorage and $history properties accept string aliases for convenience:
For detailed information about each driver’s constructor arguments, custom model examples, and the fallback pattern, see the Storage Drivers reference.
Configuration Examples
Simple: Single Driver for Everything
Mixed: Different Drivers per Storage Type
High Availability: Fallback Chain
Dynamic: Environment-Based Configuration
How It Works
When a storage is created (e.g.,ChatHistoryStorage), it resolves drivers in this order:
- Set sensible defaults at the agent level (
$storage/defaultStorageDrivers()) - Override specific storages when needed (
$history/historyStorageDrivers()) - Fall back to global config if nothing is specified
Custom Storages
Beyond chat history and usage tracking, you can create custom storages for any data your agent needs to persist — customer notes, session metadata, conversation tags, and more. Custom storages use:- DataModel — Typed, structured data classes for your storage items
- Storage — Abstract base class that handles persistence, lazy loading, and dirty tracking
- Storage Drivers — Pluggable backends (cache, file, database, etc.)
Custom Storage
Create custom storages with DataModels for type-safe persistence.
Custom Storage Driver
Build custom storage drivers for specialized backends.
Next Steps
Storage Drivers
Learn about all available storage drivers and their configuration options.
Chat History
Configure chat history storage and truncation strategies.
Usage Tracking
Track token usage and costs across agent interactions.
Context Overview
Understand the Context and Identity system for storage isolation.

