Portal Agent Architecture ā Decision Flow
System Graph
flowchart TD
subgraph INPUT["š„ Case Intake"]
A[Case arrives in portal] --> B{Source?}
B -->|Portal scrape| C["š¤ Read Agent<br/><em>pulls case details,<br/>member info, clinical docs</em>"]
B -->|Manual entry| D[User enters case ID<br/>in dashboard]
B -->|Batch queue| E["Job queue feeds<br/>cases sequentially"]
end
subgraph AI["š§ AI Review"]
C --> F
D --> F
E --> F
F["AI Clinical Review<br/><em>prior-auth-review skill</em>"] --> G{Determination}
G -->|Approve| H["ā
Approve<br/>+ rationale + criteria cited"]
G -->|Deny| I["ā Deny<br/>+ rationale + criteria cited"]
G -->|Need more info| J["ā ļø Request Info<br/>+ what's missing"]
G -->|Uncertain| K["š Human Review<br/>AI confidence too low"]
end
subgraph VERIFY1["šļø Screen 1: Review Determination"]
H --> L
I --> L
J --> L
L["Dashboard shows:<br/>⢠AI decision + confidence<br/>⢠Clinical criteria matched<br/>⢠Supporting evidence<br/>⢠Rationale text"]
L --> M{User approves?}
M -->|Yes| N[Proceed to submission]
M -->|Edit| O[User modifies decision/rationale]
M -->|Reject| P[Back to manual review]
O --> N
K --> P
end
subgraph RPA["š„ļø Browser Agent"]
N --> Q["Launch headless Chrome"]
Q --> R["Step 1: Navigate to portal login"]
R --> S["Step 2: Enter credentials"]
S --> T{Login success?}
T -->|No| U["ā Auth failed<br/>alert user"]
T -->|Yes| V["Step 3: Find case in portal"]
V --> W{Case found?}
W -->|No| X["Fallback: direct URL nav"]
X --> W2{Found now?}
W2 -->|No| Y["ā Case not found<br/>alert user"]
W2 -->|Yes| Z
W -->|Yes| Z["Step 4: Verify case detail"]
Z --> AA["Step 5: Upload attachments<br/><em>(if any)</em>"]
AA --> BB["Step 6: Select decision + submit"]
BB --> CC{Submission success?}
CC -->|No| DD["Retry up to 2x"]
DD -->|Still fails| EE["ā Submission failed<br/>screenshots captured"]
CC -->|Yes| FF["Step 7: Extract confirmation #"]
end
subgraph VERIFY2["šļø Screen 2: Live Agent View"]
direction LR
R -.->|screenshot| LV["Browser viewport<br/><em>live screenshots<br/>per step</em>"]
S -.->|screenshot| LV
V -.->|screenshot| LV
Z -.->|screenshot| LV
BB -.->|screenshot| LV
FF -.->|screenshot| LV
end
subgraph VERIFY3["šļø Screen 3: Job Result"]
FF --> GG["Dashboard shows:<br/>⢠ā
Confirmation number<br/>⢠Step-by-step log<br/>⢠Duration per step<br/>⢠Click any step ā screenshot<br/>⢠Full Playwright trace (debug)"]
EE --> HH["Dashboard shows:<br/>⢠ā Error + which step failed<br/>⢠Screenshot at failure point<br/>⢠Playwright trace for debugging"]
U --> HH
Y --> HH
end
subgraph EVIDENCE["š Evidence Package"]
GG --> II["Saved to disk:<br/>⢠result.json<br/>⢠screenshot per step (.png)<br/>⢠trace.zip (Playwright)<br/>⢠Kept for 7 days / 20 jobs"]
end
style INPUT fill:#1a1a2e,stroke:#4a4a6a,color:#e0e0e0
style AI fill:#1a2e1a,stroke:#4a6a4a,color:#e0e0e0
style VERIFY1 fill:#2e2e1a,stroke:#6a6a4a,color:#e0e0e0
style RPA fill:#1a1a2e,stroke:#4a4a6a,color:#e0e0e0
style VERIFY2 fill:#2e2e1a,stroke:#6a6a4a,color:#e0e0e0
style VERIFY3 fill:#2e2e1a,stroke:#6a6a4a,color:#e0e0e0
style EVIDENCE fill:#1a2e2e,stroke:#4a6a6a,color:#e0e0e0
What Exists vs. What's Needed
| Layer | Status | What's There | What's Missing |
|---|---|---|---|
| Browser Agent (RPA) | ā Built | Skill engine, step runner, retries, fallbacks, evidence capture, SSE streaming | ā |
| Mock Portal | ā Built | Login, case list, case detail, decision submission, confirmation | ā |
| Live View (Screen 2) | ā Built | Per-step screenshots, progress bar, step list, error display | ā |
| Job Result (Screen 3) | ā Built | Confirmation #, step log, duration, job history | Click-to-view screenshots of past jobs |
| Concurrency + Auth | ā Built | NextAuth, job lock, rate limit, timeout, cleanup | ā |
| AI Review | š¶ Exists separately | prior-auth-review skill does clinical assessment | Not wired to portal agent ā they're separate systems |
| Review Screen (Screen 1) | ā Missing | ā | Dashboard screen showing AI determination for user approval before submission |
| Read Agent | ā Missing | ā | Skill that scrapes case details FROM portal to feed into AI review |
| Job Queue | ā Missing | ā | Batch mode: feed N cases, agent processes sequentially |
| Real Portal Skills | ā Missing | ā | Skills for Premera's actual portal(s) ā needs portal access |
User Decision Points
| # | Decision | Screen | What User Sees | Options |
|---|---|---|---|---|
| 1 | Which case to process? | Portal Agents dashboard | Case ID input (or future: queue) | Enter ID / select from queue |
| 2 | Approve AI determination? | Review screen (to build) | AI decision, confidence, rationale, criteria | Approve / Edit / Reject to manual |
| 3 | Monitor agent execution? | Live View | Real-time screenshots, step progress | Watch / ignore (runs anyway) |
| 4 | Accept result? | Job Result | Confirmation # or error + evidence | Done / retry / escalate |
| 5 | Debug failures? | Job Result (expanded) | Screenshot at failure, trace.zip | Download trace ā Playwright viewer |
The Pipeline (What "Useful" Looks Like)
Portal ā Read Agent ā AI Review ā User Approval ā Submit Agent ā Confirmation
ā ā
āāāāāāāāāāāāāāāāā Evidence package saved for audit āāāāāāāāāāāāāāāāāāā
The missing piece that makes everything click: Screen 1 (Review Determination). This is where the nurse sees the AI's work, agrees or edits, and triggers submission. Without it, the AI and the agent are two separate tools.