# oussama-sil/s2s_conversational_agent architecture

> Architecture diagram of the GitHub repository oussama-sil/s2s_conversational_agent, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2025-06-08). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/oussama-sil/s2s_conversational_agent
- Repository: https://github.com/oussama-sil/s2s_conversational_agent

## Overview

##### Project type and purpose
- This is an incremental, streaming **Speech-to-Speech Conversational Agent** built on the Retico framework.
- Core functionality: real-time VAD → ASR → NLG → TTS, with optional NVIDIA Audio2Face facial animation.

##### File structure (focus on modules, ignore orchestration/support files)
- vad.py → Voice Activity Detection
- asr.py → Automatic Speech Recognition
- nlg.py → Natural Language Generation
- tts.py → Text-to-Speech synthesis
- a2f.py → Optional Audio2Face integration
- main.py → Pipeline entry point (orchestrates modules)
- Omit: console_colors.py, assets/, requirements.txt, other support files

##### README insights
- VAD: webrtcvad
- ASR: OpenAI Whisper (via Retico)
- NLG: LLM (vLLM server)
- TTS: Kokoro-82M
- A2F: NVIDIA Audio2Face (REST/gRPC)

##### Detailed capture of essential elements
- Do **not** include support/orchestration files like console_colors.py or assets.
- Only the functional modules and their dependencies.
- Both output sinks from TTS:

## Diagram (Mermaid)

```mermaid
flowchart TD
    %% I/O Layer
    Mic["/Microphone (Audio In)/"]:::io
    Speaker["/Speaker (Audio Out)/"]:::io

    %% Pipeline Modules
    subgraph "Pipeline Modules"
        direction TB
        VAD["VAD Module"]:::pipeline
        ASR["ASR Module"]:::pipeline
        NLG["NLG Module"]:::pipeline
        TTS["TTS Module"]:::pipeline
    end

    %% External Services
    subgraph "External Services"
        direction TB
        vLLM[(vLLM HTTP API)]:::external
        A2F[(Audio2Face Service)]:::external
    end

    %% Data Flows
    Mic -->|"streamed audio frames"| VAD
    VAD -->|"voice segments"| ASR
    ASR -->|"transcribed text"| NLG
    NLG -->|"text prompts"| vLLM
    vLLM -->|"generated response"| NLG
    NLG -->|"response text"| TTS
    TTS -->|"synthesized audio"| Speaker
    TTS -.->|"optional audio stream"| A2F

    %% Click Events
    click VAD "https://github.com/oussama-sil/s2s_conversational_agent/blob/main/vad.py"
    click ASR "https://github.com/oussama-sil/s2s_conversational_agent/blob/main/asr.py"
    click NLG "https://github.com/oussama-sil/s2s_conversational_agent/blob/main/nlg.py"
    click TTS "https://github.com/oussama-sil/s2s_conversational_agent/blob/main/tts.py"
    click A2F "https://github.com/oussama-sil/s2s_conversational_agent/blob/main/a2f.py"

    %% Styles
    classDef pipeline fill:#cce5ff,stroke:#3399ff,stroke-width:2px
    classDef external fill:#e2e3e5,stroke:#6c757d,stroke-width:2px,stroke-dasharray: 5 5
    classDef io fill:#d4edda,stroke:#28a745,stroke-width:2px
```
