# indrayaniparande/autostream-conversation-ai-agent architecture

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

- Interactive diagram: https://gitdiagram.com/indrayaniparande/autostream-conversation-ai-agent
- Repository: https://github.com/indrayaniparande/autostream-conversation-ai-agent

## Overview

AutoStream is a conversational sales agent that answers product questions and qualifies prospective customers. In the implemented CLI workflow, `main.py` dispatches each turn by the current stage; chat classifies intent, extracts lead details, and uses retrieval for product inquiries. High-intent users are prompted for name, email, and platform before lead capture. The README describes LangGraph routing and WhatsApp as deployment options, but the shown CLI directly calls node functions and no WhatsApp transport is present. The knowledge base is a local JSON file; lead capture is a mock function. Relationships reflect shown calls and reads.

Main entry points: [`main.py`](https://github.com/indrayaniparande/autostream-conversation-ai-agent/blob/main/main.py) (CLI turn loop), [`agent/graph.py`](https://github.com/indrayaniparande/autostream-conversation-ai-agent/blob/main/agent/graph.py) (Chat handler), [`agent/rag.py`](https://github.com/indrayaniparande/autostream-conversation-ai-agent/blob/main/agent/rag.py) (Keyword retrieval), [`knowledge_base/autostream_kb.json`](https://github.com/indrayaniparande/autostream-conversation-ai-agent/blob/main/knowledge_base/autostream_kb.json) (AutoStream knowledge)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_conversation["Conversation"]
  node_cli["CLI turn loop<br/>[main.py]"]
  node_chat["Chat handler<br/>[graph.py]"]
  node_intent["Intent classifier<br/>[graph.py]"]
end

subgraph group_knowledge["Product knowledge"]
  node_retrieval["Keyword retrieval<br/>[rag.py]"]
  node_kb["AutoStream knowledge<br/>[autostream_kb.json]"]
end

subgraph group_leads["Lead qualification"]
  node_name["Name collection<br/>[graph.py]"]
  node_email["Email collection<br/>[graph.py]"]
  node_platform["Platform collection<br/>[graph.py]"]
  node_capture["Lead capture handler<br/>[graph.py]"]
  node_mock["Mock lead capture<br/>[lead_capture.py]"]
end

node_user(("CLI user"))
node_llm["OpenAI model"]

node_user -->|"enters message"| node_cli
node_cli -->|"dispatches chat"| node_chat
node_cli -->|"dispatches stage"| node_name
node_cli -->|"dispatches stage"| node_email
node_cli -->|"dispatches stage"| node_platform
node_platform -->|"calls capture"| node_capture
node_chat -->|"classifies intent"| node_intent
node_intent -->|"invokes fallback"| node_llm
node_chat -->|"generates reply"| node_llm
node_chat -->|"retrieves context"| node_retrieval
node_retrieval -->|"reads knowledge"| node_kb
node_chat -->|"captures complete lead"| node_capture
node_capture -->|"records lead"| node_mock

click node_cli "https://github.com/indrayaniparande/autostream-conversation-ai-agent/blob/main/main.py"
click node_chat "https://github.com/indrayaniparande/autostream-conversation-ai-agent/blob/main/agent/graph.py"
click node_intent "https://github.com/indrayaniparande/autostream-conversation-ai-agent/blob/main/agent/graph.py"
click node_retrieval "https://github.com/indrayaniparande/autostream-conversation-ai-agent/blob/main/agent/rag.py"
click node_kb "https://github.com/indrayaniparande/autostream-conversation-ai-agent/blob/main/knowledge_base/autostream_kb.json"
click node_name "https://github.com/indrayaniparande/autostream-conversation-ai-agent/blob/main/agent/graph.py"
click node_email "https://github.com/indrayaniparande/autostream-conversation-ai-agent/blob/main/agent/graph.py"
click node_platform "https://github.com/indrayaniparande/autostream-conversation-ai-agent/blob/main/agent/graph.py"
click node_capture "https://github.com/indrayaniparande/autostream-conversation-ai-agent/blob/main/agent/graph.py"
click node_mock "https://github.com/indrayaniparande/autostream-conversation-ai-agent/blob/main/tools/lead_capture.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_cli,node_chat,node_intent,node_user toneBlue
class node_retrieval,node_kb toneAmber
class node_name,node_email,node_platform,node_capture,node_mock toneMint
class node_llm toneIndigo
```

## Components

### Conversation

- [CLI turn loop](https://github.com/indrayaniparande/autostream-conversation-ai-agent/blob/main/main.py): `main.py`
- [Chat handler](https://github.com/indrayaniparande/autostream-conversation-ai-agent/blob/main/agent/graph.py): `agent/graph.py`
- [Intent classifier](https://github.com/indrayaniparande/autostream-conversation-ai-agent/blob/main/agent/graph.py): `agent/graph.py`

### Product knowledge

- [Keyword retrieval](https://github.com/indrayaniparande/autostream-conversation-ai-agent/blob/main/agent/rag.py): `agent/rag.py`
- [AutoStream knowledge](https://github.com/indrayaniparande/autostream-conversation-ai-agent/blob/main/knowledge_base/autostream_kb.json): `knowledge_base/autostream_kb.json`

### Lead qualification

- [Name collection](https://github.com/indrayaniparande/autostream-conversation-ai-agent/blob/main/agent/graph.py): `agent/graph.py`
- [Email collection](https://github.com/indrayaniparande/autostream-conversation-ai-agent/blob/main/agent/graph.py): `agent/graph.py`
- [Platform collection](https://github.com/indrayaniparande/autostream-conversation-ai-agent/blob/main/agent/graph.py): `agent/graph.py`
- [Lead capture handler](https://github.com/indrayaniparande/autostream-conversation-ai-agent/blob/main/agent/graph.py): `agent/graph.py`
- [Mock lead capture](https://github.com/indrayaniparande/autostream-conversation-ai-agent/blob/main/tools/lead_capture.py): `tools/lead_capture.py`

### Other components

- **CLI user**
- **OpenAI model**

## Connections

- CLI user → CLI turn loop: enters message (evidence: `main.py`)
- CLI turn loop → Chat handler: dispatches chat (evidence: `main.py`)
- CLI turn loop → Name collection: dispatches stage (evidence: `main.py`)
- CLI turn loop → Email collection: dispatches stage (evidence: `main.py`)
- CLI turn loop → Platform collection: dispatches stage (evidence: `main.py`)
- Platform collection → Lead capture handler: calls capture (evidence: `main.py`)
- Chat handler → Intent classifier: classifies intent (evidence: `agent/graph.py`)
- Intent classifier → OpenAI model: invokes fallback (evidence: `agent/graph.py`)
- Chat handler → OpenAI model: generates reply (evidence: `agent/graph.py`)
- Chat handler → Keyword retrieval: retrieves context (evidence: `agent/graph.py`)
- Keyword retrieval → AutoStream knowledge: reads knowledge (evidence: `agent/rag.py`)
- Chat handler → Lead capture handler: captures complete lead (evidence: `agent/graph.py`)
- Lead capture handler → Mock lead capture: records lead (evidence: `agent/graph.py`)
