Aggregate Rows
data.aggregate
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
Non-goals
- Does not run SQL
- Does not join tables
- Does not filter rows
Properties
Capabilities
Cost & billing
Flat rate per invocation
File handling
How we handle your data
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.
Input schema
| Field | Type | Required | Description |
|---|---|---|---|
| rows | array | Yes | Bounded array of 0 through 100000 input row objects keyed by column name, where missing keys count as null. |
| groupBy | array | No | Bounded array of column names to group on; omit it for a single all-rows group. |
| aggregations | array | Yes | Bounded array of 1 through 100 closed measures with unique output names. |
| nullPolicy | string | No | How numeric measures treat nulls; omit it for ignore. |
Output schema
| Field | Type | Required | Description |
|---|---|---|---|
| ok | boolean | Yes | True when aggregation completed successfully. |
| rows | array | Yes | Bounded array of 0 through 100000 result row objects keyed by column name after this skill transformed the table. |
| groupCount | integer | Yes | How many groups were returned. |
API contract
POST /v1/executecurl -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"}]}}'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
| Code | HTTP | Retryable | Description |
|---|---|---|---|
| VALIDATION_ERROR | 400 | No | The request payload failed schema validation. |
| UNAUTHORIZED | 401 | No | Missing or invalid API key. |
| SKILL_NOT_ACCESSIBLE | 403 | No | The API key is not granted access to this skill. |
| SKILL_NOT_AVAILABLE_FOR_PLAN | 403 | No | This skill is not included in your current plan. |
| PLAN_ELIGIBILITY_UNAVAILABLE | 503 | Yes | Plan eligibility could not be decided. Retry after backoff. |
| SKILL_NOT_FOUND | 404 | No | The requested skill or version does not exist. |
| TENANT_RATE_LIMITED | 429 | Yes | Request rate limit exceeded. Retry after backoff. |
| QUOTA_EXCEEDED | 429 | Yes | Plan quota exhausted. Retryable once the quota period resets. |
| EXECUTION_TIMEOUT | 504 | Yes | Execution exceeded the allowed time budget. |
Other limits
| Limit | Value |
|---|---|
| Recommended inline bytes | 32 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)
{
"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
{
"rows": [
{
"c": "BE",
"amt": 10
},
{
"c": "BE",
"amt": 5
}
],
"aggregations": [
{
"field": "amt",
"op": "sum",
"as": "total"
}
],
"groupBy": [
"c"
]
}{
"groupCount": 1,
"rows": [
{
"c": "BE",
"total": 15
}
],
"ok": true
}Count rows without grouping
{
"aggregations": [
{
"as": "n",
"op": "count"
}
],
"rows": [
{
"a": 1
},
{
"a": 2
}
]
}{
"groupCount": 1,
"rows": [
{
"n": 2
}
],
"ok": true
}Recommended use cases
- Summaries without a database
- Group totals and distinct counts
- Ad-hoc rollups in agent pipelines
Avoid for
- Streaming or unbounded aggregation
- Database-scale analytics
Related skills
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.