{"id":51068086,"url":"https://github.com/vivpm/autostream-ai-agent","last_synced_at":"2026-06-23T08:04:07.610Z","repository":{"id":351310431,"uuid":"1210443493","full_name":"VIVPM/AutoStream-AI-Agent","owner":"VIVPM","description":"Conversational AI agent for a SaaS platform that classifies user intent, answers product questions via RAG (ChromaDB + Gemini), and captures leads through a stateful multi-turn workflow built with LangGraph.","archived":false,"fork":false,"pushed_at":"2026-04-14T12:49:03.000Z","size":15,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":0,"default_branch":"main","last_synced_at":"2026-04-14T14:30:05.239Z","etag":null,"topics":["ai-agent","gemini-api","langgraph","llm","python","rag","streamlit"],"latest_commit_sha":null,"homepage":"","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/VIVPM.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null}},"created_at":"2026-04-14T12:26:18.000Z","updated_at":"2026-04-14T13:55:06.000Z","dependencies_parsed_at":null,"dependency_job_id":null,"html_url":"https://github.com/VIVPM/AutoStream-AI-Agent","commit_stats":null,"previous_names":["vivpm/autostream-ai-agent"],"tags_count":null,"template":false,"template_full_name":null,"purl":"pkg:github/VIVPM/AutoStream-AI-Agent","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/VIVPM%2FAutoStream-AI-Agent","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/VIVPM%2FAutoStream-AI-Agent/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/VIVPM%2FAutoStream-AI-Agent/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/VIVPM%2FAutoStream-AI-Agent/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/VIVPM","download_url":"https://codeload.github.com/VIVPM/AutoStream-AI-Agent/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/VIVPM%2FAutoStream-AI-Agent/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":34680628,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-05-26T15:22:16.424Z","status":"online","status_checked_at":"2026-06-23T02:00:07.161Z","response_time":65,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["ai-agent","gemini-api","langgraph","llm","python","rag","streamlit"],"created_at":"2026-06-23T08:04:06.935Z","updated_at":"2026-06-23T08:04:07.602Z","avatar_url":"https://github.com/VIVPM.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# AutoStream AI Agent — Social-to-Lead Agentic Workflow\n\nA conversational AI agent for **AutoStream**, a SaaS platform that provides automated video editing tools for content creators. The agent identifies user intent, answers product questions using RAG, and captures leads through a structured workflow.\n\n## How to Run Locally\n\n### Prerequisites\n\n- Python 3.9+\n- Google API Key (for Gemini LLM and embeddings)\n\n### Setup\n\n1. **Clone the repository**\n\n   ```bash\n   git clone https://github.com/your-username/assignment-servicehive.git\n   cd assignment-servicehive\n   ```\n\n2. **Install dependencies**\n\n   ```bash\n   pip install -r requirements.txt\n   ```\n\n3. **Set up environment variable**\n\n   ```bash\n   export GOOGLE_API_KEY=\"your_google_api_key_here\"\n   ```\n\n   On Windows:\n\n   ```bash\n   set GOOGLE_API_KEY=your_google_api_key_here\n   ```\n\n4. **Run the application**\n\n   ```bash\n   streamlit run app.py\n   ```\n\n5. Open `http://localhost:8501` in your browser.\n\n## Architecture\n\n```\nUser Input (message)\n        |\n        v\n  Streamlit UI (app.py)\n        |\n        v\n  classify_intent\n  (Gemini LLM)\n        |\n   intent?\n   /    |    \\\ngreet  inq  high_intent\n  |     |        |\n  |     |        v\n  |     |   Collect lead info\n  |     |   (name → email → platform)\n  |     |        |\n  |   RAG        v\n  |  lookup  mock_lead_capture\n  |   (ChromaDB + Gemini embeddings)\n  |     |        |\n   \\    |       /\n    v   v      v\n   LangGraph END\n   (MemorySaver checkpoint)\n        |\n        v\n  Streamlit UI (reply)\n        |\n        v\n      User\n```\n\n**classify_intent** — Classifies every message into `greeting`, `inquiry`, or `high_intent` using Gemini 2.5 Flash at `temperature=0.0`.\n\n**handle_greeting** — Generates a warm welcome response. No RAG needed.\n\n**handle_inquiry** — Retrieves the top-k relevant chunks from ChromaDB (via `retrieve_context`) and passes them as context to Gemini before responding.\n\n**handle_high_intent** — Runs a stateful one-field-at-a-time collection loop (name → email → platform). Calls `mock_lead_capture` only after all three fields are collected.\n\n**RAG Pipeline** — `knowledge_base.json` is embedded at startup using `gemini-embedding-001` (384d) into a local ChromaDB store. Semantic search retrieves the most relevant product/pricing context on demand.\n\n**MemorySaver** — LangGraph's built-in checkpointer persists `AgentState` (messages + intent + lead_info) across turns using a `thread_id`, so no external database is needed.\n\n## WhatsApp Deployment via Webhooks\n\nTo integrate this agent with WhatsApp, the following webhook-based architecture can be used:\n\n1. **WhatsApp Business API**: Register with the WhatsApp Business Platform (via Meta) to get API access and a phone number.\n\n2. **Webhook Server**: Deploy a FastAPI/Flask server that exposes a webhook endpoint (e.g., `POST /webhook`). Configure this URL in the Meta Developer Dashboard as the callback URL.\n\n3. **Incoming Messages**: When a user sends a WhatsApp message, Meta sends a POST request to the webhook with the message payload (sender number, message text, timestamp).\n\n4. **Agent Processing**: The webhook handler extracts the message text, passes it to the LangGraph agent (using the sender's phone number as the `thread_id` for session persistence), and receives the agent's response.\n\n5. **Outgoing Messages**: The server sends the agent's response back via the WhatsApp Business API's `POST /messages` endpoint with the sender's number and response text.\n\n6. **Session Management**: Each user's phone number serves as a unique thread ID, allowing the LangGraph checkpointer to maintain conversation state across multiple messages — just as it does in the Streamlit UI.\n\n```\nUser (WhatsApp) → Meta Cloud API → Webhook (POST /webhook) → LangGraph Agent → WhatsApp API (reply) → User\n```\n\nThis approach keeps the core agent logic unchanged — only the I/O layer (Streamlit vs. webhook) differs.\n\n## Project Structure\n\n```\n├── app.py                  # Streamlit UI\n├── agent.py                # LangGraph agent (intent detection, routing, lead capture)\n├── rag.py                  # RAG pipeline (ChromaDB + Gemini embeddings)\n├── tools.py                # Mock lead capture tool\n├── knowledge_base.json     # AutoStream product knowledge base\n├── requirements.txt        # Python dependencies\n├── .env.example            # Environment variable template\n└── README.md               # This file\n```\n\n## Evaluation Criteria Coverage\n\n| Criteria         | Implementation                                                        |\n| ---------------- | --------------------------------------------------------------------- |\n| Intent Detection | LLM-based classification into greeting/inquiry/high_intent            |\n| RAG              | ChromaDB + gemini-embedding-001 (384d) over local JSON knowledge base |\n| State Management | LangGraph MemorySaver with thread-based checkpointing                 |\n| Tool Calling     | mock_lead_capture called only after collecting all 3 fields           |\n| Code Clarity     | Modular design — separate files for agent, RAG, tools, and UI         |\n| Deployability    | Streamlit UI + WhatsApp webhook architecture documented               |\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fvivpm%2Fautostream-ai-agent","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fvivpm%2Fautostream-ai-agent","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fvivpm%2Fautostream-ai-agent/lists"}