# azure-samples/foundry-hosted-agentframework-demos architecture

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

- Interactive diagram: https://gitdiagram.com/azure-samples/foundry-hosted-agentframework-demos
- Repository: https://github.com/azure-samples/foundry-hosted-agentframework-demos

## Overview

This repository is a staged Microsoft Agent Framework demo for an internal HR benefits assistant, plus a hosted multi-agent workflow example. The principal interaction is an employee asking a question, the hosted agent consulting its model and tools, and returning an answer grounded in HR knowledge or current information. The README also documents a local-model path and evaluation capabilities; unsampled evaluation scripts are omitted. The graph reflects documented capabilities and sampled wiring, not every stage implementation.

Main entry points: [`agents/stage4_foundry_hosted.py`](https://github.com/azure-samples/foundry-hosted-agentframework-demos/blob/main/agents/stage4_foundry_hosted.py) (Hosted HR agent), [`workflows/stage4_foundry_hosted_as_agent.py`](https://github.com/azure-samples/foundry-hosted-agentframework-demos/blob/main/workflows/stage4_foundry_hosted_as_agent.py) (Hosted workflow), [`infra/create-search-indexes.py`](https://github.com/azure-samples/foundry-hosted-agentframework-demos/blob/main/infra/create-search-indexes.py) (HR and health indexes), [`infra/create-toolbox.py`](https://github.com/azure-samples/foundry-hosted-agentframework-demos/blob/main/infra/create-toolbox.py) (KB retrieval tool)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_agent["HR agent"]
  node_hosted_agent["Hosted HR agent"]
  node_deadline["Deadline tools"]
end

subgraph group_knowledge["Knowledge base"]
  node_kb_tool["KB retrieval tool<br/>[create-toolbox.py]"]
  node_knowledge_base["Company knowledge base"]
  node_search_indexes[("HR and health indexes")]
  node_hr_docs["HR documents"]
  node_health_docs["Health documents"]
end

subgraph group_workflow["Workflow agent"]
  node_workflow_host["Hosted workflow"]
  node_workflow_builder["Workflow builder"]
  node_writer["Writer agent"]
  node_formatter["Formatter agent"]
end

subgraph group_platform["Foundry services"]
  node_model["Foundry chat model"]
  node_toolbox["Foundry Toolbox"]
  node_web_search["Web search<br/>[create-toolbox.py]"]
  node_code_interpreter["Code interpreter<br/>[create-toolbox.py]"]
  node_hosted_service["Foundry hosted agent"]
  node_workflow_model["Foundry chat model"]
end

node_employee(("Employee"))

node_employee -->|"invokes"| node_hosted_service
node_hosted_service -->|"serves"| node_hosted_agent
node_hosted_agent -->|"requests completion"| node_model
node_hosted_agent -->|"calls"| node_deadline
node_hosted_agent -->|"dispatches tools"| node_toolbox
node_toolbox -->|"dispatches"| node_web_search
node_toolbox -->|"dispatches"| node_code_interpreter
node_toolbox -->|"dispatches"| node_kb_tool
node_kb_tool -->|"retrieves from"| node_knowledge_base
node_knowledge_base -->|"queries"| node_search_indexes
node_hr_docs -->|"uploaded to"| node_search_indexes
node_health_docs -->|"uploaded to"| node_search_indexes
node_employee -.->|"invokes workflow"| node_hosted_service
node_hosted_service -.->|"serves"| node_workflow_host
node_workflow_host -->|"wraps"| node_workflow_builder
node_workflow_builder -->|"starts with"| node_writer
node_workflow_builder -->|"routes to"| node_formatter
node_writer -->|"passes draft"| node_formatter
node_workflow_host -->|"uses"| node_workflow_model

click node_hosted_agent "https://github.com/azure-samples/foundry-hosted-agentframework-demos/blob/main/agents/stage4_foundry_hosted.py"
click node_deadline "https://github.com/azure-samples/foundry-hosted-agentframework-demos/blob/main/agents/stage4_foundry_hosted.py"
click node_toolbox "https://github.com/azure-samples/foundry-hosted-agentframework-demos/blob/main/agents/stage4_foundry_hosted.py"
click node_web_search "https://github.com/azure-samples/foundry-hosted-agentframework-demos/blob/main/infra/create-toolbox.py"
click node_code_interpreter "https://github.com/azure-samples/foundry-hosted-agentframework-demos/blob/main/infra/create-toolbox.py"
click node_kb_tool "https://github.com/azure-samples/foundry-hosted-agentframework-demos/blob/main/infra/create-toolbox.py"
click node_knowledge_base "https://github.com/azure-samples/foundry-hosted-agentframework-demos/blob/main/infra/create-search-indexes.py"
click node_search_indexes "https://github.com/azure-samples/foundry-hosted-agentframework-demos/blob/main/infra/create-search-indexes.py"
click node_hr_docs "https://github.com/azure-samples/foundry-hosted-agentframework-demos/blob/main/data/index-data/hrdocs-exported.jsonl"
click node_health_docs "https://github.com/azure-samples/foundry-hosted-agentframework-demos/blob/main/data/index-data/healthdocs-exported.jsonl"
click node_workflow_host "https://github.com/azure-samples/foundry-hosted-agentframework-demos/blob/main/workflows/stage4_foundry_hosted_as_agent.py"
click node_workflow_builder "https://github.com/azure-samples/foundry-hosted-agentframework-demos/blob/main/workflows/stage4_foundry_hosted_as_agent.py"
click node_writer "https://github.com/azure-samples/foundry-hosted-agentframework-demos/blob/main/workflows/stage4_foundry_hosted_as_agent.py"
click node_formatter "https://github.com/azure-samples/foundry-hosted-agentframework-demos/blob/main/workflows/stage4_foundry_hosted_as_agent.py"
click node_workflow_model "https://github.com/azure-samples/foundry-hosted-agentframework-demos/blob/main/workflows/stage4_foundry_hosted_as_agent.py"

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_hosted_agent,node_deadline toneBlue
class node_kb_tool,node_knowledge_base,node_search_indexes,node_hr_docs,node_health_docs toneAmber
class node_workflow_host,node_workflow_builder,node_writer,node_formatter toneMint
class node_model,node_toolbox,node_web_search,node_code_interpreter,node_hosted_service,node_workflow_model toneRose
class node_employee toneIndigo
```

## Components

### HR agent

- [Hosted HR agent](https://github.com/azure-samples/foundry-hosted-agentframework-demos/blob/main/agents/stage4_foundry_hosted.py): `agents/stage4_foundry_hosted.py`
- [Deadline tools](https://github.com/azure-samples/foundry-hosted-agentframework-demos/blob/main/agents/stage4_foundry_hosted.py): `agents/stage4_foundry_hosted.py`

### Knowledge base

- [KB retrieval tool](https://github.com/azure-samples/foundry-hosted-agentframework-demos/blob/main/infra/create-toolbox.py): `infra/create-toolbox.py`
- [Company knowledge base](https://github.com/azure-samples/foundry-hosted-agentframework-demos/blob/main/infra/create-search-indexes.py): `infra/create-search-indexes.py`
- [HR and health indexes](https://github.com/azure-samples/foundry-hosted-agentframework-demos/blob/main/infra/create-search-indexes.py): `infra/create-search-indexes.py`
- [HR documents](https://github.com/azure-samples/foundry-hosted-agentframework-demos/blob/main/data/index-data/hrdocs-exported.jsonl): `data/index-data/hrdocs-exported.jsonl`
- [Health documents](https://github.com/azure-samples/foundry-hosted-agentframework-demos/blob/main/data/index-data/healthdocs-exported.jsonl): `data/index-data/healthdocs-exported.jsonl`

### Workflow agent

- [Hosted workflow](https://github.com/azure-samples/foundry-hosted-agentframework-demos/blob/main/workflows/stage4_foundry_hosted_as_agent.py): `workflows/stage4_foundry_hosted_as_agent.py`
- [Workflow builder](https://github.com/azure-samples/foundry-hosted-agentframework-demos/blob/main/workflows/stage4_foundry_hosted_as_agent.py): `workflows/stage4_foundry_hosted_as_agent.py`
- [Writer agent](https://github.com/azure-samples/foundry-hosted-agentframework-demos/blob/main/workflows/stage4_foundry_hosted_as_agent.py): `workflows/stage4_foundry_hosted_as_agent.py`
- [Formatter agent](https://github.com/azure-samples/foundry-hosted-agentframework-demos/blob/main/workflows/stage4_foundry_hosted_as_agent.py): `workflows/stage4_foundry_hosted_as_agent.py`

### Foundry services

- **Foundry chat model**
- [Foundry Toolbox](https://github.com/azure-samples/foundry-hosted-agentframework-demos/blob/main/agents/stage4_foundry_hosted.py): `agents/stage4_foundry_hosted.py`
- [Web search](https://github.com/azure-samples/foundry-hosted-agentframework-demos/blob/main/infra/create-toolbox.py): `infra/create-toolbox.py`
- [Code interpreter](https://github.com/azure-samples/foundry-hosted-agentframework-demos/blob/main/infra/create-toolbox.py): `infra/create-toolbox.py`
- **Foundry hosted agent**
- [Foundry chat model](https://github.com/azure-samples/foundry-hosted-agentframework-demos/blob/main/workflows/stage4_foundry_hosted_as_agent.py): `workflows/stage4_foundry_hosted_as_agent.py`

### Other components

- **Employee**

## Connections

- Employee → Foundry hosted agent: invokes
- Foundry hosted agent → Hosted HR agent: serves
- Hosted HR agent → Foundry chat model: requests completion
- Hosted HR agent → Deadline tools: calls
- Hosted HR agent → Foundry Toolbox: dispatches tools
- Foundry Toolbox → Web search: dispatches
- Foundry Toolbox → Code interpreter: dispatches
- Foundry Toolbox → KB retrieval tool: dispatches
- KB retrieval tool → Company knowledge base: retrieves from
- Company knowledge base → HR and health indexes: queries
- HR documents → HR and health indexes: uploaded to
- Health documents → HR and health indexes: uploaded to
- Employee → Foundry hosted agent: invokes workflow
- Foundry hosted agent → Hosted workflow: serves
- Hosted workflow → Workflow builder: wraps
- Workflow builder → Writer agent: starts with
- Workflow builder → Formatter agent: routes to
- Writer agent → Formatter agent: passes draft
- Hosted workflow → Foundry chat model: uses
