Side project · AI agent · 2026

An AI agent for the energy market

When a household switches its electricity supplier, companies have 24 hours and a 230-page rulebook. My agent answers questions from that rulebook with a source, calculates the deadlines and checks how far a switch has got.

Correct answers
86-90%
Rulebook
231 pages
Test questions
29
Tools
3
Prototype
2 days
Automated tests
103

How it works

The model decides, the tools know the facts

The agent reads a question, picks the tool it needs, checks the result and only then answers. Facts come from tools, never from the model’s memory.

Mistral (EU) or local model Question e.g. a deadline over Christmas Agent picks a tool answers only with a result at most 6 steps Answer with source and page tool call ↓ result ↑ Search the rulebook 231 pages from the regulator meaning + exact terms Calculate a deadline 16 rules, German working days holidays of all 16 states Look up a switch status of a request test data, ID check digit
Every step is logged, so each answer can be traced back to the tool results behind it.

Results

Measured, not guessed

29 test questions with known answers, checked automatically – including whether the agent invents a date that no tool returned.

correct answers s / question 0 25 50 75 100% Mistral API, EU 86-90% 1.8 Same model, on a laptop 79% 13.8 qwen3 14B, local 72% 24.3 qwen3 8B, local 59% 12.6 … without guardrail 41% the guardrail lifts it to 59% ↑ 10.8
Same weights, different result: the API version is about 10 points better and 7× faster than the 4-bit model on a 16 GB laptop – a trade-off between data protection and quality.

Challenges

What was hard, and how I solved it

01

AI is bad at dates

Deadlines depend on working days, holidays in every state and even 24 and 31 December. Code calculates them from the official rules; the model only picks the rule and explains it.

  • Rule table
  • Working-day calendar
02

Is the answer right?

29 test questions with known answers, checked on every change. The check also catches answers that restate a correct result wrongly, such as a wrong weekday.

  • Golden questions
  • pytest
03

Local models skipped the tools

They answered from memory. A guardrail now rejects answers without a tool result: 41% → 59% for the weakest model.

  • Guardrail
  • Ollama
04

Same model, different result

On the laptop the same model scores 79% instead of 86-90%. Not a bug but a trade-off between keeping data local and quality – the numbers make it a clear conversation.

  • Mistral (EU)
  • Local models

Still open

What I would do next


Live demo

Every step on screen

The demo shows each tool call with its arguments and result before the answer. It runs from my laptop and is password-protected; its interface is in German, like the people who would use it.

Demo page: the agent calls calculate_deadline for a registration sent on 23 December, skips the Christmas holidays and answers: 28 December 2026, 11:00, with its source.
Question: when must the grid operator reject a registration sent on 23 December? The tool skips 24-27 December; the answer: Monday 28 December, 11:00, with section and page.

Toolkit

Built with

Want to see it live? I’ll show you the demo in a call.