# microsoft/promptflow architecture

> Architecture diagram of the GitHub repository microsoft/promptflow, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-09-28). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/microsoft/promptflow
- Repository: https://github.com/microsoft/promptflow

## Overview

Prompt flow is a toolkit for authoring, executing, evaluating, and deploying LLM application flows. The documented developer path is to create a flow, configure model connections, run and debug it, evaluate quality at scale, then serve or deploy it; Azure adds cloud run and collaboration operations. The graph combines those documented capabilities with the sampled runtime and storage code. Some capability paths are represented by enclosing source directories because their specific implementations were not sampled.

Main entry points: [`src/promptflow-core/promptflow/executor/flow_executor.py`](https://github.com/microsoft/promptflow/blob/main/src/promptflow-core/promptflow/executor/flow_executor.py) (Flow executor), [`src/promptflow-devkit/promptflow/_cli/_pf/entry.py`](https://github.com/microsoft/promptflow/blob/main/src/promptflow-devkit/promptflow/_cli/_pf/entry.py) (Developer CLI), [`src/promptflow-core/promptflow/core/_connection.py`](https://github.com/microsoft/promptflow/blob/main/src/promptflow-core/promptflow/core/_connection.py) (Connections), [`src/promptflow-devkit/promptflow/batch/_batch_engine.py`](https://github.com/microsoft/promptflow/blob/main/src/promptflow-devkit/promptflow/batch/_batch_engine.py) (Batch execution)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_dev["Flow development"]
  node_cli["Developer CLI<br/>[entry.py]"]
  node_author["Flow authoring<br/>[_flow.py]"]
  node_connections["Connections<br/>[_connection.py]"]
end

subgraph group_runtime["Execution runtime"]
  node_tools["Tool loading<br/>[tools_manager.py]"]
  node_executor["Flow executor<br/>[flow_executor.py]"]
  node_processes["Process manager"]
  node_batch["Batch execution<br/>[_batch_engine.py]"]
  node_localstore[("Local run records")]
  node_runstorage["Run storage<br/>[_run_storage.py]"]
end

subgraph group_quality["Quality and observability"]
  node_trace["Tracing"]
  node_evaluation["Evaluation"]
end

subgraph group_production["Serving and Azure"]
  node_serving["Flow serving<br/>[app.py]"]
  node_azure["Azure operations"]
end

node_developer(("Flow developer"))
node_azure_service{{"Azure services"}}
node_llm{{"LLM providers"}}

node_developer -->|"runs commands"| node_cli
node_cli -->|"creates flows"| node_author
node_cli -->|"sets credentials"| node_connections
node_cli -->|"invokes runs"| node_executor
node_executor -->|"loads tools"| node_tools
node_executor -->|"resolves credentials"| node_connections
node_executor -->|"calls models"| node_llm
node_batch -->|"dispatches lines"| node_executor
node_batch -->|"persists run data"| node_runstorage
node_runstorage -->|"stores records"| node_localstore
node_executor -->|"runs workers"| node_processes
node_executor -.->|"emits traces"| node_trace
node_evaluation -->|"evaluates flow"| node_executor
node_serving -->|"invokes flow"| node_executor
node_azure -->|"manages cloud runs"| node_azure_service
node_azure -->|"manages connections"| node_connections

click node_cli "https://github.com/microsoft/promptflow/blob/main/src/promptflow-devkit/promptflow/_cli/_pf/entry.py"
click node_author "https://github.com/microsoft/promptflow/blob/main/src/promptflow-core/promptflow/core/_flow.py"
click node_connections "https://github.com/microsoft/promptflow/blob/main/src/promptflow-core/promptflow/core/_connection.py"
click node_tools "https://github.com/microsoft/promptflow/blob/main/src/promptflow-core/promptflow/_core/tools_manager.py"
click node_executor "https://github.com/microsoft/promptflow/blob/main/src/promptflow-core/promptflow/executor/flow_executor.py"
click node_processes "https://github.com/microsoft/promptflow/blob/main/src/promptflow-core/promptflow/executor/_process_manager.py"
click node_batch "https://github.com/microsoft/promptflow/blob/main/src/promptflow-devkit/promptflow/batch/_batch_engine.py"
click node_localstore "https://github.com/microsoft/promptflow/blob/main/src/promptflow-devkit/promptflow/_sdk/operations/_local_storage_operations.py"
click node_runstorage "https://github.com/microsoft/promptflow/blob/main/src/promptflow-core/promptflow/storage/_run_storage.py"
click node_trace "https://github.com/microsoft/promptflow/tree/main/src/promptflow-tracing/promptflow/tracing"
click node_evaluation "https://github.com/microsoft/promptflow/tree/main/src/promptflow-evals/promptflow/evals"
click node_serving "https://github.com/microsoft/promptflow/blob/main/src/promptflow-core/promptflow/core/_serving/app.py"
click node_azure "https://github.com/microsoft/promptflow/tree/main/src/promptflow-azure/promptflow/azure/operations"

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_cli,node_author,node_connections toneBlue
class node_tools,node_executor,node_processes,node_batch,node_localstore,node_runstorage toneAmber
class node_trace,node_evaluation toneMint
class node_serving,node_azure toneRose
class node_developer,node_azure_service,node_llm toneIndigo
```

## Components

### Flow development

- [Developer CLI](https://github.com/microsoft/promptflow/blob/main/src/promptflow-devkit/promptflow/_cli/_pf/entry.py): `src/promptflow-devkit/promptflow/_cli/_pf/entry.py`
- [Flow authoring](https://github.com/microsoft/promptflow/blob/main/src/promptflow-core/promptflow/core/_flow.py): `src/promptflow-core/promptflow/core/_flow.py`
- [Connections](https://github.com/microsoft/promptflow/blob/main/src/promptflow-core/promptflow/core/_connection.py): `src/promptflow-core/promptflow/core/_connection.py`

### Execution runtime

- [Tool loading](https://github.com/microsoft/promptflow/blob/main/src/promptflow-core/promptflow/_core/tools_manager.py): `src/promptflow-core/promptflow/_core/tools_manager.py`
- [Flow executor](https://github.com/microsoft/promptflow/blob/main/src/promptflow-core/promptflow/executor/flow_executor.py): `src/promptflow-core/promptflow/executor/flow_executor.py`
- [Process manager](https://github.com/microsoft/promptflow/blob/main/src/promptflow-core/promptflow/executor/_process_manager.py): `src/promptflow-core/promptflow/executor/_process_manager.py`
- [Batch execution](https://github.com/microsoft/promptflow/blob/main/src/promptflow-devkit/promptflow/batch/_batch_engine.py): `src/promptflow-devkit/promptflow/batch/_batch_engine.py`
- [Local run records](https://github.com/microsoft/promptflow/blob/main/src/promptflow-devkit/promptflow/_sdk/operations/_local_storage_operations.py): `src/promptflow-devkit/promptflow/_sdk/operations/_local_storage_operations.py`
- [Run storage](https://github.com/microsoft/promptflow/blob/main/src/promptflow-core/promptflow/storage/_run_storage.py): `src/promptflow-core/promptflow/storage/_run_storage.py`

### Quality and observability

- [Tracing](https://github.com/microsoft/promptflow/tree/main/src/promptflow-tracing/promptflow/tracing): `src/promptflow-tracing/promptflow/tracing`
- [Evaluation](https://github.com/microsoft/promptflow/tree/main/src/promptflow-evals/promptflow/evals): `src/promptflow-evals/promptflow/evals`

### Serving and Azure

- [Flow serving](https://github.com/microsoft/promptflow/blob/main/src/promptflow-core/promptflow/core/_serving/app.py): `src/promptflow-core/promptflow/core/_serving/app.py`
- [Azure operations](https://github.com/microsoft/promptflow/tree/main/src/promptflow-azure/promptflow/azure/operations): `src/promptflow-azure/promptflow/azure/operations`

### Other components

- **Flow developer**
- **Azure services**
- **LLM providers**

## Connections

- Flow developer → Developer CLI: runs commands
- Developer CLI → Flow authoring: creates flows
- Developer CLI → Connections: sets credentials
- Developer CLI → Flow executor: invokes runs
- Flow executor → Tool loading: loads tools
- Flow executor → Connections: resolves credentials
- Flow executor → LLM providers: calls models
- Batch execution → Flow executor: dispatches lines
- Batch execution → Run storage: persists run data
- Run storage → Local run records: stores records
- Flow executor → Process manager: runs workers
- Flow executor → Tracing: emits traces
- Evaluation → Flow executor: evaluates flow
- Flow serving → Flow executor: invokes flow
- Azure operations → Azure services: manages cloud runs
- Azure operations → Connections: manages connections
