dotFactory Create account
All workflow ideas
Manual or event-driven

Route work with a choice

Ask an agent to classify incoming work. A typed choice enables one path, skips the other, and joins at a shared result.

Workflow

One decision · two possible paths
1
Trigger
Ticket arrives
2
Agent step
Choose a route
Decision point
Which route did the agent choose?
Path 1

Fast track

route is urgent
1Prepare an immediate response
Only this matching path runs
Path 2

Plan the work

route is planned
1Write a backlog plan
Only this matching path runs
Paths join
Record the outcome
Factory definition
.fct
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
Illustrative factory code. Connect the runner, repository access, and tools for your environment.