Skip to content

DigitLock/camunda-llm-ticket-refund

Folders and files

NameName
Last commit message
Last commit date

Latest commit

ย 

History

8 Commits
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 

Repository files navigation

Camunda LLM Ticket Refund - Automated BPMN Process

Automated airline ticket refund processing with AI-powered decision making using OpenAI GPT-4o-mini and Camunda Platform.

๐ŸŽฏ Project Overview

This project demonstrates a production-ready BPMN process for handling airline ticket refund requests with intelligent automation. Built as a portfolio project showcasing Business Analyst skills, BPMN expertise, and LLM integration capabilities.

Business Context: Travel technology solution for airline companies to automate refund processing, reduce manual workload, and improve customer experience through intelligent decision-making.

๐Ÿ— Architecture

  • Process Engine: Camunda Platform 7.24.0
  • LLM Integration: OpenAI GPT-4o-mini via External Task Worker
  • Worker Runtime: Python 3.11 in Docker container
  • Deployment: Production-ready setup with error handling and monitoring

โœจ Features

BPMN Elements Implemented

  • โœ… Service Tasks (automated processing)
  • โœ… User Tasks (manual review with forms)
  • โœ… Exclusive Gateways (business logic routing)
  • โœ… Error Boundary Events (retry mechanism with 3 attempts)
  • โœ… Timer Boundary Events (SLA monitoring with auto-escalation)
  • โœ… External Tasks (LLM integration point)
  • โœ… Process Variables (state management)
  • โœ… Multiple End Events (different process outcomes)

Business Scenarios Covered

  1. Full Refund - Fully automated approval path
  2. Refund with Penalty - Automatic fee calculation
  3. Manual Review - Approved - Human decision required (complex cases)
  4. Manual Review - Rejected - Human rejection with reasoning
  5. SLA Breach - Automatic escalation after 2-hour timeout
  6. Error Handling - Payment API failure with retry loop

๐Ÿ” Camunda History Viewer (Companion Tool)

Challenge: Camunda Community Edition lacks a built-in UI for viewing historical process instances.

Solution: Developed a separate React-based history viewer tool.

โ†’ Camunda History Viewer Repository

Features:

  • ๐Ÿ“Š Visual timeline of completed process instances
  • ๐Ÿ” Activity-by-activity execution history
  • ๐Ÿ“ Process variables inspection
  • ๐ŸŽจ Clean, intuitive React UI
  • ๐Ÿ”Œ Direct REST API integration with Camunda

This companion project demonstrates:

  • Problem-solving approach to platform limitations
  • Full-stack development skills (React + REST API)
  • Understanding of Camunda architecture and API

Used extensively during testing to analyze all 6 test scenarios documented below.

๐Ÿค– AI Integration Details

How LLM Analyzes Refund Requests

The External Task Worker uses GPT-4o-mini to analyze:

  • Ticket class (Economy, Business, First)
  • Purchase date vs Flight date
  • Days until departure
  • Airline refund policies

LLM Decision Categories:

  • ALLOWED - Full refund with no penalty
  • WITH_PENALTY - Refund possible but with cancellation fee
  • MANUAL - Requires human review (edge cases)

Performance:

  • Response time: ~1-2 seconds per request
  • Cost: ~$0.0001 per analysis
  • Fallback: Manual review on API errors

๐Ÿš€ Quick Start

Prerequisites

Installation

  1. Clone repository:
git clone https://github.com/DigitLock/camunda-llm-ticket-refund.git
cd camunda-llm-ticket-refund
  1. Configure OpenAI API key:
cd workers/llm-worker
cp .env.example .env
nano .env  # Add your API key: OPENAI_API_KEY=sk-proj-...
  1. Start LLM Worker:
cd ../../scripts
./start-worker.sh
  1. Deploy BPMN process to Camunda:
./deploy.sh
  1. Trigger process via Camunda Cockpit or REST API

Manual Deployment (Alternative)

If scripts don't work, deploy manually:

  1. Start worker:
cd workers/llm-worker
docker build -t llm-worker:latest .
docker run -d --name llm-worker --network host --env-file .env llm-worker:latest
  1. Deploy BPMN via Camunda Modeler:
    • Open bpmn/ticket-refund-process.bpmn
    • Deploy to your Camunda instance

๐Ÿ“Š Test Results

All 6 scenarios tested and verified on Camunda Platform 7.24.0:

# Scenario Elements Used Duration Status
1 Full Refund (Happy Path) Service Tasks, Gateway 29ms โœ… PASS
2 Refund with Penalty Service Tasks, Gateway 12ms โœ… PASS
3 Manual Review - Approved User Task, Form, Gateway 58.4s โœ… PASS
4 Manual Review - Rejected User Task, Form, Gateway 6.2s โœ… PASS
5 SLA Breach Timer Timer Boundary Event (30s) 130.5s โœ… PASS
6 Error Handling Retry Error Boundary Event, Loop 19ms โœ… PASS

Total API Calls During Testing: 15 requests
Total Cost: ~$0.002 USD
Success Rate: 100%

๐Ÿ“ Project Structure

camunda-llm-ticket-refund/
โ”œโ”€โ”€ README.md                      # This file
โ”œโ”€โ”€ .gitignore                     # Git exclusions
โ”œโ”€โ”€ bpmn/
โ”‚   โ””โ”€โ”€ ticket-refund-process.bpmn # BPMN 2.0 process definition
โ”œโ”€โ”€ workers/
โ”‚   โ””โ”€โ”€ llm-worker/
โ”‚       โ”œโ”€โ”€ llm_worker.py          # External Task Worker
โ”‚       โ”œโ”€โ”€ requirements.txt       # Python dependencies
โ”‚       โ”œโ”€โ”€ Dockerfile             # Container definition
โ”‚       โ””โ”€โ”€ .env.example           # Environment template
โ”œโ”€โ”€ docs/
โ”‚   โ””โ”€โ”€ diagram.png                # Process diagram screenshot
โ””โ”€โ”€ scripts/
    โ”œโ”€โ”€ deploy.sh                  # Deploy process to Camunda
    โ””โ”€โ”€ start-worker.sh            # Start worker container

๐Ÿ›  Technology Stack

Component Technology Version
Process Engine Camunda Platform Community Edition 7.24.0
Modeling BPMN 2.0 -
LLM Provider OpenAI GPT-4o-mini
Worker Language Python 3.11
Worker Framework camunda-external-task-client-python3 4.3.0
Containerization Docker Latest
API Client openai-python 1.54.4

๐ŸŽ“ Learning Outcomes

This project demonstrates:

  • Business Analysis: Process decomposition, edge case identification
  • BPMN Expertise: Advanced patterns (boundary events, external tasks)
  • Integration Skills: REST API, External Task pattern
  • AI/LLM Integration: Practical application of LLMs in business processes
  • DevOps: Dockerization, production deployment patterns
  • Problem Solving: Developed companion tool to overcome platform limitations

๐Ÿ”ฎ Future Enhancements

Potential improvements for production use:

  • Add authentication/authorization
  • Implement caching for repeated fare rule queries
  • Add metrics and monitoring (Prometheus/Grafana)
  • Support multiple LLM providers (Claude, Gemini)
  • Add unit tests for worker logic
  • Implement circuit breaker pattern for API calls

๐Ÿ“ License

MIT License - feel free to use for learning and portfolio purposes.

๐Ÿ‘ค Author

Igor Kudinov
Senior Business Systems Analyst

  • 15+ years experience in banking, fintech, and cryptocurrency industries
  • Expertise: System migrations, API documentation, BPMN, compliance (AML, Travel Rule)
  • Portfolio project demonstrating BPMN modeling and LLM integration

๐Ÿค Contributing

This is a portfolio/demonstration project. Feedback and suggestions are welcome via issues.


Note: This is a demonstration project showcasing technical skills. For production deployment, additional security hardening, monitoring, and testing should be implemented.

About

Automated airline ticket refund processing with AI-powered decision making using OpenAI GPT-4o-mini and Camunda Platform

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Sponsor this project

  •  

Packages

 
 
 

Contributors