Expense approval workflow with human-in-the-loop gate. Java equivalent of approval-workflow/.
Local execution (no runtime needed):
mvn compile exec:javaWith the runtime (for real HITL):
jamjet dev &
mvn compile exec:java- prepare — categorizes the expense and determines if approval is needed
- review — auto-approves small expenses; pauses for human approval on large ones
- process — sends notification based on the decision
Workflow.builder()with typed record stateworkflow.compile()+IrValidator.validateOrThrow()for safe IRworkflow.run()for local execution (no runtime)JamjetClientfor submitting IR and starting executions on the runtime- Human-in-the-loop: the runtime pauses at approval steps until
client.approve()is called
--- Local Execution (small expense, auto-approved) ---
Employee: Alice
Amount: $250.00 (small)
Decision: auto-approved
--- Local Execution (large expense, requires approval) ---
Employee: Bob
Amount: $5000.00 (large)
Decision: approved
- Add an LLM step to generate expense summaries for reviewers
- Add a policy engine rule to enforce spending limits per department
- Use the runtime's approval UI for real human-in-the-loop