The Problem

❌ Without Orchestration

✅ With Orchestration

Platform Selection
Platform Model Human Tasks Python SDK Free Tier Best For
Orkes Cloud Recommended Hosted Conductor (Netflix OSS) ✓ Built-in ✓ Developer tier Visual editor + quick start
Temporal Cloud Hosted Temporal OSS ~ Via UI only ✓ 5M actions/mo Code-first, high volume
Appian Low-code BPM platform ✓ Native forms ~ Community (3 users) Business users, regulated workflows
Temporal OSS Self-hosted Docker ✓ Free Dev/test, full control
Dispute Resolution Workflow
🔄 End-to-End Flow — Triggered from AskMyBank.ai
Phase 1 · Discovery & Trigger
1
💬
Banker Queries
AskMyBank.ai NL query
AskMyBank
2
📄
Case Surfaced
ChromaDB + ClickHouse
RAG Engine
3
🚀
Start Workflow
POST /workflow with case payload
Orkes API
4
🔍
AI Classify
Nova Lite: severity + category
Bedrock Task
5
👤
Auto-Assign RM
Lookup from metadata
Orkes Task
Phase 2 · RM Acknowledgement (Durable Wait)
WAIT_FOR_SIGNAL — "rm_acknowledged" (timeout: 24 hours) Workflow pauses here durably. No polling. No lost state. If Orkes restarts, timer survives.
SLA Clock Running
⤵ Branch on signal received

✓ RM Acknowledged (within 24h)

🏦 RM opens Appian task form with full case context
📝 RM submits resolution: Resolved / Partial Refund / Escalate
🤖 AI compliance check — Nova Lite validates resolution rationale
💾 Update ClickHouse: case_status, resolution, closed_date
📧 Notify customer (simulated email task)
✅ Workflow complete — case closed

⚠ No Response (24h timeout)

🔔 Escalate to Branch Manager — new Appian task
⏳ Wait 48h for branch manager decision
📋 If still no response → auto-refer to Ombudsman
💾 Update ClickHouse: case_status = "Referred to Ombudsman"
📧 Regulatory notification task triggered

✗ Resolution Rejected by AI Check

🔁 Return to RM for re-submission with AI feedback
⏳ Max 2 retry loops
📋 After 2 failures → mandatory senior review
💾 Audit trail preserved with all attempts
System Architecture

🧠 Intelligence Layer Existing

No changes needed — workflow calls existing RAG API

⚙️ Orchestration Layer New

🖥️ Human Task Layer New

Integration Code — Python Worker

📦 How the workflow is triggered from app.py

When a banker finds a dispute in AskMyBank.ai, a single call starts the full workflow:

# In app.py — after RAG returns a dispute result
from workflow.orkes_client import start_dispute_workflow

# Banker clicks "Raise Workflow" button in Streamlit UI
if st.button("🚀 Start Resolution Workflow"):
    result = start_dispute_workflow(
        doc_id      = "DSP00042",
        customer_id = "CUST00012",
        rm_email    = "sarah.chen@securebank.com",
        case_summary = rag_response["answer"],
        dispute_amount = 4250.00,
        priority    = "High",
    )
    st.success(f"✅ Workflow started — ID: {result['workflowId']}")
    st.markdown(f"[Track in Orkes →]({result['trackingUrl']})")


# workflow/orkes_client.py
import requests, os

ORKES_URL   = os.getenv("ORKES_SERVER_URL")
ORKES_TOKEN = os.getenv("ORKES_ACCESS_TOKEN")

def start_dispute_workflow(**payload) -> dict:
    resp = requests.post(
        f"{ORKES_URL}/api/workflow/dispute_resolution",
        json    = payload,
        headers = {"X-Authorization": ORKES_TOKEN},
        timeout = 10,
    )
    resp.raise_for_status()
    wf_id = resp.json()["workflowId"]
    return {
        "workflowId"  : wf_id,
        "trackingUrl" : f"{ORKES_URL}/execution/{wf_id}"
    }
Implementation Roadmap
Week 1

🏗️ Foundation — Orkes Setup + Skeleton Workflow

Sign up for Orkes Cloud dev tier · Define workflow JSON · Deploy Python workers locally · Test trigger from app.py with mock tasks

Week 2

🤖 AI Classification Task + RM Assignment

Wire Nova Lite as a Bedrock HTTP task · Auto-assign RM from ClickHouse metadata · Add "Start Workflow" button to Streamlit UI

Week 3

⏳ Durable Wait + Escalation Logic

Implement WAIT_FOR_SIGNAL with 24h timer · Build RM acknowledgement endpoint · Wire escalation branch · Test end-to-end timeout path

Week 4

💾 ClickHouse Writeback + Human Task UI

Update case_status/resolution in ClickHouse on completion · Build Orkes Human Task form for RM resolution · Demo end-to-end with real dispute data

Optional

🏢 Appian Integration (Enterprise Upgrade)

Replace Orkes Human Tasks with Appian forms for richer UI · Target if buyer is already an Appian shop (common in ANZ banking)

Business Value

⏱️ SLA Compliance

Automated escalation ensures no case exceeds regulatory SLA. Timer survives server restarts — no cron jobs, no polling.

📋 Full Audit Trail

Every step, decision, and timestamp is persisted durably. FCA/APRA audit-ready with zero extra effort from the RM.

🔁 Resilient by Default

Orkes retries failed tasks automatically. Network blip mid-workflow? Resumes from the last checkpoint — no duplicate actions.