Skip to content

Streamlit-based UI Demo Kit app to showcase capabilities of Azure AI Foundry's Agent Service framework.

License

Notifications You must be signed in to change notification settings

LazaUK/AIFoundry-AgentService-Streamlit

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

58 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Azure AI Foundry: Agent Service - UI Demo Kit

Agent Service is a powerful offering within Azure AI Foundry that allows you to develop intelligent AI agents. AI agents can be customised to answer questions, perform autonomous sets of tasks and interact with users naturally and intuitively.

This repo contains the source code for a Streamlit-based UI Demo Kit showcasing various capabilities of the Agent Service, including:

  • Solving complex problems with the Code Interpreter (which builds and runs sandboxed Python code);
  • Grounding model outputs (completions) with real-time Bing Search results;
  • with more to come...

Note

The Streamlit app can be run locally on your computer and requires access to AI models deployed in Azure AI Foundry. Alternatively, you can deploy a pre-built app using the provided Docker image.

Table of contents:

Part 1: Configuring solution environment

  1. Copy the connection string from your AI Foundry Project settings, as shown in the image below: config_foundry_conn_string
  2. Set the environment variable for the copied Project connection string:
    • Windows: Add AZURE_FOUNDRY_PROJECT_CONNSTRING as a system variable with the copied string as its value;
    • macOS/Linux: Set the variable in your terminal:
      export AZURE_FOUNDRY_PROJECT_CONNSTRING="your_connection_string"
  3. Add other environment variables to enable specific UI Demo Kit capabilities:
Environment Variable Description Scenario
AZURE_FOUNDRY_GPT_MODEL Deployment name of the Azure OpenAI GPT model *
AZURE_FOUNDRY_BING_SEARCH Connection name of the Bing Search resource, as described here Grounding with Bing Search
  1. Install the required Python packages using the pip command and the provided requirements.txt file:
pip install -r requirements.txt

Note

Local installation utilises the DefaultAzureCredential class. Depending on your environment, the UI Demo Kit will search for available Azure identities in the order described here.

Part 2: Web app - User Guide

  1. To launch the web app, run the following command from the root folder of this repo:
streamlit run AgentService_Streamlit_v1.py
  1. If everything was installed correctly as per Part 1's instructions, you should be able to access the demo solution's web page locally at http://localhost:8501. Home Page of Demo Kit
  2. The UX is intentionally minimalistic. Here's how to use it:
    • Choose a Capability: Begin by choosing the desired capability from the left-side navigation panel.
    • Enter Your Prompt: Each scenario comes with a default prompt. You can modify it in the provided text area.
    • Run the Agent: Click the "Run" button. The underlying Agent Service will utilise relevant tools, with the run status reflected in the progress bar.
    • View the Output: Depending on the selected scenario, the UI Demo Kit may produce its output in text, code and image formats.

Note

As a Generative AI solution, the Agent Service is inherently non-deterministic. Therefore, it’s normal to receive slightly different outputs in the UI Demo Kit for the same prompts.

Part 3: Web app - Docker image option

This repo includes a companion Docker image on GitHub Container Registry (GHCR), containing a pre-built web app with all dependencies. It allows you to launch the UI Demo Kit as a container without getting deep into its code's specifics.

There are two ways to utilise the provided Docker image:

a) Deploying as an Azure Web App:

  1. Create a new Azure Web App and set the source container to:
    • _Image Source_: Other container registries
    • _Access type_: Public
    • _Registry server URL_: https://ghcr.io
    • _Image and tag_: lazauk/uidemokit-agentservice:latest
    • _Port_: 8501 Web App - Container Config
  2. Enable Managed Identity for your newly created Web App: Web App - Managed Identity
  3. In Azure AI Foundry, assign your Web App's managed identity the Azure AI Developer role: Web App - Managed Identity
  4. Add new application settings for each environment variable described in Part 1 above. Web App - Managed Identity

b) Using the Docker image as a base for your custom one:

  1. If you prefer to customise the web app, you can use the provided Docker image as a base for your own Dockerfile. Begin your Dockerfile with the following line:
FROM ghcr.io/lazauk/uidemokit-agentservice:latest
  1. The main script (AgentService_Streamlit_v1.py) is located in the /app working directory of the container.

Warning

If deploying the Docker container locally or on another cloud platform, you will need to configure a mechanism to pass credentials for a service principal authorised to access your Azure AI Foundry resources. This is not required when deploying to Azure Web App with Managed Identity.

Part 4: Demo videos on YouTube

This is a playlist of short videos demonstrating this solution in action.

About

Streamlit-based UI Demo Kit app to showcase capabilities of Azure AI Foundry's Agent Service framework.

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Languages