Streamlit Web UI
Relevant source files
The following files were used as context for generating this wiki page:
The Streamlit Web UI serves as the primary operations dashboard for the BrightPath AI system. It provides a visual interface for managing the multi-agent pipeline, monitoring tasks, inspecting memory files, and viewing CRM data. The interface is designed for use by managers to oversee AI-driven lead handling and customer service automation.
The UI is structured around a four-tab layout that separates active pipeline execution from historical data and system state. It integrates directly with the Anthropic API for agent logic, a SQLite database for event logging, and local Markdown files for long-term agent memory.
Sources: README.md:1-25, app.py:11-20
Interface Architecture and Styling
The UI is built with a highly customized design language using the DM Sans, Syne, and DM Mono fonts. It implements a sophisticated CSS layer to provide distinct visual feedback for different agent states and message priorities.
Visual Components
The system uses a card-based layout (bp-card) with color-coded accents to denote specific statuses:
- Default Card: Standard white background with a grey border.
- Accent Card: Yellow border for Manager Briefing outputs.
- Green Card: Green border indicating successful Specialist Agent execution.
- Red/Blue Cards: Used for alerts and specific data highlighting.
- Tags: Micro-components for displaying
category,urgency, andsentiment(e.g.,tag-sales,tag-high,tag-positive).
Sources: app.py:41-160
Sidebar and Statistics
The sidebar acts as a persistent control and monitoring panel across all tabs. It includes:
- Identity: BrightPath branding.
- API Configuration: A password-masked input for the Anthropic API key.
- Real-time Metrics: Four dynamic cards showing total Events, Open Tasks, High Urgency items, and CRM Updates.
- Model Configuration: Display of the currently active model (e.g.,
claude-sonnet-4-5).
Sources: app.py:461-510
Main Navigation Tabs
The dashboard is divided into four primary functional areas defined in the main() function of app.py.
| Tab | Purpose | Key Functionality |
|---|---|---|
| Run Pipeline | Execution | Select scenarios, run the 3-agent pipeline, and view real-time logs. |
| Tasks & History | Monitoring | View open tasks from the SQLite database and recent event history. |
| Memory Files | Inspection | Live view of the five .md files used by agents for context. |
| CRM Data | Data Management | Display contact information, VIP status, and estimated values. |
Sources: README.md:118-125, app.py:512-515
Agent Pipeline Execution
The "Run Pipeline" tab facilitates the core workflow. Users can either select from 18 pre-built test scenarios or enter a custom message.
Execution Flow
The run_pipeline function manages the sequential execution of agents and the subsequent display of results in two main columns (col_left for input, col_right for status and results).
The diagram shows the logic flow from user input through the three-agent sequence (Triage, Specialist, Briefing) and the final data persistence layer.
Sources: app.py:342-450, orchestrator.py:270-350
Pipeline Steps
- Step 1: Triage: Classifies the message and determines the
next_agent. It renders tags for category and sentiment. - Step 2: Specialist: Executes either the Sales or Customer Service agent. If the category is
admin, it builds a rich context from the database and memory for a manager briefing. - Step 3: Briefing: Generates a Telegram-ready summary and flags for value, risk, or human action.
Sources: app.py:348-408
Data Persistence and Memory Integration
The Streamlit UI performs heavy read/write operations to keep the UI in sync with the agent state.
SQLite Interaction
The dashboard pulls data from three primary tables: events, tasks, and crm_log. Functions like get_counts(), get_tasks(), and get_events() query the database to populate metric cards and history lists.
This diagram represents the schema of the brightpath.db file used by the Streamlit application to log all activity.
Sources: app.py:204-268, orchestrator.py:45-95
Memory Synchronization
After a pipeline run, the UI calls run_memory_update from memory_utils.py. This ensures that any decisions made (e.g., escalating a complaint or identifying a VIP upsell) are written back to the local Markdown files:
customer_history.mdsales_notes.mdopen_tasks.mddecision_log.mdcompany_context.md
Sources: memory_utils.py:1-40, app.py:415-417
Scenario Loading Logic
The "Run Pipeline" tab includes a selectbox populated from scenarios.py. When a scenario is selected, its corresponding message text is automatically loaded into the input area. This is handled by mapping the SCENARIOS dictionary keys to the UI component.
Sources: scenarios.py:10-100, app.py:525-535
The Streamlit Web UI acts as the central hub for the BrightPath system, providing a visual layer that abstracts the complex multi-agent orchestration into a manageable business dashboard. By integrating real-time agent processing with live database and file system updates, it provides a transparent view into the AI's decision-making process.