# annu-chauhan/autostream-agent-ai architecture

> Architecture diagram of the GitHub repository annu-chauhan/autostream-agent-ai, 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/annu-chauhan/autostream-agent-ai
- Repository: https://github.com/annu-chauhan/autostream-agent-ai

## Overview

AutoStream is a conversational agent that classifies each user message, answers greetings or pricing questions, and guides high-intent users through multi-turn lead capture. The CLI owns input, persistent conversation data, graph invocation, and response display. The LangGraph workflow routes intent, retrieves pricing from the local JSON knowledge base, and invokes lead capture after the lead-collection node. The separate AgentState class is not wired into the sampled runtime; WhatsApp is documented only as a possible extension.

Main entry points: [`agent/graph.py`](https://github.com/annu-chauhan/autostream-agent-ai/blob/main/agent/graph.py) (LangGraph workflow), [`main.py`](https://github.com/annu-chauhan/autostream-agent-ai/blob/main/main.py) (CLI loop), [`agent/rag.py`](https://github.com/annu-chauhan/autostream-agent-ai/blob/main/agent/rag.py) (Pricing lookup), [`agent/intent.py`](https://github.com/annu-chauhan/autostream-agent-ai/blob/main/agent/intent.py) (Intent detection)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_entry["Conversation entry"]
  node_cli["CLI loop<br/>[main.py]"]
  node_conversation["Conversation state<br/>[main.py]"]
end

subgraph group_workflow["Agent workflow"]
  node_workflow_graph["LangGraph workflow<br/>[graph.py]"]
  node_intent["Intent detection<br/>[intent.py]"]
  node_greeting["Greeting response<br/>[graph.py]"]
  node_pricing_node["Pricing response<br/>[graph.py]"]
end

subgraph group_knowledge["Pricing knowledge"]
  node_pricing_lookup["Pricing lookup<br/>[rag.py]"]
  node_knowledge_data["Knowledge JSON<br/>[knowledge.json]"]
end

subgraph group_leads["Lead capture"]
  node_lead_node["Lead collection<br/>[graph.py]"]
  node_tool_node["Capture dispatch<br/>[graph.py]"]
  node_capture["Lead capture tool<br/>[tools.py]"]
end

node_user(("User"))

node_user -->|"enters message"| node_cli
node_cli -->|"updates state"| node_conversation
node_cli -->|"invokes graph"| node_workflow_graph
node_conversation -->|"provides state"| node_workflow_graph
node_workflow_graph -->|"returns state"| node_conversation
node_workflow_graph -->|"detects intent"| node_intent
node_workflow_graph -->|"routes greeting"| node_greeting
node_workflow_graph -->|"routes pricing"| node_pricing_node
node_workflow_graph -->|"routes lead"| node_lead_node
node_pricing_node -->|"gets pricing"| node_pricing_lookup
node_pricing_lookup -->|"reads pricing"| node_knowledge_data
node_lead_node -->|"dispatches after collection"| node_tool_node
node_tool_node -->|"captures details"| node_capture
node_cli -->|"displays response"| node_user

click node_cli "https://github.com/annu-chauhan/autostream-agent-ai/blob/main/main.py"
click node_conversation "https://github.com/annu-chauhan/autostream-agent-ai/blob/main/main.py"
click node_workflow_graph "https://github.com/annu-chauhan/autostream-agent-ai/blob/main/agent/graph.py"
click node_intent "https://github.com/annu-chauhan/autostream-agent-ai/blob/main/agent/intent.py"
click node_greeting "https://github.com/annu-chauhan/autostream-agent-ai/blob/main/agent/graph.py"
click node_pricing_node "https://github.com/annu-chauhan/autostream-agent-ai/blob/main/agent/graph.py"
click node_lead_node "https://github.com/annu-chauhan/autostream-agent-ai/blob/main/agent/graph.py"
click node_tool_node "https://github.com/annu-chauhan/autostream-agent-ai/blob/main/agent/graph.py"
click node_capture "https://github.com/annu-chauhan/autostream-agent-ai/blob/main/agent/tools.py"
click node_pricing_lookup "https://github.com/annu-chauhan/autostream-agent-ai/blob/main/agent/rag.py"
click node_knowledge_data "https://github.com/annu-chauhan/autostream-agent-ai/blob/main/data/knowledge.json"

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_conversation,node_user toneBlue
class node_workflow_graph,node_intent,node_greeting,node_pricing_node toneAmber
class node_pricing_lookup,node_knowledge_data toneMint
class node_lead_node,node_tool_node,node_capture toneRose
```

## Components

### Conversation entry

- [CLI loop](https://github.com/annu-chauhan/autostream-agent-ai/blob/main/main.py): `main.py`
- [Conversation state](https://github.com/annu-chauhan/autostream-agent-ai/blob/main/main.py): `main.py`

### Agent workflow

- [LangGraph workflow](https://github.com/annu-chauhan/autostream-agent-ai/blob/main/agent/graph.py): `agent/graph.py`
- [Intent detection](https://github.com/annu-chauhan/autostream-agent-ai/blob/main/agent/intent.py): `agent/intent.py`
- [Greeting response](https://github.com/annu-chauhan/autostream-agent-ai/blob/main/agent/graph.py): `agent/graph.py`
- [Pricing response](https://github.com/annu-chauhan/autostream-agent-ai/blob/main/agent/graph.py): `agent/graph.py`

### Pricing knowledge

- [Pricing lookup](https://github.com/annu-chauhan/autostream-agent-ai/blob/main/agent/rag.py): `agent/rag.py`
- [Knowledge JSON](https://github.com/annu-chauhan/autostream-agent-ai/blob/main/data/knowledge.json): `data/knowledge.json`

### Lead capture

- [Lead collection](https://github.com/annu-chauhan/autostream-agent-ai/blob/main/agent/graph.py): `agent/graph.py`
- [Capture dispatch](https://github.com/annu-chauhan/autostream-agent-ai/blob/main/agent/graph.py): `agent/graph.py`
- [Lead capture tool](https://github.com/annu-chauhan/autostream-agent-ai/blob/main/agent/tools.py): `agent/tools.py`

### Other components

- **User**

## Connections

- User → CLI loop: enters message
- CLI loop → Conversation state: updates state
- CLI loop → LangGraph workflow: invokes graph
- Conversation state → LangGraph workflow: provides state
- LangGraph workflow → Conversation state: returns state
- LangGraph workflow → Intent detection: detects intent
- LangGraph workflow → Greeting response: routes greeting
- LangGraph workflow → Pricing response: routes pricing
- LangGraph workflow → Lead collection: routes lead
- Pricing response → Pricing lookup: gets pricing
- Pricing lookup → Knowledge JSON: reads pricing
- Lead collection → Capture dispatch: dispatches after collection
- Capture dispatch → Lead capture tool: captures details
- CLI loop → User: displays response
