uipath-langchain-python/samples/ticket-classification at main ยท UiPath/uipath-langchain-python

Support Ticket Classification System

Use LangGraph with Azure OpenAI to automatically classify support tickets into predefined categories with confidence scores. UiPath Action Center integration for human approval step.

Debug

  1. Clone the repository:
git clone
cd samples\ticket-classification
  1. Install dependencies:
pip install uv
uv venv -p 3.11 .venv
.venv\Scripts\activate
uv sync
  1. Create a .env file in the project root with the following configuration:
UIPATH_URL=https://alpha.uipath.com/ada/byoa
UIPATH_ACCESS_TOKEN=xxx
AZURE_OPENAI_API_KEY=xxx
AZURE_OPENAI_ENDPOINT=xxx
uipath run <entrypoint> <input> [--resume]

Run

To classify a ticket, run the script using UiPath CLI:

uipath run agent '{"message": "GET Assets API does not enforce proper permissions Assets.View", "ticket_id": "TICKET-2345"}'

Resume

To resume the graph with approval:

uipath run agent true --resume

Input Format

The input ticket should be in the following format:

{
    "message": "The ticket message or description",
    "ticket_id": "Unique ticket identifier",
    "assignee"[optional]: "username or email of the person assigned to handle escalations"
}

Output Format

The script outputs JSON with the classification results:

{
    "label": "security",
    "confidence": 0.9
}

Deployment Guide

This guide walks you through deploying and running the ticket classification agent on the UiPath Cloud Platform.

Prerequisites

  • Access to UiPath Cloud Platform
  • Python 3.11 or higher
  • Git

1. Repository Setup

# Clone the repository
git clone https://github.com/UiPath/uipath-langchain-python.git
cd uipath-langchain-python/samples/ticket-classification

2. Action App Deployment

The Ticket Classification Agent utilizes HITL (Human In The Loop) technology, allowing the system to incorporate feedback directly from supervisory personnel. We'll leverage UiPath Action Center for this functionality.

Follow these steps to deploy the pre-built application using UiPath Solutions Management:

  1. Upload Solution Package

    upload-solution-package

  2. Initiate Deployment

    • Wait for the package to be processed and ready for deployment

    deploy-solution-package

  3. Select Destination

    • Choose a destination folder or install as root folder under tenant

    choose-destination-folder

  4. Complete Configuration

    • Follow the solution configuration wizard prompts

    solution-configuration-wizard

  5. Activate the Apps

    activate-deployment activate-apps

  6. Verify and Configure

    • Navigate to the solution folder to verify the escalation app creation

    navigate-to-solution-folder

    • Copy the folder path for configuration

    copy-folder-path

    • Update the FOLDER_PATH_PLACEHOLDER string in main.py (line 148) with the copied folder path

3. Agent Setup and Publishing

  1. Set Up Python Environment
# Install UV package manager
pip install uv

# Create and activate virtual environment
uv venv -p 3.11 .venv

# Windows
.venv\Scripts\activate

# Unix-like Systems
source .venv/bin/activate

# Install dependencies
uv sync
  1. UiPath Authentication

Note: After successful authentication in the browser, select the tenant for publishing the agent package.

๐Ÿ‘‡ Select tenant:
  0: DefaultTenant
  1: Tenant2
  2: Tenant3
...
Select tenant: 2
  1. Package and Publish
# Create and publish the package
uipath pack
uipath publish

Select the feed to publish your package:

๐Ÿ‘‡ Select package feed:
  0: Orchestrator Tenant Processes Feed
  1: Orchestrator Folder1 Feed
  2: Orchestrator Folder2 Feed
  3: Orchestrator Personal Workspace Feed
  ...
Select feed number: 3

Note: When publishing to personal workspace feed, the process will be auto-created for you.

4. Running and Monitoring the Agent

  1. Start the Agent

    • Navigate to your agent in the UiPath workspace
    • Click "Run" to start a new job

    run the agent start job

  2. Monitor Progress

    • Track the agent's progress using the details side panel

    monitor agent

  3. Handle Human-in-the-Loop Tasks

    • When a ticket is classified, a Resume Condition tab will appear
    • Use this link to navigate to UiPath Action Center for human intervention

    resume condition

For detailed information about UiPath Action Center and its features, refer to the official documentation.