Trigger
Ticket arrives
Ask an agent to classify incoming work. A typed choice enables one path, skips the other, and joins at a shared result.
type Ticket = { title: text, body: text }
type Route = choice {
urgent { reason: text }
planned { area: text }
}
trigger start:
kind: manual
out: { ticket: Ticket }
runner agent:
kind: opencode
in: open
out: open
step classify:
runner: agent
in:
prompt: "Choose urgent or planned for this ticket."
ticket: start.ticket
out: { route: Route }
step fast_track:
runner: agent
when: classify.route is urgent
in:
prompt: "Prepare an immediate response."
reason: classify.route.urgent.reason
out: { report: text }
step plan_work:
runner: agent
when: classify.route is planned
in:
prompt: "Write a plan for the backlog."
area: classify.route.planned.area
out: { report: text }
step result:
kind: file
config: { path: "out/routed-work.json" }
in:
ticket: start.ticket
urgent_report?: fast_track.report if classify.route is urgent
planned_report?: plan_work.report if classify.route is planned