A language model should not receive unrestricted SQL and a writable database connection. Build a narrow Python tool that checks an energy-summary request, runs fixed parameterized queries through read-only SQLite, and returns a small JSON-ready result.
July 22, 2026 in Python, Generative AI by Mehdi Lotfinejad11 minutes
Even when the model names the correct function and supplies valid arguments, the attempted operation can fail. Build a small Python retry boundary that separates temporary failures from permanent ones, respects server delays, limits repeated work, and refuses to repeat an unsafe write.
July 22, 2026 in Python, Generative AI by Mehdi Lotfinejad11 minutes
Turn saved agent tool events into an inspectable regression test. Define five workflow contracts, compare each trace with reviewed expectations, preserve individual failure signals, and diagnose unsafe intermediate actions even when a run appears to finish.
July 22, 2026 in Python, Machine Learning by Mehdi Lotfinejad12 minutes