KastraxStorage
KastraxStorage
provides a unified interface for managing:
- Suspended Workflows: the serialized state of suspended workflows (so they can be resumed later)
- Memory: threads and messages per
resourceId
in your application - Traces: OpenTelemetry traces from all components of Kastrax
- Eval Datasets: scores and scoring reasons from eval runs

Kastrax provides different storage providers, but you can treat them as interchangeable. Eg, you could use libsql in development but postgres in production, and your code will work the same both ways.
Configuration
Kastrax can be configured with a default storage option:
import ai.kastrax.core.kastrax
import ai.kastrax.storage.libsql.LibSQLStore
val kastraxInstance = kastrax {
storage = LibSQLStore(
url = "file:./kastrax.db"
)
}
Data Schema
Messages
Stores conversation messages and their metadata. Each message belongs to a thread and contains the actual content along with metadata about the sender role and message type.
id
uuidv4
PRIMARYKEY
NOT NULL
Unique identifier for the message (format:
xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx
)thread_id
uuidv4
FK → threads.id
NOT NULL
Parent thread reference
content
text
NOT NULL
role
text
NOT NULL
Enum of
system | user | assistant | tool
type
text
NOT NULL
Enum of
text | tool-call | tool-result
createdAt
timestamp
NOT NULL
Used for thread message ordering
Storage Providers
Kastrax supports the following providers:
- For local development, check out LibSQL Storage
- For production, check out PostgreSQL Storage
- For serverless deployments, check out Upstash Storage
Last updated on