# qwenaudio/qwen-audio-agent architecture

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

- Interactive diagram: https://gitdiagram.com/qwenaudio/qwen-audio-agent
- Repository: https://github.com/qwenaudio/qwen-audio-agent

## Overview

Qwen Audio Agent is a realtime voice runtime for persistent conversation alongside asynchronous Agent work. A user connects through Web, mobile, terminal, or desktop; the Gateway connects the voice frontend, handles conversation and tools, delegates sustained work to a backend Agent, and returns task progress and results to the conversation. The README documents this workflow and the broader capabilities shown here; sampled source confirms selected transport, task, delivery, and client behaviors, but not every subsystem’s internal wiring.

Main entry points: [`server/src/frontend/tools/frontend-tool-loop.mjs`](https://github.com/qwenaudio/qwen-audio-agent/blob/main/server/src/frontend/tools/frontend-tool-loop.mjs) (Frontend tools), [`server/src/app/gateway-application.mjs`](https://github.com/qwenaudio/qwen-audio-agent/blob/main/server/src/app/gateway-application.mjs) (Gateway application), [`server/src/task/task-manager.mjs`](https://github.com/qwenaudio/qwen-audio-agent/blob/main/server/src/task/task-manager.mjs) (Task manager), [`server/src/voice/realtime-session-runtime.mjs`](https://github.com/qwenaudio/qwen-audio-agent/blob/main/server/src/voice/realtime-session-runtime.mjs) (Voice session)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_clients["User clients"]
  node_web["Web UI<br/>[App.jsx]"]
  node_mobile["Mobile UI<br/>[main.jsx]"]
  node_tui["Terminal UI<br/>[index.mjs]"]
  node_desktop["Desktop app<br/>[main.mjs]"]
end

subgraph group_gateway["Gateway runtime"]
  node_transport["Gateway transport"]
  node_gatewayapp["Gateway application"]
  node_httproutes["HTTP routes"]
  node_protocol["Client protocol"]
end

subgraph group_voice["Realtime voice"]
  node_realtime["Voice session"]
  node_providers["Voice providers<br/>[registry.mjs]"]
  node_webrtc["WebRTC transport<br/>[routes.mjs]"]
end

subgraph group_work["Agent work"]
  node_coordinator["Task coordinator"]
  node_backends["Backend adapters"]
  node_tasks["Task manager<br/>[task-manager.mjs]"]
  node_taskstore[("Task state store<br/>[task-store.mjs]")]
  node_announcements["Task announcements"]
end

subgraph group_context["Tools and context"]
  node_tooling["Frontend tools"]
  node_retrieval["Web retrieval"]
  node_memory["Long-term memory<br/>[runtime.mjs]"]
  node_knowledge["Knowledge library<br/>[runtime.mjs]"]
end

node_user(("User"))

node_user -->|"uses"| node_web
node_user -->|"uses"| node_mobile
node_user -->|"uses"| node_tui
node_user -->|"uses"| node_desktop
node_web -->|"configures"| node_transport
node_mobile -->|"configures"| node_transport
node_transport -->|"connects"| node_gatewayapp
node_gatewayapp -->|"mounts"| node_httproutes
node_gatewayapp -->|"serves clients"| node_protocol
node_gatewayapp -->|"runs sessions"| node_realtime
node_providers -->|"provide voice"| node_realtime
node_httproutes -.->|"exposes"| node_webrtc
node_realtime -->|"invokes tools"| node_tooling
node_tooling -->|"supports search"| node_retrieval
node_tooling -->|"supports memory"| node_memory
node_tooling -->|"supports library"| node_knowledge
node_tooling -->|"delegates work"| node_coordinator
node_coordinator -->|"dispatches tasks"| node_backends
node_coordinator -->|"manages tasks"| node_tasks
node_tasks -->|"persists state"| node_taskstore
node_tasks -->|"reports completion"| node_announcements
node_announcements -->|"delivers updates"| node_realtime
node_tasks -->|"streams status"| node_httproutes

click node_web "https://github.com/qwenaudio/qwen-audio-agent/blob/main/web/src/App.jsx"
click node_mobile "https://github.com/qwenaudio/qwen-audio-agent/blob/main/mobile/src/main.jsx"
click node_tui "https://github.com/qwenaudio/qwen-audio-agent/blob/main/tui/src/index.mjs"
click node_desktop "https://github.com/qwenaudio/qwen-audio-agent/blob/main/desktop/src/main.mjs"
click node_transport "https://github.com/qwenaudio/qwen-audio-agent/blob/main/web/src/gateway-transport.js"
click node_gatewayapp "https://github.com/qwenaudio/qwen-audio-agent/blob/main/server/src/app/gateway-application.mjs"
click node_httproutes "https://github.com/qwenaudio/qwen-audio-agent/blob/main/server/src/app/gateway-http-routes.mjs"
click node_protocol "https://github.com/qwenaudio/qwen-audio-agent/blob/main/server/src/transport/gateway-client-protocol-session.mjs"
click node_realtime "https://github.com/qwenaudio/qwen-audio-agent/blob/main/server/src/voice/realtime-session-runtime.mjs"
click node_providers "https://github.com/qwenaudio/qwen-audio-agent/blob/main/server/src/voice/providers/registry.mjs"
click node_webrtc "https://github.com/qwenaudio/qwen-audio-agent/blob/main/server/src/transport/webrtc/routes.mjs"
click node_tooling "https://github.com/qwenaudio/qwen-audio-agent/blob/main/server/src/frontend/tools/frontend-tool-loop.mjs"
click node_retrieval "https://github.com/qwenaudio/qwen-audio-agent/blob/main/server/src/frontend/retrieval/frontend-retrieval-runtime.mjs"
click node_memory "https://github.com/qwenaudio/qwen-audio-agent/blob/main/server/src/memory/runtime.mjs"
click node_knowledge "https://github.com/qwenaudio/qwen-audio-agent/blob/main/server/src/knowledge/runtime.mjs"
click node_coordinator "https://github.com/qwenaudio/qwen-audio-agent/blob/main/server/src/orchestration/session-task-coordinator.mjs"
click node_backends "https://github.com/qwenaudio/qwen-audio-agent/blob/main/server/src/backend/adapters/acp/backend-adapter.mjs"
click node_tasks "https://github.com/qwenaudio/qwen-audio-agent/blob/main/server/src/task/task-manager.mjs"
click node_taskstore "https://github.com/qwenaudio/qwen-audio-agent/blob/main/server/src/task/task-store.mjs"
click node_announcements "https://github.com/qwenaudio/qwen-audio-agent/blob/main/server/src/voice/announcement/announcement-manager.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_web,node_mobile,node_tui,node_desktop,node_user toneBlue
class node_transport,node_gatewayapp,node_httproutes,node_protocol toneAmber
class node_realtime,node_providers,node_webrtc toneMint
class node_coordinator,node_backends,node_tasks,node_taskstore,node_announcements toneRose
class node_tooling,node_retrieval,node_memory,node_knowledge toneIndigo
```

## Components

### User clients

- [Web UI](https://github.com/qwenaudio/qwen-audio-agent/blob/main/web/src/App.jsx): `web/src/App.jsx`
- [Mobile UI](https://github.com/qwenaudio/qwen-audio-agent/blob/main/mobile/src/main.jsx): `mobile/src/main.jsx`
- [Terminal UI](https://github.com/qwenaudio/qwen-audio-agent/blob/main/tui/src/index.mjs): `tui/src/index.mjs`
- [Desktop app](https://github.com/qwenaudio/qwen-audio-agent/blob/main/desktop/src/main.mjs): `desktop/src/main.mjs`

### Gateway runtime

- [Gateway transport](https://github.com/qwenaudio/qwen-audio-agent/blob/main/web/src/gateway-transport.js): `web/src/gateway-transport.js`
- [Gateway application](https://github.com/qwenaudio/qwen-audio-agent/blob/main/server/src/app/gateway-application.mjs): `server/src/app/gateway-application.mjs`
- [HTTP routes](https://github.com/qwenaudio/qwen-audio-agent/blob/main/server/src/app/gateway-http-routes.mjs): `server/src/app/gateway-http-routes.mjs`
- [Client protocol](https://github.com/qwenaudio/qwen-audio-agent/blob/main/server/src/transport/gateway-client-protocol-session.mjs): `server/src/transport/gateway-client-protocol-session.mjs`

### Realtime voice

- [Voice session](https://github.com/qwenaudio/qwen-audio-agent/blob/main/server/src/voice/realtime-session-runtime.mjs): `server/src/voice/realtime-session-runtime.mjs`
- [Voice providers](https://github.com/qwenaudio/qwen-audio-agent/blob/main/server/src/voice/providers/registry.mjs): `server/src/voice/providers/registry.mjs`
- [WebRTC transport](https://github.com/qwenaudio/qwen-audio-agent/blob/main/server/src/transport/webrtc/routes.mjs): `server/src/transport/webrtc/routes.mjs`

### Agent work

- [Task coordinator](https://github.com/qwenaudio/qwen-audio-agent/blob/main/server/src/orchestration/session-task-coordinator.mjs): `server/src/orchestration/session-task-coordinator.mjs`
- [Backend adapters](https://github.com/qwenaudio/qwen-audio-agent/blob/main/server/src/backend/adapters/acp/backend-adapter.mjs): `server/src/backend/adapters/acp/backend-adapter.mjs`
- [Task manager](https://github.com/qwenaudio/qwen-audio-agent/blob/main/server/src/task/task-manager.mjs): `server/src/task/task-manager.mjs`
- [Task state store](https://github.com/qwenaudio/qwen-audio-agent/blob/main/server/src/task/task-store.mjs): `server/src/task/task-store.mjs`
- [Task announcements](https://github.com/qwenaudio/qwen-audio-agent/blob/main/server/src/voice/announcement/announcement-manager.mjs): `server/src/voice/announcement/announcement-manager.mjs`

### Tools and context

- [Frontend tools](https://github.com/qwenaudio/qwen-audio-agent/blob/main/server/src/frontend/tools/frontend-tool-loop.mjs): `server/src/frontend/tools/frontend-tool-loop.mjs`
- [Web retrieval](https://github.com/qwenaudio/qwen-audio-agent/blob/main/server/src/frontend/retrieval/frontend-retrieval-runtime.mjs): `server/src/frontend/retrieval/frontend-retrieval-runtime.mjs`
- [Long-term memory](https://github.com/qwenaudio/qwen-audio-agent/blob/main/server/src/memory/runtime.mjs): `server/src/memory/runtime.mjs`
- [Knowledge library](https://github.com/qwenaudio/qwen-audio-agent/blob/main/server/src/knowledge/runtime.mjs): `server/src/knowledge/runtime.mjs`

### Other components

- **User**

## Connections

- User → Web UI: uses
- User → Mobile UI: uses
- User → Terminal UI: uses
- User → Desktop app: uses
- Web UI → Gateway transport: configures
- Mobile UI → Gateway transport: configures
- Gateway transport → Gateway application: connects
- Gateway application → HTTP routes: mounts
- Gateway application → Client protocol: serves clients
- Gateway application → Voice session: runs sessions
- Voice providers → Voice session: provide voice
- HTTP routes → WebRTC transport: exposes
- Voice session → Frontend tools: invokes tools
- Frontend tools → Web retrieval: supports search
- Frontend tools → Long-term memory: supports memory
- Frontend tools → Knowledge library: supports library
- Frontend tools → Task coordinator: delegates work
- Task coordinator → Backend adapters: dispatches tasks
- Task coordinator → Task manager: manages tasks
- Task manager → Task state store: persists state
- Task manager → Task announcements: reports completion
- Task announcements → Voice session: delivers updates
- Task manager → HTTP routes: streams status
