This is the starter project for Challenge 11 - Build Agentic RAG with Azure AI Search (Python version).
- Python 3.8 or higher
- Azure AI Search service (Standard tier or higher)
- Azure OpenAI service with deployed models:
- Chat completion model (e.g.,
gpt-4.1) - Embedding model (e.g.,
text-embedding-3-large)
- Chat completion model (e.g.,
-
Create a Python virtual environment, activate and install dependencies:
pip install -r requirements.txt --pre # or # uv pip install -r requirements.txt --pre # if using uv (highly recommended for performance) # https://docs.astral.sh/uv/
-
Configure the application:
- Copy
.env.sampleto.envand update it with your Azure service credentials - Fill in the following values:
- Azure OpenAI endpoint and API key
- Azure OpenAI deployment names and models
- Azure AI Search endpoint and search key
- Index name, knowledge source name, and knowledge agent name
- Copy
-
Configure permissions (required for agentic retrieval):
- Enable RBAC on your Azure AI Search service
- Enable system-assigned managed identity on the Search service
- Assign these roles to yourself:
Search Service ContributorSearch Index Data ContributorSearch Index Data Reader
- Assign
Cognitive Services OpenAI Userrole to the Search service's managed identity
Complete the implementation in the register_agentic_search() method in agentic_rag.py:
-
Create a search index with:
- Document fields (id, page_chunk, page_embedding_text_3_large, page_number)
- Vector search configuration
- Semantic search configuration
-
Upload NASA "Earth at Night" data to the index
-
Create a knowledge source that references the index
-
Create a knowledge agent that connects Azure OpenAI with the knowledge source
python agentic_rag.pyThe application will:
- Set up the agentic search components (once you complete the implementation)
- Start an interactive chat session
- Clean up resources when you exit
python/
├── agentic_rag.py # Main application file
├── .env.sample # Environment variables template (copy to .env)
├── requirements.txt # Python dependencies
└── README.md # This file
- Refer to the Challenge 11 challenge document for detailed implementation guidance
- Use the Azure AI Search Python SDK documentation for API reference
- The conversational interface is already implemented - focus on the retrieval components
- Test your implementation with various question types to observe agentic behavior