Skip to content

RahulGupta012/CS_Agent_with_node_orchestration

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

5 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Query Resolution Agent

Overview

This project is an AI-powered Query Resolution Agent designed to analyze customer support requests and generate intelligent responses using Large Language Models (LLMs). The application combines structured customer/order information from PostgreSQL with contextual retrieval and agentic decision-making to resolve customer issues.

The system is containerized using Docker and consists of:

  • FastAPI Backend
  • Streamlit Frontend
  • PostgreSQL Database
  • LangGraph Agent Workflow
  • LLM Integration (Google Gemini)

Architecture

Components

Frontend (Streamlit)

Provides a user interface where support agents can submit customer queries and view generated resolutions.

Backend (FastAPI)

Acts as the orchestration layer and exposes API endpoints used by the frontend.

Responsibilities:

  • Receive support requests
  • Execute the LangGraph workflow
  • Retrieve customer/order information
  • Invoke the LLM
  • Return generated responses

PostgreSQL

Stores customer, order, and product information used as structured context for resolution generation.

Agent Workflow (LangGraph)

The agent follows a multi-step workflow:

  1. Receive customer query
  2. Fetch customer and order context from PostgreSQL
  3. Retrieve additional Company policy knowledge from the vector store (RAG)
  4. Generate reasoning and resolution using the LLM
  5. Return the final response to the frontend

Agent Loop Overview

The LangGraph workflow executes the following loop:

User Query ↓ Context Retrieval ↓ Database Lookup ↓ Knowledge Retrieval (RAG) ↓ LLM Reasoning ↓ Response Generation

The workflow combines:

  • Structured customer/order information
  • Retrieved knowledge documents
  • LLM reasoning

to generate accurate and context-aware resolutions.


Environment Variables

Create a .env file in the project root.

Example:

GOOGLE_API_KEY=your_api_key

DATABASE_URL=postgresql+psycopg2://username:password@postgres:5432/db_name

POSTGRES_USER=username
POSTGRES_PASSWORD=password
POSTGRES_DB=db_name

Replace the API key according to the LLM provider being used.


Running the Application

Prerequisites

  • Docker
  • Docker Compose

Start Services

docker compose up -d

Expected containers:

  • postgres
  • worknoon_backend
  • worknoon_frontend

Access the Application

Frontend

http://localhost:8501

Backend API

http://localhost:8000/docs


Stopping the Application

docker compose stop

Restarting the Application

docker compose start

Rebuilding After Code Changes

docker compose up --build -d

Project Structure

project/
│
├── backend/
│   ├── api.py
│   ├── graph.py
│   ├── db.py
│   └── db_config.py
│
├── frontend/
│   └── app.py
│
├── docker-compose.yml
├── requirements.txt
├── .env.example
└── README.md

About

It is a E-Com customer Support agent who knows the database and having the power to do SQL queries. It knows the Knowledge-base of the companies policy by RAG.Having multiple tools.

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors