# luisdomingo-devops/ai_manager architecture

> Architecture diagram of the GitHub repository luisdomingo-devops/ai_manager, 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/luisdomingo-devops/ai_manager
- Repository: https://github.com/luisdomingo-devops/ai_manager

## Overview

Alfonso is an on-premise-oriented business and fiscal assistant for Spanish self-employed users, with desktop and voice interfaces backed by a FastAPI service. The documented request path runs from user input through the API and planner to tools or specialist agents, with tenant-scoped memory and domain services supporting business operations. Fiscal work includes document parsing and tax calculation, followed by Veri*Factu compliance and signing. The README documents additional accounting, payroll, banking, and security capabilities; some wiring is not shown in the sampled source, so links to those subsystems are kept conservative.

Main entry points: [`app/domain/planner_orchestrator.py`](https://github.com/luisdomingo-devops/ai_manager/blob/main/app/domain/planner_orchestrator.py) (Planner orchestrator), [`app/tools/server`](https://github.com/luisdomingo-devops/ai_manager/tree/main/app/tools/server) (Server tools), [`app/main.py`](https://github.com/luisdomingo-devops/ai_manager/blob/main/app/main.py) (FastAPI application), [`client/cliente.py`](https://github.com/luisdomingo-devops/ai_manager/blob/main/client/cliente.py) (Voice client)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_client["User interfaces"]
  node_desktop["Desktop GUI<br/>[app.py]"]
  node_voice["Voice client<br/>[cliente.py]"]
  node_audio["Audio services<br/>[audio.py]"]
end

subgraph group_service["API and orchestration"]
  node_fastapi["FastAPI application<br/>[main.py]"]
  node_api_routes["API routes<br/>[routes.py]"]
  node_v1_routes["Business API"]
  node_planner["Planner orchestrator"]
  node_tool_registry["Tool registry<br/>[tool_registry.py]"]
  node_server_tools["Server tools"]
  node_agents["Specialist agents"]
end

subgraph group_business["Business and fiscal"]
  node_importer["Document import"]
  node_tax_engine["Tax engine<br/>[tax_engine.py]"]
  node_verifactu["VeriFactu invoicing"]
  node_signing["Document signing"]
  node_accounting["Accounting and ledger<br/>[ledger_service.py]"]
  node_payroll["Payroll<br/>[payroll_engine.py]"]
  node_banking["Banking<br/>[bank_service.py]"]
end

subgraph group_state["Tenant state"]
  node_tenant_db[("Tenant SQLite")]
  node_memory["Memory adapters"]
end

subgraph group_integrations["Integrations and security"]
  node_event_bus["Event bus<br/>[events.py]"]
  node_llm["LLM client<br/>[llm_client.py]"]
  node_security["Security monitoring<br/>[security_agent.py]"]
  node_bank_providers["Bank providers<br/>[bank_providers.py]"]
end

node_user(("Autonomous user"))
node_external_llm(("Gemini service"))
node_aeat(("AEAT services"))

node_user -->|"uses"| node_desktop
node_user -->|"speaks to"| node_voice
node_desktop -->|"API requests"| node_fastapi
node_voice -->|"captures speech"| node_audio
node_voice -->|"sends chat"| node_fastapi
node_fastapi -->|"serves routes"| node_api_routes
node_fastapi -->|"serves routers"| node_v1_routes
node_api_routes -->|"delegates requests"| node_planner
node_v1_routes -.->|"delegates chat"| node_planner
node_planner -->|"resolves tools"| node_tool_registry
node_tool_registry -->|"dispatches"| node_server_tools
node_planner -->|"routes tasks"| node_agents
node_planner -->|"requests inference"| node_llm
node_planner -.->|"uses context"| node_memory
node_server_tools -.->|"invokes import"| node_importer
node_importer -.->|"parses for tax"| node_tax_engine
node_server_tools -.->|"invokes invoicing"| node_verifactu
node_verifactu -.->|"signs documents"| node_signing
node_server_tools -.->|"invokes accounting"| node_accounting
node_server_tools -.->|"invokes payroll"| node_payroll
node_server_tools -.->|"invokes banking"| node_banking
node_banking -.->|"connects providers"| node_bank_providers
node_memory -->|"reads and writes"| node_tenant_db
node_planner -.->|"publishes events"| node_event_bus
node_llm -->|"sends prompts"| node_external_llm
node_security -.->|"monitors service"| node_fastapi
node_verifactu -.->|"reports invoices"| node_aeat

click node_desktop "https://github.com/luisdomingo-devops/ai_manager/blob/main/client/gui/app.py"
click node_voice "https://github.com/luisdomingo-devops/ai_manager/blob/main/client/cliente.py"
click node_audio "https://github.com/luisdomingo-devops/ai_manager/blob/main/client/services/audio.py"
click node_fastapi "https://github.com/luisdomingo-devops/ai_manager/blob/main/app/main.py"
click node_api_routes "https://github.com/luisdomingo-devops/ai_manager/blob/main/app/api/routes.py"
click node_v1_routes "https://github.com/luisdomingo-devops/ai_manager/tree/main/app/api/v1"
click node_planner "https://github.com/luisdomingo-devops/ai_manager/blob/main/app/domain/planner_orchestrator.py"
click node_tool_registry "https://github.com/luisdomingo-devops/ai_manager/blob/main/app/infrastructure/adapters/tool_registry.py"
click node_server_tools "https://github.com/luisdomingo-devops/ai_manager/tree/main/app/tools/server"
click node_agents "https://github.com/luisdomingo-devops/ai_manager/tree/main/app/domain/agents"
click node_importer "https://github.com/luisdomingo-devops/ai_manager/blob/main/app/domain/services/import_service/import_orchestrator.py"
click node_tax_engine "https://github.com/luisdomingo-devops/ai_manager/blob/main/app/domain/services/tax_engine.py"
click node_verifactu "https://github.com/luisdomingo-devops/ai_manager/blob/main/app/domain/services/verifactu_service.py"
click node_signing "https://github.com/luisdomingo-devops/ai_manager/blob/main/app/domain/services/signature_service.py"
click node_accounting "https://github.com/luisdomingo-devops/ai_manager/blob/main/app/domain/services/ledger_service.py"
click node_payroll "https://github.com/luisdomingo-devops/ai_manager/blob/main/app/domain/services/payroll_engine.py"
click node_banking "https://github.com/luisdomingo-devops/ai_manager/blob/main/app/domain/services/bank_service.py"
click node_tenant_db "https://github.com/luisdomingo-devops/ai_manager/blob/main/app/infrastructure/database/connection_manager.py"
click node_memory "https://github.com/luisdomingo-devops/ai_manager/tree/main/app/adapters/memory"
click node_event_bus "https://github.com/luisdomingo-devops/ai_manager/blob/main/app/core/events.py"
click node_llm "https://github.com/luisdomingo-devops/ai_manager/blob/main/app/infrastructure/adapters/llm_client.py"
click node_security "https://github.com/luisdomingo-devops/ai_manager/blob/main/app/domain/agents/security/security_agent.py"
click node_bank_providers "https://github.com/luisdomingo-devops/ai_manager/blob/main/app/infrastructure/adapters/bank_providers.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_desktop,node_voice,node_audio,node_user toneBlue
class node_fastapi,node_api_routes,node_v1_routes,node_planner,node_tool_registry,node_server_tools,node_agents toneAmber
class node_importer,node_tax_engine,node_verifactu,node_signing,node_accounting,node_payroll,node_banking toneMint
class node_tenant_db,node_memory toneRose
class node_event_bus,node_llm,node_security,node_bank_providers,node_external_llm,node_aeat toneIndigo
```

## Components

### User interfaces

- [Desktop GUI](https://github.com/luisdomingo-devops/ai_manager/blob/main/client/gui/app.py): `client/gui/app.py`
- [Voice client](https://github.com/luisdomingo-devops/ai_manager/blob/main/client/cliente.py): `client/cliente.py`
- [Audio services](https://github.com/luisdomingo-devops/ai_manager/blob/main/client/services/audio.py): `client/services/audio.py`

### API and orchestration

- [FastAPI application](https://github.com/luisdomingo-devops/ai_manager/blob/main/app/main.py): `app/main.py`
- [API routes](https://github.com/luisdomingo-devops/ai_manager/blob/main/app/api/routes.py): `app/api/routes.py`
- [Business API](https://github.com/luisdomingo-devops/ai_manager/tree/main/app/api/v1): `app/api/v1`
- [Planner orchestrator](https://github.com/luisdomingo-devops/ai_manager/blob/main/app/domain/planner_orchestrator.py): `app/domain/planner_orchestrator.py`
- [Tool registry](https://github.com/luisdomingo-devops/ai_manager/blob/main/app/infrastructure/adapters/tool_registry.py): `app/infrastructure/adapters/tool_registry.py`
- [Server tools](https://github.com/luisdomingo-devops/ai_manager/tree/main/app/tools/server): `app/tools/server`
- [Specialist agents](https://github.com/luisdomingo-devops/ai_manager/tree/main/app/domain/agents): `app/domain/agents`

### Business and fiscal

- [Document import](https://github.com/luisdomingo-devops/ai_manager/blob/main/app/domain/services/import_service/import_orchestrator.py): `app/domain/services/import_service/import_orchestrator.py`
- [Tax engine](https://github.com/luisdomingo-devops/ai_manager/blob/main/app/domain/services/tax_engine.py): `app/domain/services/tax_engine.py`
- [VeriFactu invoicing](https://github.com/luisdomingo-devops/ai_manager/blob/main/app/domain/services/verifactu_service.py): `app/domain/services/verifactu_service.py`
- [Document signing](https://github.com/luisdomingo-devops/ai_manager/blob/main/app/domain/services/signature_service.py): `app/domain/services/signature_service.py`
- [Accounting and ledger](https://github.com/luisdomingo-devops/ai_manager/blob/main/app/domain/services/ledger_service.py): `app/domain/services/ledger_service.py`
- [Payroll](https://github.com/luisdomingo-devops/ai_manager/blob/main/app/domain/services/payroll_engine.py): `app/domain/services/payroll_engine.py`
- [Banking](https://github.com/luisdomingo-devops/ai_manager/blob/main/app/domain/services/bank_service.py): `app/domain/services/bank_service.py`

### Tenant state

- [Tenant SQLite](https://github.com/luisdomingo-devops/ai_manager/blob/main/app/infrastructure/database/connection_manager.py): `app/infrastructure/database/connection_manager.py`
- [Memory adapters](https://github.com/luisdomingo-devops/ai_manager/tree/main/app/adapters/memory): `app/adapters/memory`

### Integrations and security

- [Event bus](https://github.com/luisdomingo-devops/ai_manager/blob/main/app/core/events.py): `app/core/events.py`
- [LLM client](https://github.com/luisdomingo-devops/ai_manager/blob/main/app/infrastructure/adapters/llm_client.py): `app/infrastructure/adapters/llm_client.py`
- [Security monitoring](https://github.com/luisdomingo-devops/ai_manager/blob/main/app/domain/agents/security/security_agent.py): `app/domain/agents/security/security_agent.py`
- [Bank providers](https://github.com/luisdomingo-devops/ai_manager/blob/main/app/infrastructure/adapters/bank_providers.py): `app/infrastructure/adapters/bank_providers.py`

### Other components

- **Autonomous user**
- **Gemini service**
- **AEAT services**

## Connections

- Autonomous user → Desktop GUI: uses
- Autonomous user → Voice client: speaks to
- Desktop GUI → FastAPI application: API requests
- Voice client → Audio services: captures speech
- Voice client → FastAPI application: sends chat
- FastAPI application → API routes: serves routes
- FastAPI application → Business API: serves routers
- API routes → Planner orchestrator: delegates requests
- Business API → Planner orchestrator: delegates chat
- Planner orchestrator → Tool registry: resolves tools
- Tool registry → Server tools: dispatches
- Planner orchestrator → Specialist agents: routes tasks
- Planner orchestrator → LLM client: requests inference
- Planner orchestrator → Memory adapters: uses context
- Server tools → Document import: invokes import
- Document import → Tax engine: parses for tax
- Server tools → VeriFactu invoicing: invokes invoicing
- VeriFactu invoicing → Document signing: signs documents
- Server tools → Accounting and ledger: invokes accounting
- Server tools → Payroll: invokes payroll
- Server tools → Banking: invokes banking
- Banking → Bank providers: connects providers
- Memory adapters → Tenant SQLite: reads and writes
- Planner orchestrator → Event bus: publishes events
- LLM client → Gemini service: sends prompts
- Security monitoring → FastAPI application: monitors service
- VeriFactu invoicing → AEAT services: reports invoices
