使用 Switch 的客戶意圖路由
v1.1 Feature展示 v1.1 switch/case 功能——將客戶查詢路由至對應的專責處理器。
7 個節點 · 6 條連接v1.1 features
v1.1switchcustomer-serviceagent
視覺化
receive_queryapi
↓sequential→ classify_intent
classify_intentagent
↓switch→ billing_handler
billing_handleragent
↓sequential→ log_interaction
tech_handleragent
↓sequential→ log_interaction
sales_handleragent
↓sequential→ log_interaction
fallback_handlerhuman
↓sequential→ log_interaction
log_interactiondata
ex-switch-intent-routing.osop.yaml
osop_version: "1.1"
id: "switch-intent-routing"
name:"使用 Switch 的客戶意圖路由"
description:"展示 v1.1 switch/case 功能——將客戶查詢路由至對應的專責處理器。"
tags: [v1.1, switch, customer-service, agent]
nodes:
- id: "receive_query"
type: "api"
purpose: "Receive customer query via chat API."
runtime:
endpoint: "/api/chat"
method: "POST"
- id: "classify_intent"
type: "agent"
subtype: "classifier"
purpose: "Classify customer intent using NLP."
runtime:
model: "claude-haiku-4-5"
- id: "billing_handler"
type: "agent"
subtype: "llm"
purpose: "Handle billing inquiries — refunds, invoices, payment issues."
runtime:
model: "claude-sonnet-4-6"
system_prompt: "You are a billing specialist."
- id: "tech_handler"
type: "agent"
subtype: "llm"
purpose: "Handle technical support — debugging, how-to, feature questions."
runtime:
model: "claude-sonnet-4-6"
system_prompt: "You are a technical support agent."
- id: "sales_handler"
type: "agent"
subtype: "llm"
purpose: "Handle sales inquiries — pricing, plans, upgrades."
runtime:
model: "claude-sonnet-4-6"
system_prompt: "You are a sales consultant."
- id: "fallback_handler"
type: "human"
purpose: "Escalate unclassified queries to human agent."
- id: "log_interaction"
type: "data"
purpose: "Log conversation to analytics pipeline."
edges:
- from: "receive_query"
to: "classify_intent"
mode: "sequential"
- from: "classify_intent"
to: "billing_handler"
mode: "switch"
when: "outputs.classify_intent.intent"
cases:
- value: "billing"
to: "billing_handler"
- value: "technical"
to: "tech_handler"
- value: "sales"
to: "sales_handler"
default_to: "fallback_handler"
- from: "billing_handler"
to: "log_interaction"
mode: "sequential"
- from: "tech_handler"
to: "log_interaction"
mode: "sequential"
- from: "sales_handler"
to: "log_interaction"
mode: "sequential"
- from: "fallback_handler"
to: "log_interaction"
mode: "sequential"