Sandbox (v2, Beta)

There's a live, read-only v2 sandbox you can query right now — no signup, no keys of your own. It's the public aito-demo grocery/invoicing dataset loaded as native CollectionDb (rep2) tables, served from a branched environment so it sits alongside the production rep1 demo without touching it.

  • Base URL: https://shared.aito.ai/db/aito-demo/env/v2/api/v2/
  • Read key: yg4rTlXkqDzm4y8gPeY75HCKaNwfbTQ2si64ONTi (public, read-only — predict/recommend/query work, writes return 401)

Prefer clicking to curl? The Playground runs these same queries against this env right in your browser.

The sandbox runs a pre-release rep2 build; every endpoint below is verified against it. $search full-text, $why explanations, $has array membership, and _relate itemset mining are all live. Only the vector operators ($nearest / $semantic / $cluster) are unavailable here — aito-demo has no Vector column — as noted at the end.

What's loaded

Ten linked collections (the same entities as the production demo):

TableRowsTableRows
users67prompts350
products42answers50
visits733employees10
contexts5,290glCodes10
impressions90,325invoices101

products carries name (Text/English), price/cost (Decimal), tags (String[]), and category; invoices link to employees and glCodes; impressions link a context to a product with a purchase boolean.

Query

A _query filters and projects rows — the same from / where / select you'd use as evidence for inference.

curl -X POST \
  'https://shared.aito.ai/db/aito-demo/env/v2/api/v2/_query' \
  -H 'x-api-key: yg4rTlXkqDzm4y8gPeY75HCKaNwfbTQ2si64ONTi' \
  -H 'Content-Type: application/json' \
  -d '{ "from": "products", "where": { "name": { "$match": "milk" } },
        "limit": 2, "select": ["name", "price"] }'
{ "offset": 0, "total": 6, "hits": [
  { "name": "Pirkka Finnish semi-skimmed milk 1l", "price": 0.81 },
  { "name": "Pirkka Finnish nonfat milk 1l",        "price": 0.75 } ] }

$match matches all tokens of a Text column. Full-text $search — phrases, OR / NOT, grouping — is live too, e.g. "name": { "$search": "(milk OR bread) AND NOT chocolate" } (see the Query Reference).

Predict

_predict ranks the values of a field by probability, conditioned on the evidence in where. Two demo use cases:

Smart search — guess a product's category from its name:

curl -X POST \
  'https://shared.aito.ai/db/aito-demo/env/v2/api/v2/_predict' \
  -H 'x-api-key: yg4rTlXkqDzm4y8gPeY75HCKaNwfbTQ2si64ONTi' \
  -H 'Content-Type: application/json' \
  -d '{ "from": "products", "where": { "name": { "$match": "milk" } },
        "predict": "category", "limit": 2, "select": ["$value", "$p"] }'
{ "offset": 0, "total": 11, "hits": [
  { "$p": 0.738, "$value": "104" },
  { "$p": 0.140, "$value": "109" } ] }

Invoice automation — route an invoice to a GL code from its text:

curl -X POST \
  'https://shared.aito.ai/db/aito-demo/env/v2/api/v2/_predict' \
  -H 'x-api-key: yg4rTlXkqDzm4y8gPeY75HCKaNwfbTQ2si64ONTi' \
  -H 'Content-Type: application/json' \
  -d '{ "from": "invoices", "where": { "ProductName": "Office supplies" },
        "predict": "GLCode", "limit": 2, "select": ["$value", "$p"] }'
{ "offset": 0, "total": 4, "hits": [
  { "$p": 0.486, "$value": "R001" },
  { "$p": 0.200, "$value": "E001" } ] }

The same call accepts "select": ["$value", "$p", "$why"] to return the factor tree behind each probability — base rate, calibration, and the lift each piece of evidence contributes (see Inference). $why is live on this sandbox.

Recommend

_recommend ranks candidates to best achieve a goal. Here: which product to surface so an impression ends in a purchase.

curl -X POST \
  'https://shared.aito.ai/db/aito-demo/env/v2/api/v2/_recommend' \
  -H 'x-api-key: yg4rTlXkqDzm4y8gPeY75HCKaNwfbTQ2si64ONTi' \
  -H 'Content-Type: application/json' \
  -d '{ "from": "impressions", "recommend": "product",
        "goal": { "purchase": true }, "limit": 2, "select": ["$value", "$p"] }'
{ "offset": 0, "total": 42, "hits": [
  { "$p": 0.143, "$value": "6414880021620" },
  { "$p": 0.114, "$value": "2000818700008" } ] }

Derived fields with let

let computes fields inline — no join, no precomputation. Here, each product's margin from its stored price and cost, ranked highest first:

curl -X POST \
  'https://shared.aito.ai/db/aito-demo/env/v2/api/v2/_query' \
  -H 'x-api-key: yg4rTlXkqDzm4y8gPeY75HCKaNwfbTQ2si64ONTi' \
  -H 'Content-Type: application/json' \
  -d '{ "from": "products",
        "let": { "margin": { "$subtract": ["price", "cost"] } },
        "select": ["name", "price", "cost", "margin"],
        "orderBy": { "$desc": "margin" }, "limit": 3 }'

Each hit carries the derived margin (price − cost) beside the stored fields, and the rows come back highest-margin first. See Query Reference → Derived fields.

Feature similarity with $knn

$knn ranks rows by feature similarity to an exemplar — no vectors needed. On a Text field it scores by BM25, so this ranks the products closest to a "semi-skimmed milk" description:

curl -X POST \
  'https://shared.aito.ai/db/aito-demo/env/v2/api/v2/_query' \
  -H 'x-api-key: yg4rTlXkqDzm4y8gPeY75HCKaNwfbTQ2si64ONTi' \
  -H 'Content-Type: application/json' \
  -d '{ "from": "products",
        "where": { "$knn": { "near": { "name": "semi-skimmed milk" } } },
        "select": ["name", "$similarity"], "limit": 3 }'
{ "offset": 0, "total": 4, "hits": [
  { "$similarity": 6.65, "name": "Valio semi-skimmed milk 1l" },
  { "$similarity": 6.17, "name": "Pirkka Finnish semi-skimmed milk 1l" },
  { "$similarity": 5.40, "name": "Pirkka lactose-free semi-skimmed milk drink 1l" } ] }

The nearest products come back ordered by $similarity. On a Text field $knn scores the rows that carry the query's tokens — a term that appears in no row (e.g. "organic", absent from this catalog) drops the candidate set to empty, so pick exemplar words that occur in the data. See Query Reference → Feature-based nearest rows.

The $nearest / $cluster / $semantic vector operators need a Vector column; aito-demo has none, so those aren't runnable on this sandbox yet.

Build your own

The sandbox is created from a script in the aito-demo repo — branch a v2 env, declare the collections, and load the data:

# in aito-demo/, with a read-write key in .env
AITO_URL=https://your-instance.aito.ai/db/your-db \
AITO_API_KEY=<read-write-key> \
node upload-data-v2.js

It creates the env (POST /api/v2/_envs with { "name": "v2", "basedOn": "env.master" }), defines each "type": "collection" table, and batch-loads the data under /env/v2/api/v2/.... See CollectionDb for the ingest endpoints and Schema Design for the type system.