ahad.

Home/Projects/IT Access Provisioning Automation

IT Access Provisioning Automation

LangGraph StateGraph pipeline that replaced a manual IT access ticket queue at Capgemini. Dual-mode classifier (LLM + Regex fallback), human-in-the-loop approval via interrupt/resume, real-time SSE streaming, and PostgresSaver checkpointing for full audit trails.

LangGraphFastAPIPostgreSQLMCPSSE

What Problem Does This Solve?

In enterprise IT environments, access requests (such as requesting read access to production databases or cloud infrastructure roles) sit in manual ticket queues. Security administrators read each ticket, cross-reference employee credentials, evaluate access scope, and execute provisioning commands manually.

This workflow creates two problems:

  1. Latency Bottlenecks: Access requests take 2–5 business days to clear manual review.
  2. Audit & Compliance Gaps: Authorization decisions are scattered across ticket comments and manual admin sessions, making audit compliance difficult during security reviews.

This project automates IT access ticket triage and execution using a stateful 3-node LangGraph StateGraph pipeline with explicit Human-In-The-Loop (HITL) authorization gates.

System Architecture

The pipeline consists of three core state nodes:

Loading diagram...

State Nodes

  1. Classify Request Node: Parses raw ticket description text. Uses a dual-mode classifier (primary LLM intent classification with high-confidence Regex fallback) to extract employee ID, target system, and requested access level.
  2. HITL Approval Gate: Evaluates security risk. The graph halts execution before running privileged actions by setting interrupt_before=["hitl_approval"]. The complete execution state is persisted to PostgreSQL via PostgresSaver.
  3. Provision Access Node: Upon receiving explicit admin resume command (Command(resume="APPROVED")), the agent executes provisioning commands against target identity providers using Model Context Protocol (MCP) tools.

Dual-Mode Classifier Design

Running full LLM inference on every routine ticket adds unnecessary API cost and latency. The classification step uses a fallback pattern:

python
1import re
2from pydantic import BaseModel, Field
3
4class AccessIntent(BaseModel):
5 user_id: str
6 target_system: str
7 access_level: str
8 confidence: float
9
10def classify_ticket_intent(raw_text: str) -> AccessIntent:
11 # High-confidence Regex match for standard ticket templates
12 pattern = r"Grant\s+(?P<user_id>EMP-\d+)\s+access\s+to\s+(?P<system>[\w-]+)\s+as\s+(?P<level>\w+)"
13 match = re.search(pattern, raw_text, re.IGNORECASE)
14
15 if match:
16 return AccessIntent(
17 user_id=match.group("user_id"),
18 target_system=match.group("system"),
19 access_level=match.group("level"),
20 confidence=0.98 # High confidence skips secondary validation
21 )
22
23 # Fallback to structured LLM classification for unstructured tickets
24 return call_llm_classifier(raw_text)

For standard structural tickets, the Regex fallback executes in under 2ms with 0.98 confidence, bypassing unnecessary LLM overhead.

Human-in-the-Loop (HITL) Interrupt & Resume Pattern

Security policies dictate that an AI agent cannot provision production database access autonomously. LangGraph enforces this constraint at the graph compilation layer:

python
1from langgraph.checkpoint.postgres.aio import AsyncPostgresSaver
2from langgraph.graph import StateGraph, START, END
3from langgraph.types import Command, interrupt
4
5# Compile graph with PostgresSaver checkpointing and interrupt gate
6checkpointer = AsyncPostgresSaver(pool)
7app = graph.compile(
8 checkpointer=checkpointer,
9 interrupt_before=["provision_access"]
10)
11
12# Admin Approval Execution API Endpoint
13@router.post("/api/tickets/{thread_id}/approve")
14async def approve_ticket(thread_id: str, admin_decision: str):
15 config = {"configurable": {"thread_id": thread_id}}
16
17 # Resume the suspended graph execution with explicit approval state
18 result = await app.ainvoke(
19 Command(resume={"status": admin_decision, "admin": "admin@company.com"}),
20 config=config
21 )
22 return {"status": "resumed", "state": result}

Real-Time Telemetry & Results

  • Real-Time Telemetry: Real-time progress is streamed to the admin UI using FastAPI async generators and Server-Sent Events (text/event-stream), enabling security admins to view execution state deltas live without refreshing.
  • Latency Reduction: Reduced average access ticket processing time from 48 hours to under 3 minutes (including human approval window).
  • Zero Orphaned Execution: PostgresSaver checkpointing ensures 100% state persistence across server restarts or admin review delays.