Skip to content

technofocus-pte/ignite25-LAB515

Β 
Β 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

57 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

decorative banner

πŸ”₯LAB515: Build advanced AI Agents with PostgreSQL

🧠 Session Description

In this hands-on lab, you’ll build an AI-powered legal research assistant that reasons over real-world case law data using PostgreSQL and Microsoft Agent Framework. You’ll learn how to combine retrieval-augmented generation (RAG), vector search, and graph intelligence to develop an agentic workflow capable of generating accurate, contextual, and explainable answers β€” all running on Azure Database for PostgreSQL.

πŸ’‘ Learning Outcomes

By the end of this lab, you will be able to:

  • Configure Azure Database for PostgreSQL Flexible Server with AI extensions (azure_ai, pgvector, diskann, and apache_age)
  • Use Microsoft Agent Framework to build autonomous agents with database and web plugins
  • Implement semantic search and reranking using vector embeddings
  • Enhance reasoning quality using the GraphRAG pattern
  • Deploy your AI agent and supporting infrastructure on Azure using Bicep and CLI automation

πŸ’» Technologies Used

  1. Azure Database for PostgreSQL Flexible Server (with AI extensions)
  2. Microsoft Agent Framework (for agent orchestration)
  3. Azure OpenAI Service (embeddings + LLM completions)
  4. Python (agent runtime and notebook execution)
  5. Apache AGE (for graph storage and reasoning)
  6. DiskANN (for fast approximate vector similarity search)
  7. VS Code PostgreSQL Extension (for hands-on queries and debugging)

πŸ—οΈ Architecture

 User Query β†’ Microsoft Agent Framework β†’ PostgreSQL (Vector + Graph + AI) β†’ Azure OpenAI β†’ Contextual Answer

Architecture

  • Microsoft Agent Framework: Handles reasoning, plugin invocation, and dialogue context.
  • PostgreSQL: Stores case law data, embeddings, and graph relationships.
  • GraphRAG: Uses Apache AGE to connect related entities and improve recall.
  • Azure OpenAI: Powers embeddings and completion for semantic responses.

Lab Sections

  1. Setup Azure PostgreSQL Database:

    • Database connection and configuration
    • Install the azure_ai extension
    • Configure Azure OpenAI connectivity
  2. Using AI-driven features in PostgreSQL:

    • Pattern matching queries
    • Semantic vector search using embeddings
    • DiskANN indexing for fast vector similarity search
  3. Building the Agent Application:

    • Setting up Microsoft Agent Framework
    • Creating database search plugins
    • Implementing semantic reranking
    • Adding external data sources
    • Testing and improving the agent

πŸ“˜ Lab Structure

Folder Description
Code/ Core Jupyter notebooks and sample scripts
Dataset/ Sample dataset (cases.csv) for legal research queries
Scripts/ Source code for agents, plugins, and database connectors
Docs/ Step-by-step lab manual and architecture guide
Docs/images Architecture and concept diagrams
infra/ Deployment templates (Bicep + PowerShell scripts)

πŸš€ Getting Started

1️⃣ Setup Environment

  • Ensure you have an Azure subscription with access to Azure OpenAI.
  • Install required CLI tools:
azd auth login
azd env new
azd provision

This will deploy the Azure resources (PostgreSQL + OpenAI) and generate a .env file containing connection details.

2️⃣ Configure Database

Use the provided scripts in Scripts/ to: - Initialize tables and vector indexes - Load the sample case law dataset - Enable azure_ai, pgvector, and apache_age extensions

3️⃣ Run the Lab Notebook

Open Code/lab.ipynb in Visual Studio Code and follow the guided steps to:

  • Connect to your database
  • Generate embeddings
  • Execute semantic and graph-based queries
  • Interact with your AI Agent

πŸ“š Resources and Next Steps

Resource Link Description
Ignite 2025 Next Steps https://aka.ms/Ignite25-Next-Steps Links to all repos for Ignite 2025 Sessions
Learn at Ignite https://aka.ms/LearnAtIgnite Continue learning on Microsoft Learn
GraphRAG for PostgreSQL https://aka.ms/pg-graphrag Learn how to add graph intelligence to Postgres
VS Code PostgreSQL Extension https://aka.ms/pgsql-vscode Learn more about the PostgreSQL extension

Content Owners

Varun Dhawan
Varun Dhawan

πŸ“’
Jonathon Frost
Jonathon Frost

πŸ“’
Jared Meade
Jared Meade

πŸ“’
Gauri Kasar
Gauri Kasar

πŸ“’

πŸš€ Try Azure for Free!

Ready to build, experiment, or scale your next project? Kick things off with an Azure Free Trial and get access to popular services, generous monthly credits, and the tools you need to ship fast. πŸ‘‰ Start your free journey here: https://aka.ms/devrelft

Contributing

This project welcomes contributions and suggestions. Most contributions require you to agree to a Contributor License Agreement (CLA) declaring that you have the right to, and actually do, grant us the rights to use your contribution. For details, visit Contributor License Agreements.

When you submit a pull request, a CLA bot will automatically determine whether you need to provide a CLA and decorate the PR appropriately (e.g., status check, comment). Simply follow the instructions provided by the bot. You will only need to do this once across all repos using our CLA.

This project has adopted the Microsoft Open Source Code of Conduct. For more information see the Code of Conduct FAQ or contact opencode@microsoft.com with any additional questions or comments.

This project may contain trademarks or logos for projects, products, or services. Authorized use of Microsoft trademarks or logos is subject to and must follow Microsoft's Trademark & Brand Guidelines. Use of Microsoft trademarks or logos in modified versions of this project must not cause confusion or imply Microsoft sponsorship. Any use of third-party trademarks or logos are subject to those third-party's policies.

About

ignite25-LAB515-build-advanced-ai-agents-with-postgresql

Resources

License

Code of conduct

Security policy

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • Jupyter Notebook 64.7%
  • PowerShell 29.2%
  • Bicep 4.3%
  • PLpgSQL 1.4%
  • Shell 0.4%