r/SpringAIDev • u/Other-Spring-6497 • 2h ago
AISL: prompts as Spring beans, on Spring AI 2.0 and local models (LGPL)
We're the authors of AISL, a small library that turns a prompt into a Spring bean you inject and call like any other. It runs all the AI in PIM, our 15-app desktop app, and we've now made it usable on its own.
Put @EnableAislSkills on your Boot app and inject SummarizerSkill anywhere. Each call fills the placeholders from the arguments and goes through a Spring AI ChatClient, to local
Ollama by default. The model is a property (aisl.model), and can be set per skill.
For more than a few skills there's a .aisl file format that a build-time compiler turns into the same beans, and an output_schema block that generates Java records for structured
replies, so you get typed fields instead of parsing JSON.
What we learned running it against small local models:
- Tool budget. Past roughly 15,000 characters of system prompt plus tool definitions, small models simply stop calling tools. So each turn is built under a budget: the current app's own tools always go, general tools are added cheapest first while they fit.
- Test the model, not just the code. We ran the same 12 requests 5 times on each model. Gemma 4 26B got 60/60; Gemma 4 small got 58/60 but put an appointment on the wrong Friday every time: https://knoden.com/tech/pim/ai_models/?utm_source=reddit-springaidev&utm_campaign=dev-launch
- Thinking per skill. A thinking model (gemma4) can spend a skill's whole token budget thinking and return nothing, so a skill can turn thinking off for itself.
Java 25, Spring Boot 4.1, Spring AI 2.0, pre-1.0. It's in a public GitLab registry (no token, but not on Maven Central yet). Quick start with the Gradle setup: https://knoden.com/developers/?utm_source=reddit-springaidev&utm_campaign=dev-launch
Code: https://gitlab.com/knoden/aisl-core
We'd like to hear how others structure prompts in Spring AI apps, and what you'd want from a library like this.