What are Aggregates?
Aggregates in AveniECA combine multiple ESS (Experience-State-Score) records from different modules into a single composite state vector. This allows you to represent complex multi-dimensional states as a unified entity for prediction and analysis. An aggregate ESS contains:- A concatenated state vector from all component ESS
- Metadata about each component (module_id, valence, score, etc.)
- Computed aggregate statistics (averages, totals)
Aggregate Fields in ESSInsert
When creating an aggregate, you’ll use these special fields in theESSInsert model:
Key Fields Explained
Concatenated state vectors from all component ESS in order
Database IDs of the component ESS records
Module IDs corresponding to each component ESS
Length of each component’s state vector, used to reconstruct individual states
Average valence calculated from all component ESS
Sum of all component ESS scores
Creating Aggregates from Multiple ESS
Here’s a complete example showing how to create an aggregate from multiple ESS records:Aggregate Validation and Errors
The AveniECA API validates aggregates during creation and update. If validation fails, you’ll receive anAggregateError response:
Common Validation Errors
Field Length Errors
Field Length Errors
All aggregate arrays (
aggregate_id, aggregate_valence, aggregate_score, etc.) must have the same length. Each index represents one component ESS.Invalid ESS DB IDs
Invalid ESS DB IDs
The ESS IDs in
aggregate_id must reference existing ESS records in the database.ESS Mismatch
ESS Mismatch
The data in aggregate fields must match the actual ESS records referenced by
aggregate_id.Incorrect Calculations
Incorrect Calculations
The
avg_ess_score, avg_ess_valence, and total_ess_score must be calculated correctly from component values.Retrieving Aggregates
You can query which aggregates contain a specific ESS:Next Steps
Predictions
Use aggregates with Cortex for multi-dimensional predictions
Best Practices
Learn production patterns for aggregate design