We develop autonomous AI request processing systems. This is an AI orchestrator that accepts incoming requests from various channels: email, forms, API, messengers. The system classifies them, extracts data, executes processing logic, and returns a response. Or creates tasks in business systems — all without operator involvement for typical cases.
Unlike a simple chatbot or an agent with a single tool, our system includes a full cycle: intake → understanding → data enrichment → execution → notification → monitoring. We have implemented dozens of such projects, and in this article we will break down the architecture using a real example.
How does request classification work?
The incoming request passes through a LangGraph state graph. The first node is a classifier based on GPT-4o with a Pydantic model. It determines the request type (technical support, billing, new order, status, complaint, refund), urgency, confidence, and the need for human escalation. If confidence is below 0.6 or the request contains triggers (legal threats, refunds above a threshold, mention of damages) — the request is handed over to an operator. This is our experience, confirmed by hundreds of projects.
System architecture
Input channels
- webhook (email parser)
- REST API
- Telegram/WhatsApp Bot
- web form
Processing core
LangGraph state graph with classification, executors, aggregator.
Output channels
- REST API of external systems (CRM, ERP, Service Desk)
- email/push notifications
- task queue (Celery/Redis)
More on graph structure and nodes
Main nodes: classify, enrich, plan, execute, generate_response, escalate_to_human, send_response. Conditional edges route_after_classification and route_after_enrichment determine the next step based on state.
from langgraph.graph import StateGraph, END
from langgraph.checkpoint.postgres import PostgresSaver
from typing import TypedDict, Annotated, Optional
from datetime import datetime
import operator
class RequestState(TypedDict):
# Incoming request
raw_content: str
channel: str # "email", "api", "telegram", "form"
sender_id: str
received_at: datetime
# Classification
request_type: Optional[str] # "support", "order", "complaint", "inquiry", "refund"
urgency: Optional[str] # "critical", "high", "normal", "low"
confidence: Optional[float]
# Enrichment
user_profile: Optional[dict]
related_entities: Optional[list] # Related orders, contracts, tickets
# Processing
action_plan: Optional[list[dict]]
executed_actions: Annotated[list, operator.add]
requires_human: bool
human_reason: Optional[str]
# Result
response_draft: Optional[str]
outcome: Optional[str]
processing_time_ms: Optional[int]
from langchain_openai import ChatOpenAI
from pydantic import BaseModel
from typing import Literal
class RequestClassification(BaseModel):
request_type: Literal["support_technical", "support_billing", "order_new",
"order_status", "complaint", "refund_request", "general_inquiry"]
urgency: Literal["critical", "high", "normal", "low"]
confidence: float
extracted_entities: dict
requires_human: bool
human_reason: Optional[str] = None
summary: str
llm = ChatOpenAI(model="gpt-4o", temperature=0)
def classify_request(state: RequestState) -> RequestState:
result = llm.with_structured_output(RequestClassification).invoke(
f"""Classify the incoming request.
Channel: {state['channel']}
Request: {state['raw_content']}
Escalate to human if:
- Legal threats or mention of litigation
- Refund request above threshold
- Mention of physical damage
- Emotionally charged review with public threats"""
)
return {
**state,
"request_type": result.request_type,
"urgency": result.urgency,
"confidence": result.confidence,
"requires_human": result.requires_human,
"human_reason": result.human_reason,
}
def plan_actions(state: RequestState) -> RequestState:
"""Agent composes an action plan based on request type"""
action_templates = {
"order_status": [
{"action": "query_order_db", "params": {"order_id": "{extracted_order_id}"}},
{"action": "generate_status_response", "params": {}},
{"action": "send_response", "params": {}},
],
"refund_request": [
{"action": "verify_refund_eligibility", "params": {}},
{"action": "create_refund_ticket", "params": {}},
{"action": "notify_finance_team", "params": {}},
{"action": "send_confirmation", "params": {}},
],
"support_technical": [
{"action": "search_knowledge_base", "params": {}},
{"action": "generate_solution", "params": {}},
{"action": "create_ticket_if_unsolved", "params": {}},
{"action": "send_response", "params": {}},
],
}
base_plan = action_templates.get(state["request_type"], [
{"action": "generate_generic_response", "params": {}},
{"action": "create_manual_review_task", "params": {}},
])
return {**state, "action_plan": base_plan}
def route_after_classification(state: RequestState) -> str:
if state["requires_human"]:
return "escalate_to_human"
if state["confidence"] < 0.6:
return "escalate_to_human"
return "enrich"
def route_after_enrichment(state: RequestState) -> str:
if state.get("user_profile", {}).get("tier") == "vip" and state["urgency"] in ("high", "critical"):
return "plan_premium"
return "plan"
graph = StateGraph(RequestState)
graph.add_node("classify", classify_request)
graph.add_node("enrich", enrich_request)
graph.add_node("plan", plan_actions)
graph.add_node("plan_premium", plan_premium_actions)
graph.add_node("execute", execute_actions)
graph.add_node("generate_response", generate_final_response)
graph.add_node("escalate_to_human", create_human_task)
graph.add_node("send_response", send_response_to_channel)
graph.set_entry_point("classify")
graph.add_conditional_edges("classify", route_after_classification)
graph.add_conditional_edges("enrich", route_after_enrichment)
graph.add_edge("plan", "execute")
graph.add_edge("plan_premium", "execute")
graph.add_edge("execute", "generate_response")
graph.add_edge("generate_response", "send_response")
graph.add_edge("send_response", END)
graph.add_edge("escalate_to_human", END)
processor = graph.compile(checkpointer=PostgresSaver(conn))
Why does the system work without an operator?
The key difference is the ability to perform actions in business systems: create orders, check statuses, process refunds, send notifications. Each action is a ready-made module that the system invokes according to the plan. The action planner forms a sequence of steps based on the request type and user context. If the plan is successfully executed, the response is sent automatically. Otherwise, the system escalates the task to an operator with a detailed error log.
Practical case: online retailer, 2500 requests/day
Before implementation: average first response time 4.2 hours, 12 operators working three shifts, 60% of time spent on standard status inquiries.
| Request type | Share in flow |
|---|---|
| Order status | 41% |
| Refunds | 19% |
| Technical issues | 14% |
| General questions | 17% |
| Complaints and claims | 9% |
After implementation:
- Autonomous processing without operator involvement: 74%
- Average first response time: from 4.2 hours to 2.1 minutes (120x faster)
- Night shift: reduced from 4 to 1 operator (monitoring escalations)
- Response accuracy (sample of 500 requests): 94.1%
- False escalations: 8.3%
- Erroneous automatic closure: 2.1%
| Metric | Before | After |
|---|---|---|
| Average first response time | 4.2 hours | 2.1 min |
| Share of autonomous requests | 0% | 74% |
| Operators per shift | 12 | 4 (night shift reduction) |
What is included in the work
- Architecture and design: modeling the state graph, defining request types, processing scenarios.
- Classifier development: prompt engineering, GPT-4o fine-tuning if necessary, testing on historical data.
- Channel integration: webhook, API, messengers, web forms.
- Action executors: connection to CRM, ERP, Service Desk, coding for standard operations.
- Monitoring system: Prometheus metrics, Grafana dashboards, SLA alerts.
- Documentation: graph description, API, operator instructions.
- Team training: workshop on model fine-tuning and administration.
- Launch support: 2 weeks of post-deployment assistance.
How we do it: step-by-step plan
- Analytics (1–2 weeks): collect logs, identify typical requests, define escalation criteria.
- Graph design (1–2 weeks): create StateGraph, define nodes and edges.
- Classifier development (2–3 weeks): train model, test on sample.
- Executor implementation (2–4 weeks): code for each request type.
- Channel integration (1–2 weeks): connect email, API, messengers.
- Testing and calibration (2 weeks): run on real data, adjust thresholds.
- Deployment and monitoring: deploy on Kubernetes, configure alerts.
Timeline
- System architecture and graph: 1–2 weeks
- Classifier + data enrichment: 2–3 weeks
- Executors for each request type: 2–4 weeks
- Channel integration (email, messengers): 1–2 weeks
- Calibration and production launch: 2 weeks
- Total: 8–13 weeks
We'll evaluate your project – just contact us. We guarantee transparency at every stage and provide full documentation. Certified engineers with 10+ years of experience will implement the system turnkey. For a preliminary assessment of your request flow, order a free audit – we will determine the automation potential and implementation timeline.







