< Home - Creating Your First Agent >
In this Module, you'll deploy the Azure Services needed to run this workshop and get your local environment configured and ready. You will also learn about the structure of this workshop and get an overview of Multi-Agent Systems.
This workshop covers the complete journey from basic multi-agent systems to advanced architectural patterns using the Model Context Protocol (MCP) in Module 06.
- Begin the deployment of the Azure Services
- Learn the structure and get an overview of this workshop
- Explore the core principals of multi-agent systems
- Complete the configuration of your local environment
- Compile and run the starter solution locally
- Activity 1: Configure Workshop Environment
- Activity 2: Deploy Azure Services
- Activity 3: Workshop Structure and Overview Session
- Activity 4: Configure Environment Variables
- Activity 5: Compile and Run
Note: This module prepares your environment for the complete workshop, including the advanced Module 6 covering Model Context Protocol (MCP) architectural patterns.
Complete the following tasks in order to prepare your environment for this workshop.
-
Laptop or workstation with administrator rights You will need to install packages and apps on your machine. (Alternatively you can run this workshop virtually in GitHub Codespaces)
-
Azure subscription with owner rights
-
Subscription access to Azure OpenAI service. Start here to Request Access to Azure OpenAI Service. If you have access, see below for ensuring enough quota to deploy.
For this sample to deploy successfully, there needs to be enough Azure OpenAI quota for the models used by this sample within your subscription. This sample deploys a new Azure OpenAI account with two models, gpt-4.1-mini with 30K tokens per minute and text-3-large with 5k tokens per minute. For more information on how to check your model quota and change it, see Manage Azure OpenAI Service Quota
This solution deploys a user-assigned managed identity and defines then applies Azure Cosmos DB and Azure OpenAI RBAC permissions to this as well as your own Service Principal Id. You will need the following Azure RBAC roles assigned to your identity in your Azure subscription or Subscription Owner access which will give you both of the following.
Option for Beginners: Creating a Custom Security Group (Recommended)
If you're new to Azure security or don't have direct role assignments, you can create a custom security group with the necessary permissions. This approach is recommended for workshop participants and follows Azure best practices for role-based access control (RBAC).
Benefits of this approach:
- Centralized permission management
- Easier onboarding for multiple workshop participants
- Follows principle of least privilege
- Clear audit trail
- Reusable for team members
Step 1: Create a Security Group
# Set variables
GROUP_NAME="Banking-Workshop-Developers"
GROUP_DESCRIPTION="Developers for Banking Multi-Agent Workshop with minimal required permissions"
# Create the group
GROUP_ID=$(az ad group create \
--display-name "$GROUP_NAME" \
--mail-nickname "banking-workshop-devs" \
--description "$GROUP_DESCRIPTION" \
--query id -o tsv)
echo "Created Group ID: $GROUP_ID"Step 2: Add Your User to the Group
# Get your user's Object ID
USER_OBJECT_ID=$(az ad signed-in-user show --query id -o tsv)
# Add yourself to the group
az ad group member add \
--group $GROUP_ID \
--member-id $USER_OBJECT_ID
echo "User added to group"Step 3: Assign Required Roles at Subscription Level
# Get subscription ID
SUBSCRIPTION_ID=$(az account show --query id -o tsv)
SCOPE="/subscriptions/$SUBSCRIPTION_ID"
# Assign all required roles to the group
az role assignment create --assignee $GROUP_ID --role "Managed Identity Contributor" --scope $SCOPE
az role assignment create --assignee $GROUP_ID --role "Cosmos DB Operator" --scope $SCOPE
az role assignment create --assignee $GROUP_ID --role "Cognitive Services OpenAI User" --scope $SCOPE
az role assignment create --assignee $GROUP_ID --role "Contributor" --scope $SCOPE
echo "All roles assigned to group"Step 4: Verify Role Assignments
az role assignment list \
--assignee $GROUP_ID \
--query "[].{Role:roleDefinitionName, Scope:scope}" \
-o tableStep 5: Refresh Your Credentials
After adding yourself to the group, you need to refresh your Azure credentials to pick up the new permissions:
# Log out completely
azd auth logout
az logout
# Log back in
az login
azd auth login
# Verify you're logged in
az account showNote: Azure AD group membership changes can take 5-15 minutes to propagate. If you still get permission errors after logging back in, wait a few minutes and try again.
Step 6: Verify Your Group Membership
# Check your group memberships
az rest --method GET \
--uri "https://graph.microsoft.com/v1.0/me/memberOf" \
--query 'value[].displayName' -o tableYou should see "Banking-Workshop-Developers" in the list.
You can choose from the following options to get started with the workshop.
You can run this sample app and workshop virtually by using GitHub Codespaces. The button will open a web-based VS Code instance in your browser:
💡 Note: It is recommended to extend the time-out period for Codespaces in your GitHub profile. During lunchtime your Codespace may sit idle which will force you to relaunch your Codespace and you may lose any changes. To extend the time-out go to your profile in GitHub, click on Settings, then Codespaces. You can extend up to 240 minutes (4 hours). Be sure to change this back after the workshop to avoid excessive compute charges to your GitHub Codespaces.
-
Install Docker Desktop, and VS Code along with the Dev Containers extension extension.
-
Clone the repository and checkout the WorkShop_v2_PythonLangGraph branch:
git clone -b WorkShop_v2_PythonLangGraph https://github.com/AzureCosmosDB/banking-multi-agent-workshop/ cd banking-multi-agent-workshop/01_exercises -
Open the repository in VS Code and select Reopen in Container when prompted.
-
Wait for the container to build and start. This is a one time operation and may take a few minutes.
-
Move on to the Deployment section.
⚠️ NOTE For the MCP parts of the workshop in module 5 to function properly, you must be running in a Linux environment. If you are on Windows, consider installing WSL, switching to dev containers or running in Codespaces.
-
To run the workshop locally on your machine, install the following:
- Docker Desktop
- Git
- Azure Developer CLI (azd)
- Python 3.12+
- Your Python IDE or VS Code with Python Extension
- To build and run the frontend component, install Node.js and Angular CLI
⚠️ To complete the deployment from WSL into Azure you must first install PowerShell and Docker into WSL. You will also need to install the WSL extension into VS Code. You can then open a WSL session and type code . and follow the -
Clone the repository and navigate to the folder:
git clone -b WorkShop_v2_PythonLangGraph https://github.com/AzureCosmosDB/banking-multi-agent-workshop/ cd banking-multi-agent-workshop/01_exercises -
Move on to the Deployment section.
-
From the terminal, switch to the
WorkShop_v2_PythonLangGraphbranch:git checkout WorkShop_v2_PythonLangGraph
-
Navigate to the correct folder:
cd 01_exercises/python/infra -
Log in to Azure using AZD.
azd auth login
-
If using Codespaces, also log in to Azure CLI.
az login
-
Provision the Azure services and deploy the application.
azd up
This step will take approximately 10-15 minutes. If you encounter an error during step, first rerun azd up. This tends to correct most errors.
Important
If you encounter any errors during the deployment, rerun azd up to continue the deployment from where it left off. This will not create duplicate resources, and tends to resolve most issues.
- When the resources are finally deployed, you will see a message in the terminal like below:
Deploying services (azd deploy)
(✓) Done: Deploying service ChatServiceWebApi
- Endpoint: https://ca-webapi-6xbkqp3ybtbuw.whitemoss-86b36485.eastus2.azurecontainerapps.io/
Do you want to add some dummy data for testing? (yes/no): y-
Press
yto load the data for the workshop. -
Press
yto deploy the front end for the workshop.
sudo cp /etc/resolv.conf /etc/resolv.conf.backup
echo "nameserver 8.8.8.8" | sudo tee /etc/resolv.confWhile the Azure Services are deploying we will have a presentation to cover on the structure for this workshop for today as well as provide an introduction and overview of multi-agent systems.
This workshop consists of 6 progressive modules:
- Module 0: Prerequisites and Setup (this module)
- Module 1: Creating Your First Agent
- Module 2: Connecting Agents to Memory
- Module 3: Agent Specialization
- Module 4: Multi-Agent Orchestration
- Module 5: Converting to Model Context Protocol (MCP)
- Module 6: Lessons Learned, Agent Futures, Q&A
Module 5 introduces advanced architectural patterns using the Model Context Protocol (MCP), showing how to convert your multi-agent system from native LangChain tools to a standardized, loosely-coupled architecture that enables better team collaboration and maintainability.
When you deploy this solution it automatically injects endpoints and configuration values for the required resources into a .env file at root (python) folder.
But you will still need to install dependencies to run the solution locally.
-
Navigate to the python folder of the project.
-
Create and activate a virtual environment (Linux/Mac/WSL/Codespaces):
python -m venv .venv source .venv/bin/activate -
Install the required dependencies for the project.
pip install -r src/app/requirements.txt
Note: If getting
requirements.txtfile not found when using GitHub codespaces, please navigate to thesrc/appfolder and run the command therepip install -r requirements.txt
-
Navigate to the python folder of the project.
-
Start the fastapi server.
uvicorn src.app.banking_agents_api:app --reload --host 0.0.0.0 --port 63280
The API will be available at http://localhost:63280/docs. This has been pre-built with boilerplate code that will create chat sessions and store the chat history in Cosmos DB.
-
Open a new terminal, navigate to the
01_exercises/frontendfolder and run the following to start the application:npm install ng serve
-
Open your browser and navigate to http://localhost:4200/.
-
Open a new terminal, navigate to the
01_exercises/frontendfolder and run the following to start the application:npm install ng serve
-
From the Ports tab:
- Right-click and select the Port Visibility option to set port ChatAPI (63280) as Public.
- For the port with the label Frontend app. Hover over the address and choose Open in Browser (second icon) to access the frontend application.
Lets try a couple of things:
- Try out the API by creating a chat session in the front end. This should return a response saying "Hello, I am not yet implemented".
- Navigate to the Cosmos DB account in the Azure portal to view the containers. You should see an entry in the
Chatcontainer. If you selected "yes" to the option duringazd up, there will also be some transactional data in theOffersData,AccountsData, andUserscontainers as well. - Take a look at the files in the
src/app/servicesfolder - these are the boilerplate code for interacting with the Cosmos DB and Azure OpenAI services. - You will also see an empty file
src/app/banking_agents.pyas well as empty files in thesrc/app/toolsandsrc/app/promptsfolder. This is where you will build your multi-agent system!
Next, we will start building the agents that will be served by the API layer and interact with Cosmos DB and Azure OpenAI using LangGraph!
Use the steps below to validate that the solution was deployed successfully.
- All Azure resources are deployed successfully
- You can compile the solution in CodeSpaces or locally
- You can start the project and it runs without errors
-
Errors during azd deployment:
- Service principal "not found" error.
- Rerun
azd up
- Rerun
- If you are running on Windows with Powershell, you may get:
"error executing step command 'deploy --all': getting target resource: resource not found: unable to find a resource tagged with 'azd-service-name: ChatServiceWebApi'"- This is likely because you have used Az CLI before, and have an old default resource group name cached that is different from the one specified during
azd up.
- To resolve this:
- Delete
.azurein the root folder and.azdfolders in your home directory (C:\Users\<user name>). - Start again, but first set resource group explicitly. Replace in the below with the name you intend to set for your environment:
azd env set AZURE_RESOURCE_GROUP rg-<environment name>- Then enter when prompted:
Enter a new environment name: <environment name>- Run
azd auth loginagain - Then run
azd upagain.
- Delete
- Service principal "not found" error.
-
Azure OpenAI deployment issues:
- Ensure your subscription has access to Azure OpenAI
- Check regional availability
-
Python environment issues:
- Ensure correct Python version
- Verify all dependencies are installed
-
Your Codespace times out
You need to restart your Codespace and backend and frontend for the app.
Start the backend, go to the Terminal
# Navigate to the python folder cd 01_exercises/python # start the virtual environment source .venv/bin/activate #Restart the backend uvicorn src.app.banking_agents_api:app --reload --host 0.0.0.0 --port 63280
Start the front end, open a New Terminal
# Navigate to the frontend folder cd 01_exercises/frontend # start the frontend ng serve
Be sure to check the ports for the frontend (4200) and backend (63280) are still set to Public. Click the second icon, a globe in the Ports tab to open the frontend web app.
To complete this Module successfully, you should be able to:
- Verify that all services have been deployed successfully.
- Have an open IDE or CodeSpaces session with the source code and environment variables loaded.
- Be able to compile and run the application with no warnings or errors.
Proceed to Creating Your First Agent to begin building your multi-agent banking system. The complete learning path will take you through:
- Modules 1-4: Core multi-agent system development
- Module 5: Advanced MCP architectural patterns
- Module 6: Best practices, lessons learned, Q&A and wrap-up