Home/Expertise
Agentic AI
Agents that have a tool contract: natural language to SQL with schema checks and a self-correction loop, plus early evaluation of on-device agent models. Written from shipped work by Muhammad Huzaifa Shahbaz, AI Systems Engineer at Digital Dividend Global.
What I build
- Natural-language interfaces that compile to a constrained action, such as a read-only SQL query, instead of an open-ended chat reply.
- Evaluation of small on-device models (including FunctionGemma) for agentic workflows on IoT hardware. That evaluation is in progress, not a shipped product claim.
Architecture
- The SQL agent treats query generation as a compile step. Pydantic checks the shape of the output before anything runs.
- If execution fails or returns an empty result, the error goes back into the context and the agent retries. That reflection loop is the reliability mechanism.
- Permissions stay read-only. The prompt receives only the tables relevant to the question, which keeps the schema small.
- Responses are structured JSON: the SQL and the interpreted rows, so a dashboard can render them without parsing prose.
Production constraints
- Hallucinated table names and SQL injection are the same class of bug. Schema validation plus a read-only role is the control.
- Stuffing the full database catalog into the prompt raises latency and token cost. The agent selects tables from the user's intent first.
Stack
Python · LangChain · Pydantic · PostgreSQL · OpenAI · Gemini
Tradeoffs
- A compile-and-check agent is slower than one-shot SQL generation and much safer to put in front of a real database.
- On-device models such as FunctionGemma are being evaluated for IoT because a cloud round-trip is the wrong dependency for that hardware. They are not a replacement for the hosted SQL agent.
Projects
- SQL AI Agent — Natural language to SQL with schema validation and a retry loop.
External verification
Questions
What agent has he built that is more than a chatbot?
The SQL AI Agent turns a question into validated, read-only SQL, retries when execution fails, and returns structured JSON.
Is FunctionGemma in production?
No. It is under evaluation for agentic workflows on IoT hardware, alongside quantized PyTorch and Ollama prototypes.