โพรโทคอลการส่งต่องานให้มนุษย์
ตรวจจับเงื่อนไขการส่งต่องานและโอนไปยังเจ้าหน้าที่จริงอย่างราบรื่น
โพรโทคอลการส่งต่องานให้มนุษย์ เป็นบทเรียน AI Agents ฟรีบน CoddyKit นี่คือบทเรียนที่ 3 จากทั้งหมด 4 บทเรียน คุณสามารถอ่านบทเรียนทั้งหมดด้านล่างฟรี — จากนั้นลองปฏิบัติด้วยตัวคุณเองในเบราว์เซอร์พร้อมตัวแก้ไขโค้ดในตัวและติวเตอร์ AI ตลอด 24/7 บทเรียนนี้เป็นส่วนหนึ่งของเส้นทางการเรียน AI Agents และความก้าวหน้าของคุณจะซิงค์ข้ามเว็บและแอป CoddyKit คอร์ส AI Agents มีบทเรียนทั้งหมด 4 บทเรียน
เมื่อใดควรส่งต่อให้เจ้าหน้าที่
ไม่ใช่ทุกบทสนทนาที่ควรให้เอเจนต์ AI จัดการตั้งแต่ต้นจนจบ การรู้ว่า เมื่อใดควรส่งต่อ สำคัญพอ ๆ กับการรู้วิธีตอบ ตัวกระตุ้นที่พบบ่อยมีดังนี้:
- ลูกค้าร้องขอเจ้าหน้าที่มนุษย์อย่างชัดเจน
- ตรวจพบความโกรธหรือความทุกข์ใจ
- สถานการณ์ซับซ้อนหรือกำกวมเกินขอบเขตของเอเจนต์
- ประเด็นที่อ่อนไหวด้านกฎหมาย ความปลอดภัย หรือการปฏิบัติตามข้อกำหนด
การตรวจจับตัวกระตุ้นการส่งต่อ
ใช้ตัวจำแนก LLM เพื่อตรวจจับตัวกระตุ้นการส่งต่อแบบเรียลไทม์ ตรวจสอบในทุกครั้งที่เอเจนต์โต้ตอบ ไม่ใช่แค่ข้อความแรก
import openai, json
client = openai.OpenAI(api_key='YOUR_OPENAI_KEY')
def should_handoff(message: str, history: list[dict]) -> dict:
context = '\n'.join(f"{m['role']}: {m['content']}" for m in history[-4:])
prompt = (
f'Conversation context:\n{context}\n'
f'Latest message: "{message}"\n'
f'Should this be handed to a human agent? Reasons: '
f'angry_customer, explicit_human_request, complex_issue, legal_risk, other.\n'
f'JSON: {{"handoff": true/false, "reason": "..."}}'
)
resp = client.chat.completions.create(
model='gpt-4o-mini',
messages=[{'role': 'user', 'content': prompt}],
response_format={'type': 'json_object'}
)
return json.loads(resp.choices[0].message.content)การส่งต่อแบบมีเจ้าหน้าที่รอรับกับแบบส่งต่อทันที
การส่งต่อมีสองรูปแบบ:
- การส่งต่อโดยมีเจ้าหน้าที่รอรับ: เอเจนต์แนะนำตัวเองและลูกค้าแก่เจ้าหน้าที่มนุษย์ สรุปบทสนทนา และรอให้เจ้าหน้าที่ยืนยันก่อนจบการทำงาน
- การส่งต่อทันที: โอนบทสนทนาพร้อมสรุปบันทึกการสนทนา แล้วเอเจนต์ตัดการเชื่อมต่อทันที
การส่งต่อโดยมีเจ้าหน้าที่รอรับช่วยลดความหงุดหงิดของลูกค้า แต่ต้องมีเจ้าหน้าที่มนุษย์พร้อมให้บริการแบบเรียลไทม์
การสร้างสรุปบทสนทนา
ก่อนส่งต่อ เอเจนต์จะสร้างสรุปบทสนทนาที่มีโครงสร้าง สรุปนี้จะแสดงให้เจ้าหน้าที่มนุษย์เห็นเป็นบริบท ช่วยลดความจำเป็นที่ลูกค้าต้องเล่าเรื่องซ้ำ
def generate_handoff_summary(history: list[dict]) -> str:
transcript = '\n'.join(
f"{m['role'].upper()}: {m['content']}" for m in history
)
prompt = (
f'Summarize this support conversation for a human agent.\n'
f'Include: customer issue, what was tried, current status, and urgency level.\n'
f'Be brief (3-5 sentences).\n\n'
f'TRANSCRIPT:\n{transcript}'
)
resp = client.chat.completions.create(
model='gpt-4o-mini',
messages=[{'role': 'user', 'content': prompt}]
)
return resp.choices[0].message.content
summary = generate_handoff_summary([
{'role': 'user', 'content': 'My account was charged twice for January'},
{'role': 'assistant', 'content': 'I can look into that for you...'}
])
print(summary)การสร้างรายการแจ้งปัญหาใน Zendesk เมื่อส่งต่อ
เมื่อส่งต่อ ให้สร้างรายการแจ้งปัญหาใน Zendesk พร้อมสรุปและบันทึกบทสนทนาฉบับเต็ม เจ้าหน้าที่มนุษย์จะเปิดรายการดังกล่าวและเห็นบริบทได้ทันที
import requests
ZENDESK_DOMAIN = 'yourcompany.zendesk.com'
ZENDESK_TOKEN = 'YOUR_ZENDESK_API_TOKEN'
ZENDESK_EMAIL = 'agent@yourcompany.com'
def create_zendesk_ticket(customer_email: str, subject: str,
summary: str, transcript: str) -> str:
payload = {
'ticket': {
'subject': subject,
'comment': {'body': f'AI Agent Summary:\n{summary}\n\nFull Transcript:\n{transcript}'},
'requester': {'email': customer_email},
'tags': ['ai_handoff'],
'priority': 'high'
}
}
resp = requests.post(
f'https://{ZENDESK_DOMAIN}/api/v2/tickets.json',
json=payload,
auth=(f'{ZENDESK_EMAIL}/token', ZENDESK_TOKEN)
)
resp.raise_for_status()
return str(resp.json()['ticket']['id'])การส่งต่อบทสนทนาใน Intercom
ใน Intercom ให้ส่งต่อโดยมอบหมายบทสนทนาให้ทีมหรือเจ้าหน้าที่เฉพาะรายผ่าน API ของ Intercom เจ้าหน้าที่มนุษย์จะได้รับการแจ้งเตือนพร้อมบทสนทนาที่พร้อมดำเนินการต่อ
import requests
INTERCOM_TOKEN = 'YOUR_INTERCOM_ACCESS_TOKEN'
def handoff_to_intercom_team(conversation_id: str, team_id: str,
note: str) -> bool:
headers = {
'Authorization': f'Bearer {INTERCOM_TOKEN}',
'Content-Type': 'application/json'
}
# Add a note with the AI summary
requests.post(
f'https://api.intercom.io/conversations/{conversation_id}/parts',
headers=headers,
json={'type': 'note', 'body': note}
)
# Assign to human team
resp = requests.put(
f'https://api.intercom.io/conversations/{conversation_id}/parts',
headers=headers,
json={'type': 'assignment', 'assignee_id': team_id,
'message_type': 'assignment'}
)
return resp.status_code == 200ข้อความส่งต่อถึงลูกค้า
ข้อความที่ลูกค้าได้รับระหว่างการส่งต่อมีความสำคัญ ข้อความควรยืนยันการส่งต่อ กำหนดความคาดหวังเรื่องเวลารอ และแสดงให้เห็นว่าปัญหานี้ได้รับการใส่ใจอย่างจริงจัง
def generate_handoff_message(reason: str, wait_minutes: int = 5) -> str:
messages = {
'explicit_human_request':
f'Of course! I am connecting you with a human agent right now. '
f'Estimated wait: {wait_minutes} minutes. Your conversation history '
f'has been shared so you will not need to repeat anything.',
'angry_customer':
f'I completely understand your frustration. Let me get a senior '
f'team member on the line immediately. Wait: ~{wait_minutes} min.',
'complex_issue':
f'This situation needs specialist attention. I am escalating now '
f'and sharing all the context we have discussed. Wait: ~{wait_minutes} min.',
'legal_risk':
f'This matter requires our compliance team. Connecting you now.'
}
return messages.get(reason, f'Connecting you with a human agent. ~{wait_minutes} min wait.')
if __name__ == '__main__':
print(generate_handoff_message('angry_customer', wait_minutes=3))
print(generate_handoff_message('explicit_human_request'))
การจัดคิวเมื่อไม่มีเจ้าหน้าที่มนุษย์ว่าง
นอกเวลาทำการหรือในช่วงที่มีปริมาณงานสูง อาจไม่มีเจ้าหน้าที่ว่างทันที ให้จัดคิวการส่งต่อ ส่งการยืนยันพร้อมหมายเลขอ้างอิงให้ลูกค้า และแจ้งเจ้าหน้าที่เวรผ่าน Slack หรือ PagerDuty
import requests
SLACK_WEBHOOK = 'https://hooks.slack.com/services/YOUR/WEBHOOK/URL'
def notify_on_call(ticket_id: str, summary: str, priority: str):
payload = {
'text': f'*New AI Handoff* [{priority.upper()}]',
'attachments': [{
'color': '#ff0000' if priority == 'high' else '#ffcc00',
'fields': [
{'title': 'Ticket ID', 'value': ticket_id, 'short': True},
{'title': 'Summary', 'value': summary[:500]}
]
}]
}
requests.post(SLACK_WEBHOOK, json=payload)พฤติกรรมของเอเจนต์หลังการส่งต่อ
หลังเริ่มการส่งต่อ เอเจนต์ควรหยุดพยายามแก้ไขปัญหา เอเจนต์ยังตอบคำถามที่เป็นข้อเท็จจริงได้ เช่น สถานะคำสั่งซื้อหรือลิงก์นโยบาย แต่ไม่ควรให้คำมั่นสัญญาหรือตัดสินใจใด ๆ
def agent_post_handoff_response(message: str, handoff_complete: bool) -> str:
if not handoff_complete:
return 'Connecting you now...'
# Still answer simple factual questions
simple_keywords = ['status', 'where', 'when', 'policy', 'link']
if any(kw in message.lower() for kw in simple_keywords):
return 'I can help with that while you wait for the agent.'
# Defer everything else
return (
'Your case has been assigned to a specialist. '
'They will respond shortly. I will step back to avoid confusion.'
)
if __name__ == '__main__':
print(agent_post_handoff_response('Where is my order?', handoff_complete=True))
print(agent_post_handoff_response('I want a refund now', handoff_complete=True))
การติดตามตัวชี้วัดการส่งต่อ
วัดอัตราการส่งต่อ การกระจายตามเหตุผล และเวลาที่ใช้แก้ไขหลังการส่งต่อ หากอัตราการส่งต่อสูงในเจตนาใดเจตนาหนึ่ง แสดงว่าเอเจนต์ต้องครอบคลุมหัวข้อนั้นให้ดีขึ้น
from collections import Counter
import json
handoff_log = [] # In production: a database table
def record_handoff(session_id: str, reason: str, turn_number: int):
handoff_log.append({
'session_id': session_id,
'reason': reason,
'turns_before_handoff': turn_number
})
def handoff_analytics() -> dict:
reasons = Counter(h['reason'] for h in handoff_log)
avg_turns = sum(h['turns_before_handoff'] for h in handoff_log) / max(len(handoff_log), 1)
return {
'total_handoffs': len(handoff_log),
'reason_breakdown': dict(reasons),
'avg_turns_before_handoff': round(avg_turns, 1)
}
if __name__ == '__main__':
record_handoff('s1', 'angry_customer', 4)
record_handoff('s2', 'complex_issue', 7)
record_handoff('s3', 'angry_customer', 2)
stats = handoff_analytics()
print(f"Total handoffs: {stats['total_handoffs']}")
print(f"Reasons: {stats['reason_breakdown']}")
print(f"Avg turns before handoff: {stats['avg_turns_before_handoff']}")
การประสานงานการส่งต่อทั้งหมด
รวมทุกขั้นตอนไว้ในฟังก์ชัน execute_handoff() ที่เอเจนต์เรียกใช้เมื่อพบตัวกระตุ้น
def execute_handoff(session: dict, reason: str) -> str:
# 1. Generate summary
summary = generate_handoff_summary(session['history'])
transcript = '\n'.join(
f"{m['role']}: {m['content']}" for m in session['history']
)
# 2. Create ticket
ticket_id = create_zendesk_ticket(
session['customer_email'],
f'AI Handoff: {reason}',
summary,
transcript
)
# 3. Notify on-call team
notify_on_call(ticket_id, summary, priority='high')
# 4. Record metrics
record_handoff(session['id'], reason, len(session['history']))
# 5. Return customer-facing message
wait = 5 # fetch from queue depth in production
return generate_handoff_message(reason, wait)ความแตกต่างสำคัญระหว่างการส่งต่อแบบมีเจ้าหน้าที่รอรับกับแบบส่งต่อทันทีคืออะไร
การเลือกรูปแบบการส่งต่อที่เหมาะสมส่งผลต่อประสบการณ์ของลูกค้าและความซับซ้อนในการดำเนินงาน การเข้าใจความแตกต่างนี้ช่วยให้คุณนำโพรโทคอลที่เหมาะสมไปใช้งานได้
สรุปโพรโทคอลการส่งต่อให้มนุษย์
การส่งต่อที่มีประสิทธิผลจำเป็นต้องมี: การตรวจจับตัวกระตุ้น (ความโกรธ คำขออย่างชัดเจน ความซับซ้อน) การสร้างสรุปสำหรับเจ้าหน้าที่มนุษย์ การสร้างรายการแจ้งปัญหาใน Zendesk/Intercom พร้อมบันทึกบทสนทนาฉบับเต็ม การแจ้งเจ้าหน้าที่เวร และ การส่งข้อความให้ลูกค้าเพื่อให้ทราบความคาดหวังอย่างชัดเจน
หลังการส่งต่อ เอเจนต์จะถอยออกและมอบการตัดสินใจทั้งหมดให้เจ้าหน้าที่มนุษย์
เรียนรู้ AI Agents ด้วย AI tutor — ฟรี
เขียนและเรียกใช้โค้ดจริงในเบราว์เซอร์ของคุณ รับความช่วยเหลือทันทีจาก AI tutor 24/7 และเรียนรู้ต่อจากที่คุณหยุดบนเว็บหรือในแอป
- คอร์ส
- 60
- บทเรียน
- 239
คำถามที่พบบ่อย
บทเรียน “โพรโทคอลการส่งต่องานให้มนุษย์” ฟรีหรือไม่
ใช่ — ข้อความเต็มของ “โพรโทคอลการส่งต่องานให้มนุษย์” ฟรีให้อ่านที่นี่บนเว็บ เพื่อปฏิบัติแบบโต้ตอบ (ตัวแก้ไขโค้ดในตัวและติวเตอร์ AI ตลอด 24/7) และปลดล็อคส่วนที่เหลือของคอร์ส AI Agents ให้อัปเกรดเป็น CoddyKit PRO คอร์ส AI Agents มีบทเรียนทั้งหมด 4 บทเรียน
คุณจะเรียนรู้อะไรในบทเรียน “โพรโทคอลการส่งต่องานให้มนุษย์”
ตรวจจับเงื่อนไขการส่งต่องานและโอนไปยังเจ้าหน้าที่จริงอย่างราบรื่น คุณปฏิบัติ AI Agents ด้วยโค้ดที่ใช้งานได้จริงที่คุณเรียกใช้โดยตรงในเบราว์เซอร์ และติวเตอร์ AI ตลอด 24/7 ตอบคำถามของคุณขณะที่คุณไปผ่านบทเรียน
คุณต้องมีประสบการณ์ก่อนที่จะเริ่มเรียน AI Agents หรือไม่
ไม่จำเป็นต้องมีประสบการณ์มาก่อน AI Agents บน CoddyKit ออกแบบมาสำหรับผู้เริ่มต้นไปจนถึงผู้เรียนขั้นสูง คุณสามารถเริ่มต้นที่นี่หรือเริ่มจากตัวแรกและเรียนด้วยความเร็วของคุณเอง นี่คือบทเรียนที่ 3 จากทั้งหมด 4 บทเรียน
บทเรียน “โพรโทคอลการส่งต่องานให้มนุษย์” ใช้เวลานานแค่ไหน
บทเรียน CoddyKit ส่วนใหญ่ใช้เวลาประมาณ 5–10 นาที แต่ละบทเรียนจึงสั้นและเป็นแบบโต้ตอบ คุณสามารถก้าวหน้าอย่างต่อเนื่องและกลับมาเรียนต่อจากตรงที่เพิ่งหยุดบนเว็บและแอปได้เลย
ฉันเขียนและรันโค้ดในบทเรียน AI Agents นี้ได้ไหม
ได้ บทเรียน AI Agents ทุกบทมีตัวแก้ไขโค้ดในตัว คุณจึงเขียนและรันโค้ดจริงได้เลยในเบราว์เซอร์ และได้รับข้อเสนอแนะจาก AI ในทันที — ไม่ต้องติดตั้งในเครื่องของคุณ
บทเรียนทั้งหมดในหลักสูตรนี้
- ตรรกะการจัดเส้นทางและยกระดับทิกเก็ต
- การผสาน CRM: Salesforce และ HubSpot
- โพรโทคอลการส่งต่องานให้มนุษย์
- การจัดการบริบทและประวัติลูกค้า