# microsoftgraph/msgraph-sdk-python architecture

> Architecture diagram of the GitHub repository microsoftgraph/msgraph-sdk-python, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-10-02). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/microsoftgraph/msgraph-sdk-python
- Repository: https://github.com/microsoftgraph/msgraph-sdk-python

## Overview

This repository is the Microsoft Graph SDK for Python: an application supplies Azure credentials and scopes, constructs a GraphServiceClient, then uses generated request builders to make Graph API calls. The central runtime layers are the service client and request adapter; the generated API surface covers Graph resources, including documented user requests and the administration routes visible in the tree. The README also documents broader Graph use, batching, and sync/async Azure credentials. Generated implementation details beyond the sampled files are represented at directory level; links without direct evidence are omitted.

Main entry points: [`msgraph/graph_service_client.py`](https://github.com/microsoftgraph/msgraph-sdk-python/blob/main/msgraph/graph_service_client.py) (Graph service client), [`msgraph/graph_request_adapter.py`](https://github.com/microsoftgraph/msgraph-sdk-python/blob/main/msgraph/graph_request_adapter.py) (Request adapter), [`msgraph/generated/users/item/user_item_request_builder.py`](https://github.com/microsoftgraph/msgraph-sdk-python/blob/main/msgraph/generated/users/item/user_item_request_builder.py) (User requests), [`msgraph/generated/admin`](https://github.com/microsoftgraph/msgraph-sdk-python/tree/main/msgraph/generated/admin) (Administration APIs)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_client["Client entry"]
  node_service_client["Graph service client"]
  node_batch["Batch requests"]
end

subgraph group_transport["Auth and transport"]
  node_request_adapter["Request adapter"]
  node_sdk_version["SDK version<br/>[_version.py]"]
end

subgraph group_api["Graph API surface"]
  node_generated_api["Generated request builders"]
  node_users["User requests"]
  node_admin_api["Administration APIs"]
end

node_application(("Python application"))
node_azure_identity["Azure Identity"]
node_http_middleware["HTTP middleware"]
node_graph_service(("Microsoft Graph"))

node_application -->|"creates"| node_service_client
node_application -->|"supplies credentials"| node_azure_identity
node_service_client -->|"constructs"| node_request_adapter
node_service_client -->|"configures authentication"| node_azure_identity
node_request_adapter -->|"configures"| node_http_middleware
node_request_adapter -->|"uses version"| node_sdk_version
node_service_client -->|"exposes"| node_users
node_service_client -->|"inherits API"| node_generated_api
node_service_client -->|"provides"| node_batch
node_application -->|"requests user"| node_users
node_users -.->|"sends API request"| node_graph_service
node_admin_api -.->|"supports admin calls"| node_graph_service

click node_service_client "https://github.com/microsoftgraph/msgraph-sdk-python/blob/main/msgraph/graph_service_client.py"
click node_batch "https://github.com/microsoftgraph/msgraph-sdk-python/blob/main/msgraph/graph_service_client.py"
click node_request_adapter "https://github.com/microsoftgraph/msgraph-sdk-python/blob/main/msgraph/graph_request_adapter.py"
click node_sdk_version "https://github.com/microsoftgraph/msgraph-sdk-python/blob/main/msgraph/_version.py"
click node_generated_api "https://github.com/microsoftgraph/msgraph-sdk-python/tree/main/msgraph/generated"
click node_users "https://github.com/microsoftgraph/msgraph-sdk-python/blob/main/msgraph/generated/users/item/user_item_request_builder.py"
click node_admin_api "https://github.com/microsoftgraph/msgraph-sdk-python/tree/main/msgraph/generated/admin"

classDef toneNeutral fill:#f8fafc,stroke:#334155,stroke-width:1.5px,color:#0f172a
classDef toneBlue fill:#dbeafe,stroke:#2563eb,stroke-width:1.5px,color:#172554
classDef toneAmber fill:#fef3c7,stroke:#d97706,stroke-width:1.5px,color:#78350f
classDef toneMint fill:#dcfce7,stroke:#16a34a,stroke-width:1.5px,color:#14532d
classDef toneRose fill:#ffe4e6,stroke:#e11d48,stroke-width:1.5px,color:#881337
classDef toneIndigo fill:#e0e7ff,stroke:#4f46e5,stroke-width:1.5px,color:#312e81
classDef toneTeal fill:#ccfbf1,stroke:#0f766e,stroke-width:1.5px,color:#134e4a
class node_service_client,node_batch toneBlue
class node_request_adapter,node_sdk_version toneAmber
class node_generated_api,node_users,node_admin_api toneMint
class node_application,node_azure_identity,node_http_middleware,node_graph_service toneIndigo
```

## Components

### Client entry

- [Graph service client](https://github.com/microsoftgraph/msgraph-sdk-python/blob/main/msgraph/graph_service_client.py): `msgraph/graph_service_client.py`
- [Batch requests](https://github.com/microsoftgraph/msgraph-sdk-python/blob/main/msgraph/graph_service_client.py): `msgraph/graph_service_client.py`

### Auth and transport

- [Request adapter](https://github.com/microsoftgraph/msgraph-sdk-python/blob/main/msgraph/graph_request_adapter.py): `msgraph/graph_request_adapter.py`
- [SDK version](https://github.com/microsoftgraph/msgraph-sdk-python/blob/main/msgraph/_version.py): `msgraph/_version.py`

### Graph API surface

- [Generated request builders](https://github.com/microsoftgraph/msgraph-sdk-python/tree/main/msgraph/generated): `msgraph/generated`
- [User requests](https://github.com/microsoftgraph/msgraph-sdk-python/blob/main/msgraph/generated/users/item/user_item_request_builder.py): `msgraph/generated/users/item/user_item_request_builder.py`
- [Administration APIs](https://github.com/microsoftgraph/msgraph-sdk-python/tree/main/msgraph/generated/admin): `msgraph/generated/admin`

### Other components

- **Python application**
- **Azure Identity**
- **HTTP middleware**
- **Microsoft Graph**

## Connections

- Python application → Graph service client: creates (evidence: `README.md`)
- Python application → Azure Identity: supplies credentials (evidence: `README.md`)
- Graph service client → Request adapter: constructs (evidence: `msgraph/graph_service_client.py`)
- Graph service client → Azure Identity: configures authentication (evidence: `msgraph/graph_service_client.py`)
- Request adapter → HTTP middleware: configures (evidence: `msgraph/graph_request_adapter.py`)
- Request adapter → SDK version: uses version (evidence: `msgraph/graph_request_adapter.py`)
- Graph service client → User requests: exposes (evidence: `msgraph/graph_service_client.py`)
- Graph service client → Generated request builders: inherits API (evidence: `msgraph/graph_service_client.py`)
- Graph service client → Batch requests: provides (evidence: `msgraph/graph_service_client.py`)
- Python application → User requests: requests user (evidence: `README.md`)
- User requests → Microsoft Graph: sends API request
- Administration APIs → Microsoft Graph: supports admin calls
