# atharva3131/autonomous-ai-system-for-revenue-operations-aaro- architecture

> Architecture diagram of the GitHub repository atharva3131/autonomous-ai-system-for-revenue-operations-aaro-, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-07-20). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/atharva3131/autonomous-ai-system-for-revenue-operations-aaro-
- Repository: https://github.com/atharva3131/autonomous-ai-system-for-revenue-operations-aaro-

## Overview

#### Purpose and Runtime

AARO is a Python 3.9+ API service for autonomous B2B revenue operations: ingest CRM data, identify pipeline risks/SOP gaps, produce decisions using sales knowledge, execute corrective actions, and route impactful work through approval. The primary entry point is the ASGI application in `aboa/main.py`, launched with `python -m aboa.main` or Uvicorn. A lightweight separate demo UI exists in `ui/server.py` and `ui/app.js`.

#### API Composition and Cross-Cutting Platform

`aboa/main.py` is the composition root for feature APIs and platform concerns. Core services provide authentication, tenant context, middleware, health endpoints, configuration, logging, and monitoring:
- `aboa/core/auth.py`
- `aboa/core/tenant.py`
- `aboa/core/health.py`

These establish request-level security/isolation and operational boundaries before requests reach domain modules. Environment-driven settings are centralized in `aboa/core/config.py`.

#### Data Ingestion Boundary

The ingestion layer exposes CRM-facing APIs and normalizes externally sourced sales data—deals, pipeline state, and activity—into the application’s revenue domain:
- `aboa/data_ingestion/api.py`
- `aboa/data_ingestion/service.py`
- `aboa/data_ingestion/connectors.py`

Connectors are the external-system boundary; the service should isolate provider-specific retrieval/normalization from downstream intelligence. Shared revenue entities and statuses are represented in `aboa/models/revenue_entities.py` and `aboa/models/enums.py`.

#### Revenue Intelligence and Decisioning

The decision subsystem transforms normalized pipeline signals into prioritized revenue interventions. Pipeline-risk detection identifies stalled deals, missing follow-ups, inactive high-value opportunities, and SOP deviations; velocity and sales-process optimizers assess execution improvements:
- `aboa/decision/pipeline_risk_detector.py`
- `aboa/decision/revenue_decision_engine.py`
- `aboa/decision/pipeline_velocity_optimizer.py`

Its API boundary is `aboa/decision/api.py`. This stage consumes ingestion outputs plus knowledge context, then emits decisions suitable for execution or approval.

#### Knowledge / RAG Context

Sales SOPs, playbooks, and successful-pattern context are managed behind a dedicated knowledge subsystem:
- `aboa/knowledge/manager.py`
- `aboa/knowledge/embeddings.py`
- `aboa/knowledge/vector_store.py`

This is the RAG and vector-database integration boundary. Decisioning should request relevant policy/context through the knowledge manager rather than couple directly to embedding or vector-store implementations.

#### Human Approval and Notifications

High-impact decisions are held at a human-control boundary rather than executed autonomously:
- `aboa/human_loop/api.py`
- `aboa/human_loop/approval_handlers.py`
- `aboa/human_loop/notification_service.py`

Approval models and sales-manager interactions live in `aboa/human_loop/models.py` and `aboa/human_loop/sales_manager_interface.py`. Approved/rejected outcomes feed back into action execution.

#### Action Execution and External Integrations

The action layer executes approved or policy-safe interventions—tasks, follow-up messages, CRM updates, and manager alerts—with retry-oriented engine behavior:
- `aboa/action/engine.py`
- `aboa/action/integration_hub.py`
- `aboa/action/api.py`

`integration_hub.py` is the preferred boundary for outbound CRM/workflow/notification services. `aboa/orchestration.py` likely coordinates the end-to-end control flow: ingest → detect/decide → approve when needed → execute → observe.

#### Observability and Deployment

Revenue-impact activity and operational metrics are captured separately from business execution:
- `aboa/observability/activity_logger.py`
- `aboa/observability/metrics_collector.py`
- `aboa/observability/api.py`

Infrastructure supports containerized deployment via `Dockerfile`, `docker-compose.yml`, and Kubernetes manifests under `k8s/`. Database schema and audit evolution are provisioned through `scripts/init-db.sql` and `scripts/migrations/`, while Kubernetes monitoring configuration is in `k8s/monitoring.yaml`.

Main entry points: [`aboa/main.py`](https://github.com/atharva3131/autonomous-ai-system-for-revenue-operations-aaro-/blob/main/aboa/main.py) (ASGI API application), [`aboa/decision/revenue_decision_engine.py`](https://github.com/atharva3131/autonomous-ai-system-for-revenue-operations-aaro-/blob/main/aboa/decision/revenue_decision_engine.py) (Revenue decision engine), [`aboa/data_ingestion/service.py`](https://github.com/atharva3131/autonomous-ai-system-for-revenue-operations-aaro-/blob/main/aboa/data_ingestion/service.py) (CRM normalization service), [`aboa/action/engine.py`](https://github.com/atharva3131/autonomous-ai-system-for-revenue-operations-aaro-/blob/main/aboa/action/engine.py) (Action engine)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_runtime["Runtime"]
  node_api_app["ASGI API application<br/>composition root<br/>[main.py]"]
  node_demo_ui["Demo UI<br/>separate UI runtime<br/>[server.py]"]
  node_orchestrator["End-to-end orchestrator<br/>control-flow coordinator<br/>[orchestration.py]"]
end

subgraph group_ingestion["Data Ingestion"]
  node_revenue_models["Revenue entities<br/>shared domain model"]
  node_ingestion_api["Ingestion API<br/>feature API<br/>[api.py]"]
  node_ingestion_service["CRM normalization service<br/>ingestion service<br/>[service.py]"]
  node_crm_connectors{{"CRM connectors<br/>provider boundary<br/>[connectors.py]"}}
  node_external_crm{{"CRM providers<br/>external system"}}
end

subgraph group_intelligence["Revenue Intelligence"]
  node_decision_api["Decision API<br/>feature API<br/>[api.py]"]
  node_decision_engine["Revenue decision engine<br/>decision service"]
  node_risk_detector["Pipeline risk detector<br/>signal analysis"]
  node_knowledge_manager["Knowledge manager<br/>RAG boundary<br/>[manager.py]"]
  node_vector_store[("Vector store integration<br/>knowledge storage<br/>[vector_store.py]")]
end

subgraph group_control["Human Control &amp; Actions"]
  node_approval_api["Approval API<br/>feature API<br/>[api.py]"]
  node_approval_handlers["Approval handlers<br/>human-control workflow"]
  node_action_engine["Action engine<br/>execution workflow<br/>[engine.py]"]
  node_integration_hub{{"Integration hub<br/>outbound boundary<br/>[integration_hub.py]"}}
end

subgraph group_platform["Platform"]
  node_request_security["Auth &amp; tenant context<br/>request boundary<br/>[auth.py]"]
  node_settings["Environment settings<br/>configuration<br/>[config.py]"]
  node_health["Health endpoints<br/>operations API<br/>[health.py]"]
  node_observability["Activity &amp; metrics<br/>observability<br/>[activity_logger.py]"]
end

node_api_app -->|"applies"| node_request_security
node_api_app -->|"loads"| node_settings
node_api_app -->|"serves"| node_health
node_api_app -->|"mounts"| node_ingestion_api
node_api_app -->|"mounts"| node_decision_api
node_api_app -->|"mounts"| node_approval_api
node_demo_ui -->|"uses"| node_api_app
node_ingestion_api -->|"ingests"| node_ingestion_service
node_ingestion_service -->|"retrieves from"| node_crm_connectors
node_crm_connectors -->|"connects to"| node_external_crm
node_ingestion_service -->|"normalizes into"| node_revenue_models
node_orchestrator -->|"starts ingestion"| node_ingestion_service
node_orchestrator -->|"requests decision"| node_decision_engine
node_revenue_models -->|"supplies pipeline signals"| node_risk_detector
node_risk_detector -->|"reports risks"| node_decision_engine
node_decision_api -->|"requests"| node_decision_engine
node_decision_engine -->|"retrieves context"| node_knowledge_manager
node_knowledge_manager -->|"queries"| node_vector_store
node_decision_engine -->|"submits high-impact work"| node_approval_handlers
node_approval_api -->|"manages"| node_approval_handlers
node_approval_handlers -->|"approved outcome"| node_action_engine
node_decision_engine -.->|"policy-safe action"| node_action_engine
node_action_engine -->|"executes through"| node_integration_hub
node_orchestrator -->|"records lifecycle"| node_observability
node_action_engine -->|"emits activity"| node_observability

click node_api_app "https://github.com/atharva3131/autonomous-ai-system-for-revenue-operations-aaro-/blob/main/aboa/main.py"
click node_demo_ui "https://github.com/atharva3131/autonomous-ai-system-for-revenue-operations-aaro-/blob/main/ui/server.py"
click node_request_security "https://github.com/atharva3131/autonomous-ai-system-for-revenue-operations-aaro-/blob/main/aboa/core/auth.py"
click node_settings "https://github.com/atharva3131/autonomous-ai-system-for-revenue-operations-aaro-/blob/main/aboa/core/config.py"
click node_health "https://github.com/atharva3131/autonomous-ai-system-for-revenue-operations-aaro-/blob/main/aboa/core/health.py"
click node_revenue_models "https://github.com/atharva3131/autonomous-ai-system-for-revenue-operations-aaro-/blob/main/aboa/models/revenue_entities.py"
click node_ingestion_api "https://github.com/atharva3131/autonomous-ai-system-for-revenue-operations-aaro-/blob/main/aboa/data_ingestion/api.py"
click node_ingestion_service "https://github.com/atharva3131/autonomous-ai-system-for-revenue-operations-aaro-/blob/main/aboa/data_ingestion/service.py"
click node_crm_connectors "https://github.com/atharva3131/autonomous-ai-system-for-revenue-operations-aaro-/blob/main/aboa/data_ingestion/connectors.py"
click node_decision_api "https://github.com/atharva3131/autonomous-ai-system-for-revenue-operations-aaro-/blob/main/aboa/decision/api.py"
click node_decision_engine "https://github.com/atharva3131/autonomous-ai-system-for-revenue-operations-aaro-/blob/main/aboa/decision/revenue_decision_engine.py"
click node_risk_detector "https://github.com/atharva3131/autonomous-ai-system-for-revenue-operations-aaro-/blob/main/aboa/decision/pipeline_risk_detector.py"
click node_knowledge_manager "https://github.com/atharva3131/autonomous-ai-system-for-revenue-operations-aaro-/blob/main/aboa/knowledge/manager.py"
click node_vector_store "https://github.com/atharva3131/autonomous-ai-system-for-revenue-operations-aaro-/blob/main/aboa/knowledge/vector_store.py"
click node_approval_api "https://github.com/atharva3131/autonomous-ai-system-for-revenue-operations-aaro-/blob/main/aboa/human_loop/api.py"
click node_approval_handlers "https://github.com/atharva3131/autonomous-ai-system-for-revenue-operations-aaro-/blob/main/aboa/human_loop/approval_handlers.py"
click node_action_engine "https://github.com/atharva3131/autonomous-ai-system-for-revenue-operations-aaro-/blob/main/aboa/action/engine.py"
click node_integration_hub "https://github.com/atharva3131/autonomous-ai-system-for-revenue-operations-aaro-/blob/main/aboa/action/integration_hub.py"
click node_observability "https://github.com/atharva3131/autonomous-ai-system-for-revenue-operations-aaro-/blob/main/aboa/observability/activity_logger.py"
click node_orchestrator "https://github.com/atharva3131/autonomous-ai-system-for-revenue-operations-aaro-/blob/main/aboa/orchestration.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_api_app,node_demo_ui,node_orchestrator toneBlue
class node_revenue_models,node_ingestion_api,node_ingestion_service,node_crm_connectors,node_external_crm toneAmber
class node_decision_api,node_decision_engine,node_risk_detector,node_knowledge_manager,node_vector_store toneMint
class node_approval_api,node_approval_handlers,node_action_engine,node_integration_hub toneRose
class node_request_security,node_settings,node_health,node_observability toneIndigo
```

## Components

### Runtime

- [ASGI API application](https://github.com/atharva3131/autonomous-ai-system-for-revenue-operations-aaro-/blob/main/aboa/main.py): composition root · Composes feature APIs and request platform concerns. · `aboa/main.py`
- [Demo UI](https://github.com/atharva3131/autonomous-ai-system-for-revenue-operations-aaro-/blob/main/ui/server.py): separate UI runtime · `ui/server.py`
- [End-to-end orchestrator](https://github.com/atharva3131/autonomous-ai-system-for-revenue-operations-aaro-/blob/main/aboa/orchestration.py): control-flow coordinator · Coordinates ingest, decide, approve, execute, and observe. · `aboa/orchestration.py`

### Data Ingestion

- [Revenue entities](https://github.com/atharva3131/autonomous-ai-system-for-revenue-operations-aaro-/blob/main/aboa/models/revenue_entities.py): shared domain model · Normalized deals, pipeline state, activity, and statuses. · `aboa/models/revenue_entities.py`
- [Ingestion API](https://github.com/atharva3131/autonomous-ai-system-for-revenue-operations-aaro-/blob/main/aboa/data_ingestion/api.py): feature API · `aboa/data_ingestion/api.py`
- [CRM normalization service](https://github.com/atharva3131/autonomous-ai-system-for-revenue-operations-aaro-/blob/main/aboa/data_ingestion/service.py): ingestion service · Isolates provider retrieval and normalization. · `aboa/data_ingestion/service.py`
- [CRM connectors](https://github.com/atharva3131/autonomous-ai-system-for-revenue-operations-aaro-/blob/main/aboa/data_ingestion/connectors.py): provider boundary · `aboa/data_ingestion/connectors.py`
- **CRM providers**: external system

### Revenue Intelligence

- [Decision API](https://github.com/atharva3131/autonomous-ai-system-for-revenue-operations-aaro-/blob/main/aboa/decision/api.py): feature API · `aboa/decision/api.py`
- [Revenue decision engine](https://github.com/atharva3131/autonomous-ai-system-for-revenue-operations-aaro-/blob/main/aboa/decision/revenue_decision_engine.py): decision service · Prioritizes revenue interventions from signals and context. · `aboa/decision/revenue_decision_engine.py`
- [Pipeline risk detector](https://github.com/atharva3131/autonomous-ai-system-for-revenue-operations-aaro-/blob/main/aboa/decision/pipeline_risk_detector.py): signal analysis · Finds stalled, inactive, and SOP-deviant opportunities. · `aboa/decision/pipeline_risk_detector.py`
- [Knowledge manager](https://github.com/atharva3131/autonomous-ai-system-for-revenue-operations-aaro-/blob/main/aboa/knowledge/manager.py): RAG boundary · Provides relevant SOP, playbook, and success-pattern context. · `aboa/knowledge/manager.py`
- [Vector store integration](https://github.com/atharva3131/autonomous-ai-system-for-revenue-operations-aaro-/blob/main/aboa/knowledge/vector_store.py): knowledge storage · `aboa/knowledge/vector_store.py`

### Human Control & Actions

- [Approval API](https://github.com/atharva3131/autonomous-ai-system-for-revenue-operations-aaro-/blob/main/aboa/human_loop/api.py): feature API · `aboa/human_loop/api.py`
- [Approval handlers](https://github.com/atharva3131/autonomous-ai-system-for-revenue-operations-aaro-/blob/main/aboa/human_loop/approval_handlers.py): human-control workflow · Routes high-impact decisions for manager approval or rejection. · `aboa/human_loop/approval_handlers.py`
- [Action engine](https://github.com/atharva3131/autonomous-ai-system-for-revenue-operations-aaro-/blob/main/aboa/action/engine.py): execution workflow · Executes policy-safe or approved interventions with retries. · `aboa/action/engine.py`
- [Integration hub](https://github.com/atharva3131/autonomous-ai-system-for-revenue-operations-aaro-/blob/main/aboa/action/integration_hub.py): outbound boundary · Connects CRM, workflow, and notification services. · `aboa/action/integration_hub.py`

### Platform

- [Auth & tenant context](https://github.com/atharva3131/autonomous-ai-system-for-revenue-operations-aaro-/blob/main/aboa/core/auth.py): request boundary · Applies request security and tenant isolation. · `aboa/core/auth.py`
- [Environment settings](https://github.com/atharva3131/autonomous-ai-system-for-revenue-operations-aaro-/blob/main/aboa/core/config.py): configuration · `aboa/core/config.py`
- [Health endpoints](https://github.com/atharva3131/autonomous-ai-system-for-revenue-operations-aaro-/blob/main/aboa/core/health.py): operations API · `aboa/core/health.py`
- [Activity & metrics](https://github.com/atharva3131/autonomous-ai-system-for-revenue-operations-aaro-/blob/main/aboa/observability/activity_logger.py): observability · Records revenue-impact activity and operational metrics. · `aboa/observability/activity_logger.py`

## Connections

- ASGI API application → Auth & tenant context: applies
- ASGI API application → Environment settings: loads
- ASGI API application → Health endpoints: serves
- ASGI API application → Ingestion API: mounts
- ASGI API application → Decision API: mounts
- ASGI API application → Approval API: mounts
- Demo UI → ASGI API application: uses
- Ingestion API → CRM normalization service: ingests
- CRM normalization service → CRM connectors: retrieves from
- CRM connectors → CRM providers: connects to
- CRM normalization service → Revenue entities: normalizes into
- End-to-end orchestrator → CRM normalization service: starts ingestion
- End-to-end orchestrator → Revenue decision engine: requests decision
- Revenue entities → Pipeline risk detector: supplies pipeline signals
- Pipeline risk detector → Revenue decision engine: reports risks
- Decision API → Revenue decision engine: requests
- Revenue decision engine → Knowledge manager: retrieves context
- Knowledge manager → Vector store integration: queries
- Revenue decision engine → Approval handlers: submits high-impact work
- Approval API → Approval handlers: manages
- Approval handlers → Action engine: approved outcome
- Revenue decision engine → Action engine: policy-safe action
- Action engine → Integration hub: executes through
- End-to-end orchestrator → Activity & metrics: records lifecycle
- Action engine → Activity & metrics: emits activity
