This project implements a Conversational AI Agent for AutoStream, a video editing SaaS platform. The agent is built to automate the top-of-funnel sales process by acting as a knowledgeable representative.
Key Capabilities:
- 🤖 Answer Questions: Uses RAG (Retrieval-Augmented Generation) to fetch accurate pricing, policy, and feature information from a local knowledge base (
knowledge_base.md). - 🧠 Detect Intent: Intelligently distinguishes between casual inquiries and high-intent buying signals.
- 🎣 Capture Leads: Automatically switches context to collect specific user details (Name, Email, Creator Platform) and executes a backend lead capture tool only when all slots are filled.
- Python 3.9+
- Google AI Studio API Key (for Gemini 1.5 Flash)
1. Clone the Repository
git clone <your-repo-url-here>
cd AutoStream-Agent2. Create & Activate Virtual Environment Windows:
python -m venv venv
.\venv\Scripts\activateMac:
python3 -m venv venv
source venv/bin/activate3. Install Dependencies
pip install -r requirements.txt4. Configure Environment Variables Create a .env file in the root directory and add your Google API key
GOOGLE_API_KEY=AIzaSy...Your_Key_Here
Usage Option A: Web Interface (Recommended for Demo) Runs a polished chat UI using Streamlit.
streamlit run app.pyOption B: CLI Mode (Terminal) Runs the agent directly in your command line for debugging.
python main.py3. Architecture Explanation
Why LangGraph?
For this workflow, I chose LangGraph over standard linear chains (LangChain) or AutoGen. The "Social-to-Lead" problem requires a cyclic state machine rather than a linear pipeline.
Cyclic Behavior: Real conversations are non-linear. If a user provides an invalid email or forgets to mention their platform, the agent must "loop back" and ask specifically for that missing piece of data. Standard DAGs (Directed Acyclic Graphs) struggle with these dynamic loops.
Fine-Grained Control: LangGraph allows the agent to decide the next step dynamically—choosing whether to call the RAG tool, the Lead Capture tool, or simply reply with text—based on the current conversation state.
State Management State is persisted using LangGraph’s MemorySaver checkpointer.
Data Flow Diagram:
-
Ingest: knowledge_base.md → Split into Chunks → Google Embeddings → FAISS Index.
-
Query: User Question → Google Embeddings → Semantic Search on FAISS.
-
Augment: Top 3 relevant chunks + User Question → System Prompt.
-
Generate: Gemini 1.5 Flash → Final Answer.
Mechanism: The graph maintains a messages list within its state. Every user input and AI response is appended to this history.