Dumitru Preguza
02/16/2026, 1:12 PMDumitru Preguza
02/16/2026, 1:21 PM@JsonTypeInfo(use = JsonTypeInfo.Id.NAME, property = "filterType")
@JsonSubTypes( {
@JsonSubTypes.Type(value = NumberColumnFilter.class, name = "number"),
@JsonSubTypes.Type(value = StringColumnFilter.class, name = "text"),
@JsonSubTypes.Type(value = DateTimeColumnFilter.class, name = "datetime"),
@JsonSubTypes.Type(value = DateColumnFilter.class, name = "date"),
@JsonSubTypes.Type(value = BooleanColumnFilter.class, name = "bool"),
@JsonSubTypes.Type(value = EnumColumnFilter.class, name = "enum"),
@JsonSubTypes.Type(value = MultiEnumColumnFilter.class, name = "multienum")
})
@Data
@NoArgsConstructor(force = true, access = AccessLevel.PROTECTED)
@AllArgsConstructor
public abstract class ColumnFilter implements Serializable {
@Nonnull
protected GridOperandType type;
private ColumnDataType dataType;
public abstract Bson toMongoFilter(String field);
}Dumitru Preguza
02/16/2026, 1:22 PMDumitru Preguza
02/16/2026, 1:27 PMDumitru Preguza
02/16/2026, 1:32 PMDumitru Preguza
02/16/2026, 3:27 PMJakub Amanowicz
02/16/2026, 8:12 PMDataGridQuery that would be composed from Filter and Sort types that you already provided. See https://docs.koog.ai/structured-output/#defining-data-structures from our docs you mentioned before (you might like to use https://docs.koog.ai/structured-output/#nested-classes for your case).
Once you define the model for your request, you want to be able to create it from plain String. I assume your flow starts off with user prompt like "Give me entries where column_a contains 'foo' and sort by column_b descending". We want to convert this String into DataGridQuery - this is where you would actually delegate some work to LLM.
There are couple of ways to do that in Koog - see https://docs.koog.ai/structured-output/#requesting-structured-responses - which one you choose depends on your application's logic and needs.
I personally like graph based scenarios so let me suggest that for you to experiment with. To do that, define your String -> DataGridQuery conversion logic with node layer (you might want to use nodeLLMRequestStructured - it's made exactly for such cases). See this https://docs.koog.ai/structured-output/#layer-3-node-layer. You will end up creating a node that converts String to DataGridQuery with help of LLM.
I imagine that you want to use your DataGridQuery now - to do that just define another node that accepts DataGridQuery and does something with it. Then you connect your nodes with an edge, effectively forming a graph. You can now expand your application logic by just growing your graph :)
See this example of banking application that utilizes this approach: https://docs.koog.ai/examples/Banking/#building-an-agent-with-graph
In your specific case, I would also consider creating a dedicated Tool for querying a grid. Calling a tool might be a better idea for this than just executing a prompt on LLM.
See Money Tools from the example above and check out our docs here: https://docs.koog.ai/tools-overview/Dumitru Preguza
02/16/2026, 10:39 PMval agentStrategy = strategy("weather-forecast") {
val setup by node<Unit, String> { _ ->
"Please provide a weather forecast for Amsterdam"
}
// Create a structured output node using delegate syntax
val getWeatherForecast by nodeLLMRequestStructured<WeatherForecast>(
name = "forecast-node",
examples = exampleForecasts,
fixingParser = StructureFixingParser(
model = OpenAIModels.Chat.GPT4o,
retries = 3
)
)
val processResult by node<Result<StructuredResponse<WeatherForecast>>, String> { result ->
when {
result.isSuccess -> {
val forecast = result.getOrNull()?.data
"Weather forecast: $forecast"
}
result.isFailure -> {
"Failed to get structured forecast: ${result.exceptionOrNull()?.message}"
}
else -> "Unknown result state"
}
}
edge(nodeStart forwardTo setup)
edge(setup forwardTo getWeatherForecast)
edge(getWeatherForecast forwardTo processResult)
edge(processResult forwardTo nodeFinish)
}Dumitru Preguza
02/17/2026, 5:29 PM@property:LLMDescription("Type of request: Transfer or Analytics")
val requestType: RequestType
Works at class level as well, not only fields
However SpringAI is able to understand the jackson annotations at least, for example JsonPropertyDescription:
@JsonPropertyDescription("For reference only (e.g., 'NUMBER', 'INTEGER', 'DECIMAL', etc.)")
@JsonProperty("dataType")
String dataType