B3OS includes organization-scoped database capabilities so workflows can query and update durable data without requiring every team to operate a separate backend service.

Storage Layers

LayerUse
Workflow definition storageDrafts, live versions, metadata, visibility, and validation state
Run and execution storageTrigger input, node input/output, status, timing, sanitized errors, and activity
Organization databaseTeam-managed tables queried by workflow nodes
Connector storageEncrypted provider credential data and masked client-visible metadata
Knowledge storageSearchable organization knowledge used by Caddie workflow tooling

Database Query Action

The db-query built-in action lets a workflow read or modify organization database state. Use it for lightweight operational data such as allowlists, account mappings, customer settings, campaign configuration, alert routing, or workflow memory that needs a table shape.

json
{ "query": "select wallet_address, tier from customers where customer_id = $1", "params": ["{{$trigger.body.customerId}}"]}

Avoid broad writes and destructive operations. B3OS restricts dangerous statement classes, but workflow authors should still keep database access narrow and auditable.

Common Patterns

PatternExample
Lookup before actionFetch a routing rule before sending Slack or Telegram messages
IdempotencyStore processed external event IDs before sending payments or notifications
PolicyCheck allowlists, thresholds, and per-customer settings before wallet actions
EnrichmentJoin trigger input with known account or protocol metadata
Audit supportWrite a compact operational record after a successful workflow

Data Retention and Visibility

Workflow run data is visible to authorized organization users and APIs. Sensitive values are masked before display where B3OS recognizes connector secrets, tokens, keys, and configured sensitive fields.

Store provider IDs, customer IDs, token symbols, addresses, and routing metadata. Keep credentials in connectors and signing authority in wallets.

Query Design Checklist

  1. Parameterize values instead of concatenating strings.
  2. Keep read queries narrow with explicit filters.
  3. Use unique event IDs for idempotency.
  4. Avoid storing secret material in org tables.
  5. Validate query output before passing it into strict action schemas.
  6. Emit clear logs when a query returns no rows or too many rows.
Ask a question... ⌘I