How it works

1. A message arrives in the Microsoft Teams bot. 2. The AI Agent reads the question, using its chat memory for context. 3. The agent can list the tables and columns of the database to understand the schema. 4. The agent writes a SQL query and runs it through the PostgreSQL connection, then turns the rows into a plain answer. 5. The answer is posted back as a reply in the same Teams conversation.