modelbuilderhq commited on
Commit
8c82a6f
·
verified ·
1 Parent(s): e0f127e

Delete tasks.py with huggingface_hub

Browse files
Files changed (1) hide show
  1. tasks.py +0 -405
tasks.py DELETED
@@ -1,405 +0,0 @@
1
- """Task registry for the SupportDesk environment."""
2
-
3
- from __future__ import annotations
4
-
5
- from dataclasses import dataclass
6
- from typing import Literal
7
-
8
- from models import KnowledgeSnippet, SupportTicket
9
-
10
-
11
- ALL_QUEUES = [
12
- "billing_ops",
13
- "trust_and_safety",
14
- "platform_engineering",
15
- "compliance_ops",
16
- "general_support",
17
- ]
18
- ALL_PRIORITIES = ["low", "normal", "high", "urgent"]
19
- ALL_STATUSES = ["new", "waiting_on_customer", "resolved", "escalated"]
20
- ALL_ISSUE_TYPES = [
21
- "duplicate_charge",
22
- "account_compromise",
23
- "production_incident",
24
- "regulated_exception",
25
- "general_question",
26
- ]
27
-
28
-
29
- @dataclass(frozen=True)
30
- class SupportTaskSpec:
31
- """Immutable definition of a single support triage task."""
32
-
33
- task_id: str
34
- difficulty: Literal["easy", "medium", "hard"]
35
- title: str
36
- objective: str
37
- ticket: SupportTicket
38
- knowledge_base: tuple[KnowledgeSnippet, ...]
39
- gold_queue: str
40
- gold_priority: str
41
- gold_issue_type: str
42
- gold_status: str
43
- gold_resolution_code: str
44
- required_requested_fields: tuple[str, ...]
45
- required_reply_markers: tuple[tuple[str, ...], ...]
46
- required_note_markers: tuple[tuple[str, ...], ...]
47
- forbidden_reply_markers: tuple[str, ...] = ()
48
- risk_flags: tuple[str, ...] = ()
49
- follow_up_outcome: Literal["none", "partial", "complete", "incorrect"] = "none"
50
- follow_up_message: str = ""
51
- follow_up_provided_fields: tuple[str, ...] = ()
52
- follow_up_wrong_fields: tuple[str, ...] = ()
53
- sla_step_cost: int = 15
54
- over_escalation_queues: tuple[str, ...] = ()
55
- under_escalation_deadline_step: int | None = None
56
- max_steps: int = 6
57
-
58
-
59
- TASKS: dict[str, SupportTaskSpec] = {
60
- "billing_refund_easy": SupportTaskSpec(
61
- task_id="billing_refund_easy",
62
- difficulty="easy",
63
- title="Duplicate charge refund triage",
64
- objective=(
65
- "Triage a duplicate-charge billing ticket, send the correct customer response, "
66
- "and close the case only if no further customer information is required."
67
- ),
68
- ticket=SupportTicket(
69
- customer_name="Riya Shah",
70
- customer_tier="pro",
71
- company="PixelNorth Studio",
72
- subject="Charged twice after I canceled",
73
- body=(
74
- "I canceled our Pro annual workspace yesterday, but my card was charged again "
75
- "this morning and I still see the old invoice. We only had one workspace, "
76
- "so this looks like a duplicate charge. Please fix it quickly."
77
- ),
78
- region="ap-south-1",
79
- affected_users=12,
80
- sla_minutes_remaining=240,
81
- business_impact="Finance ops are blocked from closing the monthly books until the duplicate invoice is fixed.",
82
- secondary_concerns=["The customer also wants confirmation that the canceled workspace will stay deactivated."],
83
- attachments=["invoice_7741.pdf"],
84
- ),
85
- knowledge_base=(
86
- KnowledgeSnippet(
87
- article_id="KB-101",
88
- title="Duplicate charges and same-day cancellations",
89
- content=(
90
- "If a customer reports a duplicate charge and the subscription is already "
91
- "canceled, route the ticket to billing_ops with high priority. Billing can "
92
- "approve the refund immediately without requesting extra information when an "
93
- "invoice is attached."
94
- ),
95
- ),
96
- KnowledgeSnippet(
97
- article_id="KB-102",
98
- title="Refund communication checklist",
99
- content=(
100
- "Customer replies for approved duplicate-charge refunds must confirm that a "
101
- "refund is being processed, mention the duplicate charge, and set the "
102
- "expectation that funds typically appear within 5-7 business days."
103
- ),
104
- ),
105
- KnowledgeSnippet(
106
- article_id="KB-103",
107
- title="When to close a billing case",
108
- content=(
109
- "Close the case as resolved only after the refund path is clear and no more "
110
- "customer details are needed."
111
- ),
112
- ),
113
- ),
114
- gold_queue="billing_ops",
115
- gold_priority="high",
116
- gold_issue_type="duplicate_charge",
117
- gold_status="resolved",
118
- gold_resolution_code="refund_approved",
119
- required_requested_fields=(),
120
- required_reply_markers=(
121
- ("refund", "refunded", "reimburse"),
122
- ("duplicate charge", "charged twice", "double charge"),
123
- ("5-7 business days", "5 to 7 business days", "within 7 business days"),
124
- ),
125
- required_note_markers=(
126
- ("duplicate charge", "double charge"),
127
- ("refund", "refund approved"),
128
- ),
129
- forbidden_reply_markers=("chargeback", "security team"),
130
- risk_flags=("finance_close_risk", "avoid_unnecessary_back_and_forth"),
131
- over_escalation_queues=("trust_and_safety", "platform_engineering", "compliance_ops"),
132
- sla_step_cost=10,
133
- max_steps=6,
134
- ),
135
- "account_takeover_medium": SupportTaskSpec(
136
- task_id="account_takeover_medium",
137
- difficulty="medium",
138
- title="Suspicious login recovery triage",
139
- objective=(
140
- "Handle a potential account-compromise case, request the missing verification "
141
- "details, communicate safe next steps, and keep the case open until the customer replies. "
142
- "The agent must protect account safety without promising an unsafe immediate unlock."
143
- ),
144
- ticket=SupportTicket(
145
- customer_name="Marcus Lee",
146
- customer_tier="pro",
147
- company="Northline Analytics",
148
- subject="Locked out after strange login alert",
149
- body=(
150
- "Our workspace admin got a login alert from a country none of us have visited, "
151
- "and now I can't get back into the account. Please unlock it ASAP. The billing "
152
- "email is still ours, but I'm worried someone got in."
153
- ),
154
- region="us-east-1",
155
- affected_users=34,
156
- sla_minutes_remaining=90,
157
- business_impact="The admin is locked out of the analytics workspace ahead of the Monday executive review.",
158
- secondary_concerns=["The customer wants the account unlocked immediately, but the verification flow cannot be skipped."],
159
- attachments=[],
160
- ),
161
- knowledge_base=(
162
- KnowledgeSnippet(
163
- article_id="SEC-201",
164
- title="Account compromise routing",
165
- content=(
166
- "Potential account-takeover reports route to trust_and_safety with urgent "
167
- "priority. Do not resolve the case immediately."
168
- ),
169
- ),
170
- KnowledgeSnippet(
171
- article_id="SEC-202",
172
- title="Verification details before unlock",
173
- content=(
174
- "Before access can be restored, ask the customer for the workspace_id, the "
175
- "last successful login time, and the billing email on file. Keep the status "
176
- "waiting_on_customer until the details arrive."
177
- ),
178
- ),
179
- KnowledgeSnippet(
180
- article_id="SEC-203",
181
- title="Customer response checklist",
182
- content=(
183
- "Security replies should tell the customer to reset their password, scan "
184
- "their device for malware, and explain that the trust team is reviewing the case."
185
- ),
186
- ),
187
- ),
188
- gold_queue="trust_and_safety",
189
- gold_priority="urgent",
190
- gold_issue_type="account_compromise",
191
- gold_status="waiting_on_customer",
192
- gold_resolution_code="verification_needed",
193
- required_requested_fields=("workspace_id", "last_successful_login", "billing_email"),
194
- required_reply_markers=(
195
- ("reset your password", "change your password"),
196
- ("scan", "malware", "device check"),
197
- ("trust team", "security team", "trust and safety"),
198
- ),
199
- required_note_markers=(
200
- ("suspicious login", "strange login"),
201
- ("locked out", "can't get back", "cannot get back"),
202
- ),
203
- risk_flags=("unsafe_unlock_request", "identity_verification_required"),
204
- follow_up_outcome="partial",
205
- follow_up_message=(
206
- "Customer follow-up: workspace_id=ws_9021 and billing email confirmed, "
207
- "but they could not provide the last successful login time yet."
208
- ),
209
- follow_up_provided_fields=("workspace_id", "billing_email"),
210
- sla_step_cost=18,
211
- under_escalation_deadline_step=2,
212
- max_steps=7,
213
- ),
214
- "api_incident_hard": SupportTaskSpec(
215
- task_id="api_incident_hard",
216
- difficulty="hard",
217
- title="Production API incident escalation",
218
- objective=(
219
- "Triage a high-pressure enterprise incident, ask for the right diagnostics, notify "
220
- "the customer that engineering is engaged, and escalate instead of resolving. "
221
- "The agent must prioritize the outage over a tempting secondary compliance question."
222
- ),
223
- ticket=SupportTicket(
224
- customer_name="Asha Verma",
225
- customer_tier="enterprise",
226
- company="Kairo Health",
227
- subject="EU rollout blocked by intermittent 500s",
228
- body=(
229
- "We're launching our EU workspace tonight. Since enabling EU data residency we "
230
- "see intermittent HTTP 500 responses from /v1/exports in production. Our "
231
- "compliance lead is also asking whether this affects the audit trail, but the "
232
- "main issue is the outage. We need help immediately."
233
- ),
234
- region="eu-west-1",
235
- affected_users=1800,
236
- sla_minutes_remaining=25,
237
- business_impact="A production launch and a customer-facing compliance review are both at risk tonight if the outage persists.",
238
- secondary_concerns=["The compliance lead is asking whether audit trails are affected, but the live outage is the primary incident."],
239
- attachments=["error_screenshot.png"],
240
- ),
241
- knowledge_base=(
242
- KnowledgeSnippet(
243
- article_id="INC-301",
244
- title="Production availability incidents",
245
- content=(
246
- "Any active production 5xx incident for a paying customer routes to "
247
- "platform_engineering with urgent priority and should be escalated, not resolved."
248
- ),
249
- ),
250
- KnowledgeSnippet(
251
- article_id="INC-302",
252
- title="Minimum diagnostics for API incidents",
253
- content=(
254
- "Before engineering can investigate, request concrete examples including "
255
- "request_ids, UTC timestamps, and the affected region."
256
- ),
257
- ),
258
- KnowledgeSnippet(
259
- article_id="INC-303",
260
- title="Customer communication during an incident",
261
- content=(
262
- "The reply should acknowledge an incident, say the on-call engineering team "
263
- "is engaged, and ask for the diagnostics needed to speed investigation."
264
- ),
265
- ),
266
- KnowledgeSnippet(
267
- article_id="INC-304",
268
- title="Primary issue triage rule",
269
- content=(
270
- "When a production outage appears alongside a secondary compliance or audit "
271
- "question, resolve the live outage first and avoid treating the secondary "
272
- "question as the primary queue-driving issue."
273
- ),
274
- ),
275
- ),
276
- gold_queue="platform_engineering",
277
- gold_priority="urgent",
278
- gold_issue_type="production_incident",
279
- gold_status="escalated",
280
- gold_resolution_code="incident_opened",
281
- required_requested_fields=("request_ids", "timestamp_utc", "region"),
282
- required_reply_markers=(
283
- ("incident", "outage", "investigating"),
284
- ("on-call", "engineering team", "engineering is engaged"),
285
- ("request id", "request_ids"),
286
- ("utc", "timestamp"),
287
- ),
288
- required_note_markers=(
289
- ("eu data residency", "eu rollout"),
290
- ("500", "http 500"),
291
- ("launch tonight", "tonight"),
292
- ),
293
- risk_flags=("sev1_launch_risk", "secondary_issue_distraction", "engineering_escalation_required"),
294
- follow_up_outcome="complete",
295
- follow_up_message=(
296
- "Customer follow-up: request_ids=req_991, req_998; UTC timestamps=2026-04-01T19:20Z, "
297
- "2026-04-01T19:27Z; region=eu-west-1."
298
- ),
299
- follow_up_provided_fields=("request_ids", "timestamp_utc", "region"),
300
- sla_step_cost=25,
301
- under_escalation_deadline_step=2,
302
- max_steps=8,
303
- ),
304
- "regulated_export_exception_hard": SupportTaskSpec(
305
- task_id="regulated_export_exception_hard",
306
- difficulty="hard",
307
- title="Regulated export exception triage",
308
- objective=(
309
- "Handle a regulated export-access request where the customer wants a manual bypass. "
310
- "The agent must avoid escalating to engineering just because an export error is mentioned, "
311
- "route to compliance operations, request the right legal details, and keep the case open "
312
- "until the required approvals are supplied."
313
- ),
314
- ticket=SupportTicket(
315
- customer_name="Dr. Elena Kovacs",
316
- customer_tier="enterprise",
317
- company="NorthSea Clinics",
318
- subject="Need urgent export unlock before audit review",
319
- body=(
320
- "Our audit team needs tonight's export package, but after enabling EU residency the "
321
- "export workflow now shows a policy block. Can you temporarily disable the restriction "
322
- "or give us a manual bypass just for this audit? We are under pressure and can share "
323
- "screenshots if needed."
324
- ),
325
- region="eu-central-1",
326
- affected_users=240,
327
- sla_minutes_remaining=55,
328
- business_impact="A regulated healthcare audit review may slip tonight if the export path remains blocked.",
329
- secondary_concerns=[
330
- "The customer suggests an engineering workaround, but legal approval is the real gating factor."
331
- ],
332
- attachments=["policy_block.png"],
333
- ),
334
- knowledge_base=(
335
- KnowledgeSnippet(
336
- article_id="CMP-401",
337
- title="Export policy exceptions",
338
- content=(
339
- "Requests to bypass region or export restrictions route to compliance_ops. "
340
- "Do not promise a manual engineering workaround before approvals are verified."
341
- ),
342
- ),
343
- KnowledgeSnippet(
344
- article_id="CMP-402",
345
- title="Minimum legal details for export review",
346
- content=(
347
- "Ask for the tenant_region, dpa_amendment_id, and legal_contact_email before "
348
- "compliance can review an export exception."
349
- ),
350
- ),
351
- KnowledgeSnippet(
352
- article_id="CMP-403",
353
- title="Customer response rules for regulated exceptions",
354
- content=(
355
- "Replies must explain that no temporary bypass can be granted yet, mention the "
356
- "compliance review, and request the required legal approval details."
357
- ),
358
- ),
359
- ),
360
- gold_queue="compliance_ops",
361
- gold_priority="high",
362
- gold_issue_type="regulated_exception",
363
- gold_status="waiting_on_customer",
364
- gold_resolution_code="legal_approval_required",
365
- required_requested_fields=("tenant_region", "dpa_amendment_id", "legal_contact_email"),
366
- required_reply_markers=(
367
- ("no temporary bypass", "cannot provide a bypass", "can’t provide a bypass"),
368
- ("compliance review", "compliance team"),
369
- ("tenant_region", "tenant region"),
370
- ("dpa_amendment_id", "dpa amendment", "amendment id"),
371
- ),
372
- required_note_markers=(
373
- ("audit", "audit review"),
374
- ("eu residency", "policy block"),
375
- ("manual bypass", "workaround"),
376
- ),
377
- forbidden_reply_markers=("engineering workaround", "disable the restriction", "temporary unlock approved"),
378
- risk_flags=("regulated_data_risk", "unsafe_shortcut_pressure", "over_escalation_risk"),
379
- follow_up_outcome="incorrect",
380
- follow_up_message=(
381
- "Customer follow-up: sent a screenshot and export job ID, but did not include the DPA "
382
- "amendment ID or legal contact."
383
- ),
384
- follow_up_wrong_fields=("screenshot", "job_id"),
385
- sla_step_cost=16,
386
- over_escalation_queues=("platform_engineering",),
387
- max_steps=8,
388
- ),
389
- }
390
-
391
-
392
- def get_task(task_id: str) -> SupportTaskSpec:
393
- """Return a task definition or raise a helpful error."""
394
-
395
- try:
396
- return TASKS[task_id]
397
- except KeyError as exc: # pragma: no cover - defensive
398
- valid = ", ".join(sorted(TASKS))
399
- raise ValueError(f"Unknown task_id '{task_id}'. Valid task ids: {valid}") from exc
400
-
401
-
402
- def list_task_ids() -> list[str]:
403
- """List tasks in a stable evaluation order."""
404
-
405
- return list(TASKS)