# microsoft/aitour-build-your-first-agent-with-azure-ai-agent-service architecture

> Architecture diagram of the GitHub repository microsoft/aitour-build-your-first-agent-with-azure-ai-agent-service, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2025-03-31). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/microsoft/aitour-build-your-first-agent-with-azure-ai-agent-service
- Repository: https://github.com/microsoft/aitour-build-your-first-agent-with-azure-ai-agent-service

## Overview

##### Main Components
- Workshop/Presentation Materials: Represented by the separate directories (“lab”, “session-delivery-resources”, and “img”) that provide lab instructions, presenter resources, and visual assets.
- Core Agent Code (src): Although the code is likely small and sample-based (given the workshop context), it embodies the integration representing the “brain” of the agent.
- Azure AI Agent Service Component: This is the primary service facilitating natural language processing, function calling, dynamic query generation, and agent orchestration.
- Data Storage: Although not explicit in the file tree, the README mentions a read-only SQLite database used for performing dynamic SQL queries.
- Visualization & File Generation Module: The agent uses a Code Interpreter to generate visualizations and downloadable files (Excel, CSV, JSON, image formats).
- External Services Integration: Integrations like Bing are used for performing grounded searches external to the internal data sources.
- Security and Context Management: Emphasize read-only database access and the built-in security best practices documented in the README.

##### Relationships and Interactions
- User Input: Begin with a user interface (could be abstracted as a client or command line interface in the workshop) that initiates requests.
- Agent Service Orchestration: The user input is passed to the Azure AI Agent Service which manages conversation context.
- SQL Query & Database: The agent dynamically generates SQL queries from user input, executes these against the read-only SQLite database, and retrieves data.
- Data Processing and Visualization: Retrieved data may be processed to generate visualizations (e.g., charts, tables) through the Code Interpreter module.
- File Generation: The system then provides options for outputting data into various file formats.
- External Data Enrichment: When needed (e.g., for competitive analysis), the agent calls the Bing search API to complement its internal data.
- Feedback Loop: The interactions are managed via a context management system ensuring that conversation remains coherent over time.

##### Architectural Patterns and Design Principles
- Modularity: Separate components for processing (query generation, visualization, file generation) indicate a modular system where each service or function is isolated.
- Layered Architecture: There is a clear separation between input management, business logic (agent orchestration, dynamic query generator), data access (SQLite), and external API integrations (Bing).
- Security Best Practices: Emphasize read-only access to data and safe interaction with external and internal data sources.
- Extensibility: The workshop focuses on adaptability so the agent can be repurposed for customer support, data analysis, or competitive analysis by plugging in additional tools.

##### Relevant Technologies and Frameworks
- Azure AI Agent Service – Core to managing the AI agent’s functionality.
- SQLite – As the read-only database used for SQL query execution.
- Code Interpreter Module – For generating visualizations and different file formats.
- External APIs like Bing – For conducting external, grounded searches.
- Python (implied from the linked Python library) – Likely used in the agent’s implementation.

## Diagram (Mermaid)

```mermaid
flowchart TD
    UI["User Interface/Client"]:::client

    Agent["Azure AI Agent Service"]:::core
    CoreCode["Core Agent Code (Agent Brain)"]:::core

    SQLGen["Dynamic SQL Query Generator"]:::core
    DB["Read-only SQLite Database"]:::data

    Viz["Visualization Module"]:::core
    FileGen["File Generation Module"]:::core

    Bing["External Bing Search API"]:::external

    Context["Security & Context Management"]:::security

    subgraph "Workshop Materials"
        Lab["Lab Instructions"]:::workshop
        Session["Session Delivery Resources"]:::workshop
        Img["Visual Assets"]:::workshop
    end

    UI -->|"UserInput"| Agent

    Agent -->|"UsesCoreLogic"| CoreCode

    Agent -->|"GeneratesSQL"| SQLGen
    SQLGen -->|"ExecutesQuery"| DB
    DB -->|"ReturnsData"| SQLGen
    SQLGen -->|"DataToAgent"| Agent

    Agent -->|"RequestsVisualization"| Viz
    Viz -->|"ReturnsVisualization"| Agent

    Agent -->|"GeneratesFile"| FileGen
    FileGen -->|"ReturnsFile"| Agent

    Agent -->|"CallsBing"| Bing
    Bing -->|"ReturnsSearchData"| Agent

    Agent -->|"ManagesContext"| Context
    Context -->|"ProvidesSecurityAndContext"| Agent

    Lab ---|"SupportsWorkshop"| UI
    Session ---|"SupportsWorkshop"| UI
    Img ---|"ProvidesVisuals"| UI

    classDef core fill:#cce5ff,stroke:#004085,stroke-width:2px;
    classDef data fill:#fff3cd,stroke:#856404,stroke-width:2px;
    classDef external fill:#d4edda,stroke:#155724,stroke-width:2px;
    classDef workshop fill:#f8d7da,stroke:#721c24,stroke-width:2px;
    classDef security fill:#e2e3e5,stroke:#6c757d,stroke-width:2px;
    classDef client fill:#d1ecf1,stroke:#0c5460,stroke-width:2px;

    click Lab "https://github.com/microsoft/aitour-build-your-first-agent-with-azure-ai-agent-service/tree/main/lab"
    click Session "https://github.com/microsoft/aitour-build-your-first-agent-with-azure-ai-agent-service/tree/main/session-delivery-resources"
    click Img "https://github.com/microsoft/aitour-build-your-first-agent-with-azure-ai-agent-service/tree/main/img"
    click CoreCode "https://github.com/microsoft/aitour-build-your-first-agent-with-azure-ai-agent-service/tree/main/src"
    click Context "https://github.com/microsoft/aitour-build-your-first-agent-with-azure-ai-agent-service/blob/main/SECURITY.md"
```
