Skip to content

About

Agentic AI customer support system with RAG, LangGraph, tool calling, source precedence, authorization, and controlled actions.

Topics

Resources

Stars

0 stars

Watchers

0 watching

Forks

Repository files navigation

ParcelPilot AI Support Agent

An AI-powered customer support agent for ParcelPilot, built to answer support questions using customer agreements, current policies, SOPs, product documentation, and structured operational data.

The system also supports controlled state-changing actions with explicit human confirmation.


1. Problem

ParcelPilot support teams need to investigate customer questions across multiple information sources:

  • Support policies
  • Customer-specific agreements
  • Cancellation and service-credit SOPs
  • Product documentation
  • Account data
  • Order data
  • Historical support tickets

These sources are not equally reliable. Customer agreements can override general policies, policies can become deprecated, and historical ticket resolutions may contain incorrect guidance.

The system therefore combines retrieval, structured-data tools, authorization, source precedence, and human-in-the-loop actions.


2. Key Features

AI Support Chatbot

The chatbot accepts natural-language questions and determines which information sources and tools are required.

Document Retrieval

The system retrieves information from:

  • Current support policy
  • Current SOPs
  • Product documentation
  • Customer agreements
  • Deprecated policies
  • Historical ticket information

Structured Operational Data

The agent can query:

  • Accounts
  • Orders
  • Support tickets

Access Control

Customer-specific information is scoped to the authenticated account.

Unauthorized users cannot retrieve another customer's:

  • Orders
  • Tickets
  • Account information
  • Customer-specific agreements

Authorization is enforced in the tool/data layer rather than relying only on the LLM prompt.

Human-in-the-Loop Actions

The agent can prepare an escalation.

The actual escalation requires explicit user confirmation.

Flow:

User request → Investigation → Prepare escalation → User confirmation → Execute action

Source Precedence

The system follows this authority order:

  1. Active customer-specific agreements
  2. Current ParcelPilot support policy
  3. Current SOPs
  4. Current product documentation
  5. Deprecated policies
  6. Historical tickets and internal notes

Higher-authority sources override lower-authority sources.


3. Architecture

User | v Streamlit Chat Interface | v LangGraph Agent | v Qwen 3.6 27B via Groq | +-----------------------------+ | | | v v v RAG Search Operational Action Tools Data Tools | | | v v v Policies Accounts Prepare SOPs Orders Escalation Agreements Tickets | Product Docs | v User Confirmation | v Create Escalation


4. Agent Tools

The agent has the following tools:

search_documents

Retrieves relevant information from ParcelPilot's supplied documents.

get_account

Retrieves account information subject to authorization.

get_order

Retrieves order/shipment information subject to authorization.

get_ticket

Retrieves support ticket information subject to authorization.

prepare_escalation

Creates a proposed escalation for user confirmation.

create_escalation

Executes the actual state-changing escalation only after explicit confirmation from the user.


5. Trust and Reliability

The system deliberately avoids treating every source as equally reliable.

Customer-specific agreements have higher authority than general policies.

Deprecated policies are not treated as current policy.

Historical ticket resolutions are treated as context only because they may contain incorrect guidance.

When information is missing or conflicting, the agent states the uncertainty rather than inventing an answer.


6. Security

Authorization is enforced inside the data and tool layer.

For example, if a LumenWorks customer attempts to access a Northstar order:

User: Show me ORD-1001

System:
Access denied. You are not authorized to access this order.

The system does not reveal the other customer's account information.

State-changing tools also perform authorization checks before preparing or executing actions.


7. Example

Customer cancellation request

User:

Can Northstar cancel ORD-1001 without a fee?

The agent:

  1. Looks up ORD-1001.
  2. Identifies the account as Northstar.
  3. Retrieves the Northstar customer agreement.
  4. Retrieves the applicable cancellation rules.
  5. Applies source precedence.
  6. Determines that the customer agreement overrides the default cancellation fee.

Result:

Northstar can cancel ORD-1001 without a cancellation fee.


8. Human-in-the-Loop Escalation

Example:

User:

Escalate TKT-450 as P1 because this issue needs urgent attention.

The agent first investigates the ticket and prepares an escalation.

It does not execute the action immediately.

The interface presents:

Ticket: TKT-450
Priority: P1
Reason: this issue needs urgent attention

[ Confirm Escalation ] [ Cancel ]

Only after explicit confirmation is the state-changing action executed.


9. Technology Stack

  • Python
  • LangChain
  • LangGraph
  • Qwen 3.6 27B
  • Groq
  • Streamlit
  • Sentence Transformers
  • FAISS
  • Pandas
  • PyMuPDF
  • Pydantic

10. Running the Application

Install dependencies:

pip install -r requirements.txt

Create a .env file:

GROQ_API_KEY=your_groq_api_key

Run:

streamlit run app.py

11. Dataset

The supplied assessment data contains:

  • Support policies
  • Cancellation and service-credit SOP
  • Product operations documentation
  • Customer agreements
  • Account data
  • Order data
  • Ticket data

The structured dataset snapshot time is:

2026-08-16 11:00 Asia/Kolkata

Time-based reasoning uses this snapshot as the reference time.


12. Design Decisions

Why RAG?

The knowledge base contains multiple documents with different authority levels and customer-specific rules. Retrieval allows the agent to ground its answers in the supplied source material.

Why structured-data tools?

Orders, accounts, and tickets are structured operational data. Querying them directly is more reliable than asking an LLM to infer their contents from documents.

Why LangGraph?

The workflow requires repeated cycles of:

Agent → Tool → Agent

and also supports controlled action workflows.

Why human confirmation?

Escalations change system state. Requiring explicit confirmation prevents the agent from performing unintended actions.

Why enforce authorization in tools?

LLM instructions alone are not a sufficient security boundary. Authorization must be enforced before sensitive data or actions are returned/executed.


13. Future Improvements

If continuing development, I would prioritize:

  1. Proactive issue detection across tickets and orders.
  2. SLA monitoring and breach prediction.
  3. Detection of recurring issues affecting multiple customers.
  4. Better citation/source display in the UI.
  5. Audit logs for agent decisions and actions.
  6. Production authentication and role-based access control.
  7. Automated evaluation of answer correctness and source precedence.
  8. Observability and agent/tool latency monitoring.

About

Agentic AI customer support system with RAG, LangGraph, tool calling, source precedence, authorization, and controlled actions.

Topics

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages