inquiry v1

examples/inquiry/temporal/inquiry.flow · dandori doc

A decision model picks the kind of a customer's inquiry and says how sure it is; an agent reads the inquiry for an order number and its point, and for its kind too, which the flow takes when the decision model is not sure enough of its own. A rule decides the desk that takes it and how soon it is answered; another agent drafts the first reply; and a ticket goes into the desk's system. The decision model picks, agents read and write (models the company runs itself pick and read, Claude writes), and the rule decides. Written for Temporal: the decision and the agents are activities dandori writes; the kind is asked at a server of the System One API, the API of TypeSafe's Jev (`url`; here the company's Ollama), the reading is sent to a server of Open Responses (`url`; the same Ollama), and the draft to Claude with the key the worker has; the rule runs in the worker of the workflow as a local activity, its answer kept in the history as a marker; and filing the ticket is an activity you write

flow
on failureon unsure, failuresome order_idnoneon failureinquiry v166 reading = read_inquiry(…)agent · gpt-oss:20b · http://ollama.internal:11434/v1retry 2 times every 10 seconds · timeout 1 minute68 by_hand = file_ticket(…)a task you writeretry 2 times every 5 secondstimeout, failure → the workflow fails!69 succeed ticket_id = by_hand.ticket_id, desk = general71 kind = pick_kind(…)jev · nimble:9b-q4_K_M · http://ollama.internal:11434/v1 · confidence 0.8 else unsureretry 2 times every 1 second · timeout 10 seconds72 let kind = reading.kind73 decision = routing(…)rule inquiry_routing.rule · localtimeout, failure → the workflow fails!74 let subject = "An inquiry about {kind}"75 match reading.order_id76 let subject = "An inquiry about {kind} (order {order_id…78 draft = draft_reply(…)agent claude · claude-sonnet-5timeout 1 minute79 let draft = none80 t = file_ticket(…)a task you writeretry 2 times every 5 secondstimeout, failure → the workflow fails!81 succeed ticket_id = t.ticket_id, desk = decision.desk

Calls

LineCallCallsRetriesTimeoutWhen it fails
66reading = read_inquiry(…)agent · gpt-oss:20b · http://ollama.internal:11434/v12 times every 10 seconds (failure, timeout)1 minutetimeout, failure → line 67
68by_hand = file_ticket(…)a task you write, key2 times every 5 seconds (failure, timeout)—timeout, failure → the workflow fails
71kind = pick_kind(…)jev · nimble:9b-q4_K_M · http://ollama.internal:11434/v1 · confidence 0.8 else unsure2 times every 1 second (failure, timeout)10 secondsunsure, timeout, failure → line 72
73decision = routing(…)rule inquiry_routing.rule, a local activity on Temporal2 times, after 1 second and 2 (failure, timeout)10 secondstimeout, failure → the workflow fails
78draft = draft_reply(…)agent claude · claude-sonnet-5—1 minutetimeout, failure → line 79
80t = file_ticket(…)a task you write, key2 times every 5 seconds (failure, timeout)—timeout, failure → the workflow fails

Ends

LineEnd
69succeed ticket_id = by_hand.ticket_id, desk = general
81succeed ticket_id = t.ticket_id, desk = decision.desk