Skip to content

Azure-Samples/sk-advanced-orchestration

Repository files navigation

Semantic Kernel Advanced Customer Support

This repo showcases a sample AI-enabled customer support application that leverages Semantic Kernel Agents boosted with:

  • an improved SelectionStrategy that accounts for agents descriptions and available tools to provide a more accurate selection (including the reason for it for traceability).
  • nested orchestration via Teams and Agents for more complex, hierarchical routing scenarios.
  • a special type of Agent named PlannedTeam, which can handle more complex, cross-agent asks turning them into a multi-step process automatically.

Additionally, the application leverages Azure Container Apps and Dapr to enable the Virtual Actor pattern for agentic teams and natively handle ChatHistory persistence via Dapr's state store, ensuring that the application can scale seamlessly.

Example

In this case, the user asks a question that requires the involvement of multiple agents, which are able to collaborate and produce a composite answer.

Example chat demonstrating agents producing a composite answer

Architecture

The overall architecture involves Dapr to enable the Virtual Actor pattern, in order to host the agentic team and natively handle ChatHistory persistence via Dapr's state store.

flowchart TD
  %% User and client
  U[User]
  CB[Browser / Client]
  U --> CB

  %% Container Apps (Dapr enabled)
  subgraph "Azure Container Apps"
    Chat["`Chat App<br/>(Dapr enabled)<br/>[src/chat]`"]
    Agents["`Agents App<br/>(Dapr enabled)<br/>[src/agents]`"]
  end

  CB --> Chat

  %% Dapr sidecars within container apps
  Chat -- "Dapr Sidecar" --> DS1["`Dapr: state store<br/>(in-memory / Cosmos DB)`"]
  Agents -- "Dapr Sidecar" --> DS2[Dapr Components]

  %% Communication Flow
  Chat --- Agents
  Agents --- Chat

  %% Azure Services and Infrastructure
  subgraph "Azure Resources"
    ACR["`Azure Container Registry<br/>[infra/acr.bicep]`"]
    AI["`Application Insights<br/>[infra/appin.bicep]`"]
    LA["`Log Analytics<br/>[infra/appin.bicep]`"]
    OAI["`Azure OpenAI<br/>[infra/openAI.bicep]`"]
    Cosmos["`Cosmos DB<br/>[infra/cosmos.bicep]`"]
    UAMI["`User Assigned Identity<br/>[infra/uami.bicep]`"]
  end

  %% Deployment orchestration via Azure Developer CLI
  ADCLI["`Azure Developer CLI<br/>(azd)`"]
  ADCLI --> ACR
  ADCLI --> AI
  ADCLI --> LA
  ADCLI --> OAI
  ADCLI --> Cosmos
  ADCLI --> UAMI

  %% Container App image source
  ACR --> Chat
  ACR --> Agents

  %% Monitoring and Telemetry
  Chat --> AI
  Agents --> AI
  AI --> LA

  %% Data persistence via Dapr state store
  DS1 --> Cosmos

  %% Semantic Kernel
  SK["`Semantic Kernel<br/>(LLM Processing)`"]
  Agents --> SK
  SK --- Agents
Loading

Getting Started

Prerequisites

Clone the repo

git clone https://github.com/Azure-Samples/mas-sk-quickstart
cd mas-sk-quickstart

Azure Deployment

# Login to Azure if required
azd auth login --tenant-id <TENANT>.onmicrosoft.com

azd up

# When prompted, select
# - Azure subscription to deploy to
# - Azure region to deploy to
# - Azure OpenAI resource and group to use

Running Locally

  1. cp .env.example .env
  2. Update .env with your Azure OpenAI resource endpoint
  3. Ensure Docker is running.
  4. Init Dapr (once only): dapr init.

To run:

dapr run -f dapr.yaml

Contributing

This project welcomes contributions and suggestions. Please see CONTRIBUTING.md for details.

License

This project is licensed under the MIT License. See LICENSE.md for details.

About

SK Multi agentic advanced orchestration example

Resources

Code of conduct

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published