andibase

Data Model

Define data, fields, records, operations, and lifecycle hooks in andibase

Open Markdown

What is data?

Data in andibase starts with a data definition, such as Customer, Order, Ticket, or PurchaseOrder.

Data definitions and their rows are the core unit that agents and apps read, update, and act on.

Data shape

Each data definition includes a common base structure:

  • id: unique identifier for the record.
  • name: human-readable label.
  • description: optional context for people and agents.
  • attributes: the API field that stores your typed field definitions.

In the docs, "fields" refers to the domain-specific properties you define for a data definition. In API payloads, those field definitions and field values live under the attributes key.

Data definition (the schema):

{
  key: "Order",
  name: "Order",
  description: "Represents a customer purchase order",
  attributes: {
    customerId: { type: "string", required: true },
    amount: { type: "number", required: true },
    status: { type: "string", required: true },
    createdAt: { type: "datetime", required: true }
  }
}

Data row (one row of data that follows that schema):

{
  id: "ord_123",
  name: "Order #123",
  attributes: {
    customerId: "cus_789",
    amount: 1499,
    status: "pending",
    createdAt: "2026-03-05T12:00:00Z"
  }
}

Data operations

Common record operations supported by andibase data:

  • Get by id: retrieve one data row by identifier.
  • Append many: insert multiple new data rows in bulk.
  • Upsert: create data rows if they do not exist, or update if they do.
  • Update many: update multiple data rows in one operation.
  • Delete many: remove multiple data rows in one operation.
  • Query: list data rows using filters, sorting, pagination, and other constraints.

Lifecycle hooks

Data definitions can run lifecycle hooks on every operation so you can enforce logic, side effects, and policies consistently.

Recommended lifecycle stages:

  • pre-create: validate input, set defaults, enforce permissions.
  • post-create: trigger notifications, indexing, or downstream jobs.
  • pre-update: validate changes, check invariants, enforce policies.
  • post-update: emit events, sync external systems, recalculate derived data.
  • pre-delete: block unsafe deletes and run dependency checks.
  • post-delete: clean up references and propagate deletion events.
  • pre-read: apply access control and field-level restrictions.
  • post-read: redact or transform outputs and attach computed fields.

Use these hooks to keep behavior predictable across humans, APIs, and autonomous agents.

On this page