MightyOctopus commited on
Commit
fa024ca
·
1 Parent(s): 2b651a5

Reformat README.md in yaml

Browse files
Files changed (1) hide show
  1. README.md +142 -0
README.md CHANGED
@@ -1,3 +1,145 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
  # WorthBrain
2
 
3
  Autonomous Multi-Agent Deal Intelligence System (Deal Hunter)
 
1
+ ---
2
+ title: Worth Brain
3
+ emoji: 🧠
4
+ colorFrom: blue
5
+ colorTo: purple
6
+ sdk: gradio
7
+ python_version: "3.10"
8
+ app_file: app.py
9
+ pinned: false
10
+ ---
11
+
12
+
13
+ # WorthBrain
14
+
15
+ Autonomous Multi-Agent Deal Intelligence System (Deal Hunter)
16
+
17
+ ## Demo Video
18
+ Click the link below to watch a 4-minute video for the system demo:
19
+ https://drive.google.com/file/d/1HCyEESXbye_O19zVpYNPEQuyCv4hVQXy/view?usp=drive_link
20
+
21
+
22
+ ## Overview
23
+
24
+ WorthBrain is a multi-agent system designed to automatically discover, evaluate, and surface high value online deals (with a lot of discount).
25
+ It integrates multiple AI components, including a fine-tuned open-source LLM (QLoRA), a frontier model API, and a custom neural network estimator.
26
+ The system runs autonomously and streams live updates to a Gradio-based UI and mobile devices of the users by push notification.
27
+
28
+ The core objective of WorthBrain is to:
29
+
30
+ 1. Discover new deals online
31
+
32
+ 2. Estimate fair value using multiple AI models and price data
33
+
34
+ 3. Calculate discount potential
35
+
36
+ 4. Select the strongest opportunity (Most valuable deal, price-wise)
37
+
38
+ 5. Notify the user via an LLM-generated message and the deal table in the UI
39
+
40
+
41
+ ## System Architecture
42
+ ![WorthBrain Architecture](docs/WorthBrain.jpg)
43
+
44
+ At the highest level, WorthBrain is structured into two major layers:
45
+
46
+ - Agent Orchestration Layer
47
+
48
+ - User Interface Layer
49
+
50
+ The orchestration layer contains the Agent Framework and its sub-agents. The UI layer is responsible for rendering logs and results in real time.
51
+
52
+ ### Agent Structure
53
+
54
+ 1. Agent Framework
55
+ - Memory
56
+ - Logging
57
+ - Planning Agent
58
+
59
+ 2. Planning Agent coordinates:
60
+ - Scanner Agent (RSS deal discovery)
61
+ - Ensemble Agent (multi model price estimation, using 3 models)
62
+ - Messaging Agent (LLM-generated notification)
63
+
64
+ 3. The Ensemble Agent internally combines:
65
+ - Specialist Agent (LLaMA 3.1 8B model Fine-tuned with QLoRA)
66
+ - Frontier Agent (GPT 5 mini with RAG -- Amazon dataset)
67
+ - Neural Network Agent (Custom neural network built with Scikit Learn)
68
+
69
+ Each sub-agent has a clearly defined responsibility and communicates through structured objects (Deal, Opportunity, etc.)
70
+
71
+
72
+ ### Runtime Flow
73
+ ![WorthBrain Execution Flow](docs/WorthBrain%20-%20Execution%20Flow%20.jpg)
74
+ WorthBrain uses a producer–consumer concurrency model with queues to separate computation from UI updates.
75
+
76
+ The execution flow is as follows:
77
+
78
+ 1. Gradio UI triggers run_with_logging() on load.
79
+
80
+ 2. run_with_logging():
81
+ - Creates log_queue and result_queue
82
+ - Registers a QueueHandler for logging
83
+ - Starts a background worker thread
84
+
85
+ 3. Background Worker (Producer):
86
+ - Executes AgentFramework.run()
87
+ - During execution, logging.info(...) sends formatted log records into log_queue
88
+ - After completion, places the final opportunity table into result_queue
89
+
90
+ 4. stream_ui_updates() (Consumer Generator):
91
+ - Continuously checks log_queue for new log messages
92
+ - Appends them to persistent log state
93
+ - Checks result_queue for final results
94
+ - Yields updated UI state incrementally
95
+
96
+ 5. Gradio renders streamed output in real time.
97
+
98
+ This design prevents UI blocking while the agent system executes complex logic.
99
+
100
+ ### Concurrency Model
101
+
102
+ WorthBrain explicitly separates:
103
+
104
+ #### Producer:
105
+ - Background thread
106
+ - Performs heavy computation
107
+ - Writes to queues
108
+
109
+ #### Consumer:
110
+ - Generator loop in stream_ui_updates()
111
+ - Reads from queues using get_nowait()
112
+ - Streams results to UI
113
+
114
+ #### Transport Layer:
115
+ - queue.Queue()
116
+ - Thread-safe communication
117
+
118
+ This ensures proper cross-thread data exchange and continuous UI responsiveness.
119
+
120
+ ## Technical Stack
121
+ - Python 3.13.1
122
+ - Gradio
123
+ - Plotly
124
+ - LoRA fine-tuned open-source LLM
125
+ - OpenAI API
126
+ - Scikit Learn for custom neural network
127
+ - Threading and Queue concurrency
128
+ - Modal (serverless inference endpoint for the fine-tuned llm)
129
+ - QLoRA (fine tuned LLaMA 3.1 8b)
130
+ - logging pipeline
131
+ - RSS parsing pipeline (Beautiful Soap, FeedParser etc)
132
+
133
+ ## Project Scope
134
+ WorthBrain is not a simple demo script. It demonstrates:
135
+ - Multi-agent coordination
136
+ - Model ensemble reasoning
137
+ - Concurrency and background processing
138
+ - Streaming UI updates
139
+ - Structured system architecture
140
+
141
+ The design mirrors small-scale production patterns, focusing on clarity, modularity, and separation of concerns.
142
+
143
  # WorthBrain
144
 
145
  Autonomous Multi-Agent Deal Intelligence System (Deal Hunter)