Skip to main content

Squillify development is paused indefinitely. Read why, and discover what this experiment achieved. Read the story

MicroSkills Reference

Aggregate Rows

data.aggregate

ProductionBounded custom (Class B)Deterministicstrictfastv1.0.0
No network

Overview

When you send row objects and an aggregation spec, we group by the fields you name and compute count, count_distinct, sum, avg, min, max, median, or stddev deterministically. Groups are ordered stably; null handling follows your nullPolicy. Do not use this for SQL, streaming unbounded data, or joins.

Grouped summaries should be deterministic and inspectable, not guessed by an LLM.

Reliability

Same rows and same spec give byte-identical output, groups included. Numbers are added in double-precision floating point, so a long column of decimals can end in the usual 0.1 + 0.2 rounding tail — round on your side before display, or use data.validate_totals when exact decimal arithmetic matters. stddev is the population standard deviation, dividing by the number of values rather than by one less. median is the platform percentile convention at p=50 — linear interpolation between order statistics — which for even counts is the mean of the two central values and for odd counts the central value, so it agrees with p50 anywhere else on the platform. sum, avg and stddev accumulate over the values in ascending order rather than the order you sent them, so a long column of decimals gives the same answer however your rows were sorted. A value that parses as NaN or Infinity is refused rather than measured: it used to sort above every real number and silently become the maximum and the median. Nothing here is retryable with the same payload: we stop the call when aggregations is missing or empty, holds more than 100 measures, names an op we do not know, reuses an as name, omits field for an op other than count, meets a value that is not a number or is not finite, or meets a null while nullPolicy is error. Fix the rows or the spec and call again.

Context footprint

Returns one row per group plus groupCount; max 100000 input rows. A successful call costs 1 execution credit.

When to use it

When you have row objects and need grouped totals, averages, or counts.

When you need SQL, joins, or datasets beyond 100000 rows.

Scope

Note
Deterministic group-by aggregation over in-memory row objects.

Non-goals

  • Does not run SQL
  • Does not join tables
  • Does not filter rows

Properties

IdempotentRetry safeStreaming supportedFile input supportedRequires external service

Capabilities

analysisdata-transformation

Cost & billing

Flat rate per invocation

MetercallsBillable onsuccessCost per call1 credit

File handling

Accepts file_refProduces file_refMax input97.7 KB

How we handle your data

Sensitive output possible
What this means

This skill may receive sensitive content and may return submitted, transformed, extracted, or reformatted content.

Squillify guarantees
  • Runs inside Squillify
  • This skill runs inside Squillify.
  • Payloads are not sent to an external service by this skill.
  • Squillify does not permanently store submitted payloads.
  • Telemetry records metadata only, not submitted content.
  • Submitted payloads are not used for training.
  • Submitted payloads are not reviewed by humans.
  • This skill does not target sensitive data.
  • The response may contain submitted or transformed content.
Your responsibility

Squillify does not determine whether submitted content is sensitive. Your application is responsible for deciding what data it is allowed to submit. Your application is responsible for securing the response.

Read the Microskill Data Handling Policy

Input schema

FieldTypeRequiredDescription
rowsarrayYesBounded array of 0 through 100000 input row objects keyed by column name, where missing keys count as null.
groupByarrayNoBounded array of column names to group on; omit it for a single all-rows group.
aggregationsarrayYesBounded array of 1 through 100 closed measures with unique output names.
nullPolicystringNoHow numeric measures treat nulls; omit it for ignore.

Output schema

FieldTypeRequiredDescription
okbooleanYesTrue when aggregation completed successfully.
rowsarrayYesBounded array of 0 through 100000 result row objects keyed by column name after this skill transformed the table.
groupCountintegerYesHow many groups were returned.

API contract

POST /v1/execute
curl
curl -sS -X POST "$BASE/v1/execute" -H "Authorization: Bearer $KEY" -H 'Content-Type: application/json' -d '{"skillKey":"data.aggregate","input":{"rows":[{"c":"BE","amt":10}],"groupBy":["c"],"aggregations":[{"field":"amt","op":"sum","as":"total"}]}}'
Integrations
TypeScript SDK
import { Squillify } from "@squillify/sdk";

const sq = new Squillify({ apiKey: process.env.SQUILLIFY_API_KEY });

const { output } = await sq.execute("data.aggregate", {"rows":[{"c":"BE","amt":10},{"c":"BE","amt":5}],"aggregations":[{"field":"amt","op":"sum","as":"total"}],"groupBy":["c"]});

Errors

CodeHTTPRetryableDescription
VALIDATION_ERROR400NoThe request payload failed schema validation.
UNAUTHORIZED401NoMissing or invalid API key.
SKILL_NOT_ACCESSIBLE403NoThe API key is not granted access to this skill.
SKILL_NOT_AVAILABLE_FOR_PLAN403NoThis skill is not included in your current plan.
PLAN_ELIGIBILITY_UNAVAILABLE503YesPlan eligibility could not be decided. Retry after backoff.
SKILL_NOT_FOUND404NoThe requested skill or version does not exist.
TENANT_RATE_LIMITED429YesRequest rate limit exceeded. Retry after backoff.
QUOTA_EXCEEDED429YesPlan quota exhausted. Retryable once the quota period resets.
EXECUTION_TIMEOUT504YesExecution exceeded the allowed time budget.

Other limits

LimitValue
Recommended inline bytes32 KiB

Limitations

  • Does not run SQL
  • Does not join tables
  • Does not filter rows
  • Streaming or unbounded aggregation
  • Database-scale analytics

How to call

POST /v1/execute (requires authentication)

Request bodyjson
{
  "skillKey": "data.aggregate",
  "input": {
    "rows": [
      {
        "c": "BE",
        "amt": 10
      },
      {
        "c": "BE",
        "amt": 5
      }
    ],
    "aggregations": [
      {
        "field": "amt",
        "op": "sum",
        "as": "total"
      }
    ],
    "groupBy": [
      "c"
    ]
  }
}

Examples

Sum amount by country

Inputjson
{
  "rows": [
    {
      "c": "BE",
      "amt": 10
    },
    {
      "c": "BE",
      "amt": 5
    }
  ],
  "aggregations": [
    {
      "field": "amt",
      "op": "sum",
      "as": "total"
    }
  ],
  "groupBy": [
    "c"
  ]
}
Expected outputjson
{
  "groupCount": 1,
  "rows": [
    {
      "c": "BE",
      "total": 15
    }
  ],
  "ok": true
}

Count rows without grouping

Inputjson
{
  "aggregations": [
    {
      "as": "n",
      "op": "count"
    }
  ],
  "rows": [
    {
      "a": 1
    },
    {
      "a": 2
    }
  ]
}
Expected outputjson
{
  "groupCount": 1,
  "rows": [
    {
      "n": 2
    }
  ],
  "ok": true
}
  • Summaries without a database
  • Group totals and distinct counts
  • Ad-hoc rollups in agent pipelines

Avoid for

  • Streaming or unbounded aggregation
  • Database-scale analytics

Composable with

Safety & privacy

  • Runs without calling any external service.
  • Your payloads are never stored permanently.
  • Telemetry captures metadata only — never your payload contents.
  • We never train models on your payloads.
  • No human reviews your payloads.

Tags

aggregatestatisticsdata