# microsoft/voice-agent architecture

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

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

## Overview

This repository is a community hub whose runnable product code centers on a browser-based Voice Agent studio and local bridge to Azure Foundry; it also contains standalone MCP tool-server samples and a voice-agent cost calculator. The principal workflow is selecting/configuring an agent in the studio, starting a browser voice session through the bridge, and exchanging realtime events with the Foundry voice endpoint. The graph also preserves handoff, session recording, MCP examples, and cost estimation. Relationships are limited to those shown by the excerpts, SOURCE INDEX references, or README; unsampled wiring is omitted.

Main entry points: [`portal/web/src/hooks/useVoiceSession.js`](https://github.com/microsoft/voice-agent/blob/main/portal/web/src/hooks/useVoiceSession.js) (Voice session hook), [`portal/web/src/App.jsx`](https://github.com/microsoft/voice-agent/blob/main/portal/web/src/App.jsx) (Studio app), [`portal/demo_server.py`](https://github.com/microsoft/voice-agent/blob/main/portal/demo_server.py) (Portal bridge), [`shared_mcp/app/shared_mcp/server.py`](https://github.com/microsoft/voice-agent/blob/main/shared_mcp/app/shared_mcp/server.py) (MCP host)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_studio["Portal studio"]
  node_app["Studio app<br/>[App.jsx]"]
  node_configui["Agent configuration<br/>[ConfigControls.jsx]"]
  node_review["Agent review<br/>[ReviewPanel.jsx]"]
  node_handoffui["Handoff graph"]
end

subgraph group_voice["Voice runtime"]
  node_websession["Voice session hook<br/>[useVoiceSession.js]"]
  node_turnmetrics["Turn metrics<br/>[turnMetrics.mjs]"]
  node_clientfunctions["Client functions"]
  node_handoffcore["Handoff editor<br/>[handoff-core.mjs]"]
  node_bridge["Portal bridge<br/>[demo_server.py]"]
  node_policy["Voice policy<br/>[voice_policy.py]"]
  node_sessionlog["Session recording<br/>[session_log.py]"]
end

subgraph group_tools["MCP samples"]
  node_sharedhost["MCP host<br/>[server.py]"]
  node_conference["Conference tools<br/>[service.py]"]
  node_elevator["Elevator tools<br/>[service.py]"]
  node_elevatorstore[("Elevator state<br/>[store.py]")]
  node_financehandoff["Finance handoff<br/>[service.py]"]
  node_financedata[("Finance data<br/>[data.py]")]
  node_officer["OTP officer<br/>[service.py]"]
  node_mocktools["Mock tool service<br/>[service.py]"]
end

subgraph group_utilities["Standalone utility"]
  node_calculatorui["Cost calculator UI<br/>[app.mjs]"]
  node_calculator["Cost calculation<br/>[calculator.mjs]"]
end

node_user(("Builder / caller"))
node_foundry{{"Foundry voice service"}}

node_user -->|"configures agent"| node_app
node_app -->|"renders"| node_configui
node_app -->|"renders"| node_review
node_app -->|"renders"| node_handoffui
node_app -->|"starts session"| node_websession
node_websession -->|"records tool calls"| node_turnmetrics
node_websession -->|"resolves arguments"| node_clientfunctions
node_handoffui -->|"uses editor core"| node_handoffcore
node_websession -->|"opens voice connection"| node_bridge
node_bridge -->|"proxies requests"| node_foundry
node_foundry -->|"streams voice events"| node_websession
node_bridge -->|"applies policy"| node_policy
node_bridge -->|"records session events"| node_sessionlog
node_user -->|"speaks to agent"| node_websession
node_sharedhost -->|"routes tools"| node_elevator
node_sharedhost -->|"routes tools"| node_financehandoff
node_sharedhost -->|"routes tools"| node_officer
node_elevator -->|"reads and writes"| node_elevatorstore
node_financehandoff -->|"uses data"| node_financedata
node_user -->|"estimates costs"| node_calculatorui
node_calculatorui -->|"gets rates"| node_calculator

click node_app "https://github.com/microsoft/voice-agent/blob/main/portal/web/src/App.jsx"
click node_configui "https://github.com/microsoft/voice-agent/blob/main/portal/web/src/components/ConfigControls.jsx"
click node_review "https://github.com/microsoft/voice-agent/blob/main/portal/web/src/components/ReviewPanel.jsx"
click node_handoffui "https://github.com/microsoft/voice-agent/blob/main/portal/web/src/components/HandoffGraphPanel.jsx"
click node_websession "https://github.com/microsoft/voice-agent/blob/main/portal/web/src/hooks/useVoiceSession.js"
click node_turnmetrics "https://github.com/microsoft/voice-agent/blob/main/portal/web/src/lib/turnMetrics.mjs"
click node_clientfunctions "https://github.com/microsoft/voice-agent/blob/main/portal/web/src/lib/clientFunctions.mjs"
click node_handoffcore "https://github.com/microsoft/voice-agent/blob/main/portal/static/handoff/handoff-core.mjs"
click node_bridge "https://github.com/microsoft/voice-agent/blob/main/portal/demo_server.py"
click node_policy "https://github.com/microsoft/voice-agent/blob/main/portal/voice_policy.py"
click node_sessionlog "https://github.com/microsoft/voice-agent/blob/main/portal/session_log.py"
click node_sharedhost "https://github.com/microsoft/voice-agent/blob/main/shared_mcp/app/shared_mcp/server.py"
click node_conference "https://github.com/microsoft/voice-agent/blob/main/shared_mcp/app/shared_mcp/conference/service.py"
click node_elevator "https://github.com/microsoft/voice-agent/blob/main/shared_mcp/app/shared_mcp/elevator_service/service.py"
click node_elevatorstore "https://github.com/microsoft/voice-agent/blob/main/shared_mcp/app/shared_mcp/elevator_service/store.py"
click node_financehandoff "https://github.com/microsoft/voice-agent/blob/main/shared_mcp/app/shared_mcp/finance_handoff/service.py"
click node_financedata "https://github.com/microsoft/voice-agent/blob/main/shared_mcp/app/shared_mcp/finance_handoff/data.py"
click node_officer "https://github.com/microsoft/voice-agent/blob/main/shared_mcp/app/shared_mcp/finance_otp_officer/service.py"
click node_mocktools "https://github.com/microsoft/voice-agent/blob/main/shared_mcp/app/shared_mcp/mock_tool_call/service.py"
click node_calculatorui "https://github.com/microsoft/voice-agent/blob/main/tools/cost_calculator/app.mjs"
click node_calculator "https://github.com/microsoft/voice-agent/blob/main/tools/cost_calculator/calculator.mjs"

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_app,node_configui,node_review,node_handoffui toneBlue
class node_websession,node_turnmetrics,node_clientfunctions,node_handoffcore,node_bridge,node_policy,node_sessionlog toneAmber
class node_sharedhost,node_conference,node_elevator,node_elevatorstore,node_financehandoff,node_financedata,node_officer,node_mocktools toneMint
class node_calculatorui,node_calculator toneRose
class node_user,node_foundry toneIndigo
```

## Components

### Portal studio

- [Studio app](https://github.com/microsoft/voice-agent/blob/main/portal/web/src/App.jsx): `portal/web/src/App.jsx`
- [Agent configuration](https://github.com/microsoft/voice-agent/blob/main/portal/web/src/components/ConfigControls.jsx): `portal/web/src/components/ConfigControls.jsx`
- [Agent review](https://github.com/microsoft/voice-agent/blob/main/portal/web/src/components/ReviewPanel.jsx): `portal/web/src/components/ReviewPanel.jsx`
- [Handoff graph](https://github.com/microsoft/voice-agent/blob/main/portal/web/src/components/HandoffGraphPanel.jsx): `portal/web/src/components/HandoffGraphPanel.jsx`

### Voice runtime

- [Voice session hook](https://github.com/microsoft/voice-agent/blob/main/portal/web/src/hooks/useVoiceSession.js): `portal/web/src/hooks/useVoiceSession.js`
- [Turn metrics](https://github.com/microsoft/voice-agent/blob/main/portal/web/src/lib/turnMetrics.mjs): `portal/web/src/lib/turnMetrics.mjs`
- [Client functions](https://github.com/microsoft/voice-agent/blob/main/portal/web/src/lib/clientFunctions.mjs): `portal/web/src/lib/clientFunctions.mjs`
- [Handoff editor](https://github.com/microsoft/voice-agent/blob/main/portal/static/handoff/handoff-core.mjs): `portal/static/handoff/handoff-core.mjs`
- [Portal bridge](https://github.com/microsoft/voice-agent/blob/main/portal/demo_server.py): `portal/demo_server.py`
- [Voice policy](https://github.com/microsoft/voice-agent/blob/main/portal/voice_policy.py): `portal/voice_policy.py`
- [Session recording](https://github.com/microsoft/voice-agent/blob/main/portal/session_log.py): `portal/session_log.py`

### MCP samples

- [MCP host](https://github.com/microsoft/voice-agent/blob/main/shared_mcp/app/shared_mcp/server.py): `shared_mcp/app/shared_mcp/server.py`
- [Conference tools](https://github.com/microsoft/voice-agent/blob/main/shared_mcp/app/shared_mcp/conference/service.py): `shared_mcp/app/shared_mcp/conference/service.py`
- [Elevator tools](https://github.com/microsoft/voice-agent/blob/main/shared_mcp/app/shared_mcp/elevator_service/service.py): `shared_mcp/app/shared_mcp/elevator_service/service.py`
- [Elevator state](https://github.com/microsoft/voice-agent/blob/main/shared_mcp/app/shared_mcp/elevator_service/store.py): `shared_mcp/app/shared_mcp/elevator_service/store.py`
- [Finance handoff](https://github.com/microsoft/voice-agent/blob/main/shared_mcp/app/shared_mcp/finance_handoff/service.py): `shared_mcp/app/shared_mcp/finance_handoff/service.py`
- [Finance data](https://github.com/microsoft/voice-agent/blob/main/shared_mcp/app/shared_mcp/finance_handoff/data.py): `shared_mcp/app/shared_mcp/finance_handoff/data.py`
- [OTP officer](https://github.com/microsoft/voice-agent/blob/main/shared_mcp/app/shared_mcp/finance_otp_officer/service.py): `shared_mcp/app/shared_mcp/finance_otp_officer/service.py`
- [Mock tool service](https://github.com/microsoft/voice-agent/blob/main/shared_mcp/app/shared_mcp/mock_tool_call/service.py): `shared_mcp/app/shared_mcp/mock_tool_call/service.py`

### Standalone utility

- [Cost calculator UI](https://github.com/microsoft/voice-agent/blob/main/tools/cost_calculator/app.mjs): `tools/cost_calculator/app.mjs`
- [Cost calculation](https://github.com/microsoft/voice-agent/blob/main/tools/cost_calculator/calculator.mjs): `tools/cost_calculator/calculator.mjs`

### Other components

- **Builder / caller**
- **Foundry voice service**

## Connections

- Builder / caller → Studio app: configures agent (evidence: `README.md`)
- Studio app → Agent configuration: renders (evidence: `portal/web/src/App.jsx`)
- Studio app → Agent review: renders (evidence: `portal/web/src/components/ReviewPanel.jsx`)
- Studio app → Handoff graph: renders (evidence: `portal/web/src/App.jsx`)
- Studio app → Voice session hook: starts session (evidence: `portal/web/src/App.jsx`)
- Voice session hook → Turn metrics: records tool calls (evidence: `portal/web/src/hooks/useVoiceSession.js`)
- Voice session hook → Client functions: resolves arguments (evidence: `portal/web/src/hooks/useVoiceSession.js`)
- Handoff graph → Handoff editor: uses editor core
- Voice session hook → Portal bridge: opens voice connection (evidence: `portal/web/src/hooks/useVoiceSession.js`)
- Portal bridge → Foundry voice service: proxies requests (evidence: `portal/demo_server.py`)
- Foundry voice service → Voice session hook: streams voice events (evidence: `portal/web/src/hooks/useVoiceSession.js`)
- Portal bridge → Voice policy: applies policy (evidence: `portal/demo_server.py`)
- Portal bridge → Session recording: records session events (evidence: `portal/demo_server.py`)
- Builder / caller → Voice session hook: speaks to agent (evidence: `README.md`)
- MCP host → Elevator tools: routes tools (evidence: `shared_mcp/app/shared_mcp/server.py`)
- MCP host → Finance handoff: routes tools (evidence: `shared_mcp/app/shared_mcp/server.py`)
- MCP host → OTP officer: routes tools (evidence: `shared_mcp/app/shared_mcp/server.py`)
- Elevator tools → Elevator state: reads and writes (evidence: `shared_mcp/app/shared_mcp/elevator_service/service.py`)
- Finance handoff → Finance data: uses data (evidence: `shared_mcp/app/shared_mcp/finance_handoff/service.py`)
- Builder / caller → Cost calculator UI: estimates costs (evidence: `tools/cost_calculator/app.mjs`)
- Cost calculator UI → Cost calculation: gets rates (evidence: `tools/cost_calculator/app.mjs`)
