Skip to content
msftseanPublic

About

All Clear is a surge-grade incident triage platform that deduplicates high-volume public signals into actionable incidents using FastAPI, React, and Azure AI.

Topics

Resources

Stars

0 stars

Watchers

0 watching

Forks

Latest commit

Β 

History

74 Commits

Folders and files

NameName
Last commit message
Last commit date
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

All Clear

🚨 All Clear: Surge-Grade Incident Triage

Many signals. Few incidents. One clear board.

Python FastAPI Microsoft Agent Framework React TypeScript Azure License

Collapse the surge. When a storm, outage, or recall makes 40 people report the same thing, All Clear deduplicates those signals into a handful of real incidents, routes each by severity and SLA, and drives a live map that flips green when everything is resolved.

🧬 Heritage. All Clear is the production pivot of 47 Doors. The same three-agent shape β€” classify β†’ route β†’ act β€” is rebuilt on the Microsoft Agent Framework (MAF) for incident triage in public safety, customer comms, and regulated industries.


πŸ“– Overview

All Clear is a MAF-based triage pipeline that turns a flood of inbound signals into a small, accurate set of incidents so responders work the event, not the noise. Each signal flows through one coordinated pipeline that:

  • 🎯 Classifies intent from a single inbound signal (chat, voice, phone, or report)
  • 🧲 Deduplicates by embedding similarity β€” duplicate signals attach to an open incident instead of spawning new ones
  • πŸ“Š Tracks magnitude β€” every attached report increments the incident's public-impact counter
  • πŸ”€ Routes by queue (field-operations, customer-comms, compliance-desk, engineering, escalations)
  • 🚦 Maps severity & SLA deterministically (SEV1–SEV4) β€” rules, never model vibes
  • 🎫 Opens incidents and searches knowledge only on the non-duplicate path (keeps surge latency flat)
  • πŸ“ Generates sitreps β€” citation-grounded situation reports where every claim cites a source
  • πŸ›‘οΈ Escalates to humans on safety/PII/sentiment rules β€” a security control, not a refactor
  • πŸ—ΊοΈ Drives the ClearBoard β€” a live map where incident pins visibly merge as reports attach, SLA breaches highlight, and the board flips to its green all-clear state

🎯 The hero scenario: a surge where most signals are duplicates of a few incidents. All Clear keeps the responder's queue proportional to incidents, not signal volume.

πŸ—ΊοΈ Solution Architecture

All Clear solution overview


🧱 Domain Language

One canonical term per concept (see CONTEXT.md β€” if code and that doc disagree, the doc wins).

🧩 Term πŸ“ Meaning
πŸ“‘ Signal One inbound communication on any channel. Never deduplicated away; always attributable.
πŸ”₯ Incident The real-world event signals describe (AC-####). Has severity, queue, SLA clock, magnitude, status.
πŸ”— Report The association of a signal to an incident; attaching one increments magnitude.
πŸ“Š Magnitude Count of reports on an incident β€” a proxy for scale; drives ClearBoard weight.
πŸšͺ Queue Destination work stream (replaces 47 Doors' "department").
πŸ“ Sitrep Citation-grounded situation report from generate_sitrep.
βœ… All clear Terminal state β€” every incident resolved, every SLA satisfied. Also the product name.
🌊 Surge Inbound volume spike where most signals are duplicates. The hero scenario.
πŸ—ΊοΈ ClearBoard Live map view: pins merge on dedup, magnitude counters, SLA breach highlighting.

πŸ—οΈ Architecture

πŸ”„ Three-Stage Pipeline

Three input modalities β€” text chat, browser voice (WebRTC), and phone (ACS/PSTN) β€” all route through the same pipeline. Each agent has bounded authority: it can do only what its role and tools permit.

All Clear agent pipeline

  1. 🎯 QueryAgent (MAF agent, app/agents/query_agent.py) β€” classifies one signal into intent, entities, severity indicators, and PII flags. Authority: classify only.
  2. πŸ”€ RouterExecutor (deterministic MAF workflow, app/agents/router_agent.py) β€” zero LLM calls by design and by test. Runs dedup β†’ severity/SLA mapping β†’ escalation rules β†’ a RoutingDecision.
  3. ⚑ ActionAgent (MAF agent, app/agents/action_agent.py) β€” exactly three tools: create_incident, search_knowledge, generate_sitrep. Authority: only what its tools permit.

🧲 Dedup keeps surges flat. At or above DEDUP_THRESHOLD (default 0.83 cosine) a signal attaches to an open incident (ATTACH_TO_INCIDENT) β€” magnitude increments, the reporter gets a short ack, and no knowledge search runs. Below it, a new incident opens (OPEN_INCIDENT) and the full ActionAgent path executes.

🚦 Severity & SLA

Severity is mapped from classification indicators by RouterExecutor rules β€” never by the model. Thresholds live in config.py, never in code.

πŸ”Ί Severity πŸ“‹ Meaning ⏱️ Response SLA
πŸ”΄ SEV1 Life safety, total outage, statutory clock running β€” immediate escalation 15 min
🟠 SEV2 Major impairment, public-facing, spreading 1 hr
🟑 SEV3 Contained, single-party impact 4 hrs
🟒 SEV4 Informational, routine request Next business day

βš–οΈ A statutory clock (breach-notification / recall windows) forces SEV1 regardless of other indicators. Breached SLA clocks highlight on the ClearBoard and are written to the audit log.

πŸ” Model continuity & failover

Chat runs through FailoverChatClient, which wraps an ordered list of models (primary first). When the primary returns a model-unavailability condition (404 DeploymentNotFound, 401/403 access denied, 503 service unavailable), classification automatically advances to the next configured model β€” so a model being pulled or restricted doesn't stop triage. It does not route around 429 rate limits (those stay on the retry/back-off path) or content-filter / Prompt-Shield blocks (a safety block is the system working, not an outage). The layer is a no-op until a fallback is configured (AZURE_OPENAI_FALLBACK_DEPLOYMENT), so single-model deployments are unchanged. GET /api/health/models and the ClearBoard model badge surface the active model, the fallback chain, and whether failover is active.

☁️ Azure Infrastructure

All Clear Azure deployment

πŸ”§ Service πŸ“ Purpose
πŸ›‘οΈ API Management AI gateway in front of the API/model β€” rate limits Β· token budgets Β· JWT validation Β· usage metrics (Day-1 production posture; not provisioned by azd up)
πŸ€– Azure OpenAI Signal classification + sitrep generation (gpt-5.1) β€” model-agnostic via FailoverChatClient: set AZURE_OPENAI_FALLBACK_DEPLOYMENT to arm automatic chat failover
🧠 Azure OpenAI Embeddings text-embedding-3-small (1536-dim) for dedup similarity
πŸ” Azure AI Search Knowledge base retrieval (text-embedding-3-small index)
πŸ“¦ Container Apps Backend API hosting (managed ingress Β· scale-to-zero)
πŸ’Ύ Cosmos DB Incident / audit persistence
πŸ“ž Communication Services Phone (PSTN) intake + call automation
πŸ” Key Vault Secrets management
πŸ“š Container Registry Backend container image
πŸ§ͺ Azure AI Foundry Red team Β· AI-quality evals Β· content-filter guardrails (East US 2)
πŸ“Š Azure Monitor + Log Analytics Observability / telemetry

🧭 Responsible AI + Production Path


πŸš€ Quickstart

🟑 Mock mode (offline, zero Azure credentials) β€” start here

The entire pipeline runs offline against mock twins of every Azure service. Every live service has a mock twin and they stay in lockstep.

cd backend
python -m venv .venv
.venv\Scripts\activate          # Windows  (use: source .venv/bin/activate on macOS/Linux)
pip install -r requirements.txt

# Run the full pipeline offline β€” deterministic, no Azure needed
$env:ENVIRONMENT="test"; $env:MOCK_MODE="true"
uvicorn app.main:app --reload --port 8000
# Frontend (new terminal)
cd frontend
npm install
npm run dev

πŸ§ͺ Mock mode is enabled by MOCK_MODE=true / USE_MOCK_MODE=true. Settings.use_mock_services is also true in the test environment.

πŸ”΅ Deploy to Azure with azd

azd auth login
azd up

azd up provisions the Bicep stack in infra/ and deploys the backend to Container Apps. The postdeploy hook prints the backend URL and its /api/health endpoint.


πŸ“‘ API Reference

πŸ”§ Method πŸ”— Endpoint πŸ“ Description
POST /api/signals πŸ“‘ Submit an inbound signal to the pipeline
POST /api/chat πŸ’¬ Submit a signal (chat alias of /api/signals)
GET /api/knowledge/search πŸ“š Search the knowledge base
GET /api/health πŸ’š Service health
GET /api/health/models πŸ” Active chat model, fallback chain, last-served model, and failover state
POST /api/realtime/session 🎀 Create an ephemeral realtime (voice) session
WS /api/realtime/ws 🎀 Realtime tool relay
GET /api/realtime/health 🎀 Realtime availability
POST /api/phone/incoming πŸ“ž ACS incoming-call webhook
POST /api/phone/callbacks πŸ“ž ACS call callbacks
GET /api/phone/health πŸ“ž Phone service health
GET /api/phone/transcripts/stream πŸ“Ί SSE transcript stream for the ClearBoard
WS /ws/acs-media πŸ”Š ACS media relay

πŸ§ͺ Testing

πŸ“Š Current Test Status

Suite Tests Status
Backend (pytest, mock mode) 348/348 βœ… Passing
Backend CI (clean venv) allclear-backend-ci.yml βœ…
Smoke (agents Β· evals Β· models Β· spec) smoke-test.yml βœ…
Frontend (vitest) 24/24 βœ…

Backend tests run with ENVIRONMENT=test and MOCK_MODE=true β€” no Azure credentials required.

πŸ”§ Backend

cd backend
python -m pytest tests/ -v --tb=short

🎨 Frontend

cd frontend
npm test          # vitest unit tests
npm run test:e2e  # Playwright E2E

πŸ“ Project Structure

all-clear/
β”œβ”€β”€ πŸ”§ backend/              # FastAPI + Microsoft Agent Framework
β”‚   └── app/
β”‚       β”œβ”€β”€ πŸ€– agents/       # QueryAgent Β· RouterExecutor Β· ActionAgent Β· pipeline
β”‚       β”œβ”€β”€ πŸ“‘ api/          # signals, knowledge, realtime, phone, transcripts
β”‚       β”œβ”€β”€ ☁️ services/     # Azure twins (LLM, search, phone) + mock twins
β”‚       └── βš™οΈ core/         # config (SLA, dedup threshold), dependencies
β”œβ”€β”€ 🎨 frontend/             # React + Vite + TypeScript ClearBoard
β”œβ”€β”€ ☁️ infra/                # Azure Bicep templates
β”œβ”€β”€ πŸ“‹ specs/                # MAF rehost + production-deployment specs
β”œβ”€β”€ πŸ“š docs/                 # Architecture + product docs
β”œβ”€β”€ πŸ› οΈ scripts/             # quickstart / smoke / validation
β”œβ”€β”€ πŸ“„ CONTEXT.md            # Ubiquitous domain language (source of truth)
β”œβ”€β”€ 🐳 docker-compose.yml
└── πŸ“„ azure.yaml            # azd deployment manifest

🧹 Some directories (coach-guide/, coach-site/, hackathon-site/, workshop-site/, labs/, allclear-dropin/) are 47 Doors bootcamp leftovers retained during the rehost.


πŸ›‘οΈ Security Posture

All Clear adopts a CJIS mindset everywhere β€” even where it doesn't legally apply: least privilege, full audit, no PII echo. Escalation logic is a safety control: code that weakens it is a security blocker, not a refactor. Each agent operates under bounded authority enforced by code structure (tools, interfaces), not prompt hope.


🀝 Contributing

  1. 🍴 Fork the repository
  2. 🌿 Create a feature branch (git checkout -b feature/amazing-feature)
  3. βœ… Run python -m pytest in backend/ (mock mode) before committing
  4. πŸ’Ύ Commit your changes
  5. πŸ”€ Open a Pull Request

πŸ‘₯ Contributors

  • Sean Gayle (@msftsean) β€” Operational dashboards, foundry integration, evals harness, guardrails infrastructure

πŸ“„ License

This project is licensed under the Apache License 2.0 β€” see the LICENSE file for details.


βš–οΈ Warranty & Liability

This software is provided "AS IS", without warranties or conditions of any kind. Use of this software is at your own risk. The authors and contributors are not liable for claims, damages, or other liability arising from its use.

About

All Clear is a surge-grade incident triage platform that deduplicates high-volume public signals into actionable incidents using FastAPI, React, and Azure AI.

Topics

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages