hypermotion 1.0.0__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- hypermotion-1.0.0/PKG-INFO +218 -0
- hypermotion-1.0.0/README.md +175 -0
- hypermotion-1.0.0/app/agents/__init__.py +26 -0
- hypermotion-1.0.0/app/agents/audience_miner.py +63 -0
- hypermotion-1.0.0/app/agents/base.py +16 -0
- hypermotion-1.0.0/app/agents/engagement_agent.py +107 -0
- hypermotion-1.0.0/app/agents/facebook_content_agent.py +289 -0
- hypermotion-1.0.0/app/agents/facebook_growth_agent.py +214 -0
- hypermotion-1.0.0/app/agents/fact_checker.py +81 -0
- hypermotion-1.0.0/app/agents/learner.py +21 -0
- hypermotion-1.0.0/app/agents/script_forge.py +126 -0
- hypermotion-1.0.0/app/agents/seo_optimizer.py +147 -0
- hypermotion-1.0.0/app/agents/strategist.py +79 -0
- hypermotion-1.0.0/app/agents/trend_hunter.py +95 -0
- hypermotion-1.0.0/app/api.py +1258 -0
- hypermotion-1.0.0/app/config.py +149 -0
- hypermotion-1.0.0/app/db.py +694 -0
- hypermotion-1.0.0/app/events.py +29 -0
- hypermotion-1.0.0/app/llm/__init__.py +7 -0
- hypermotion-1.0.0/app/llm/base.py +35 -0
- hypermotion-1.0.0/app/llm/gateway.py +856 -0
- hypermotion-1.0.0/app/llm/gemini_provider.py +99 -0
- hypermotion-1.0.0/app/llm/omniroute_provider.py +135 -0
- hypermotion-1.0.0/app/llm/omnirouter.py +329 -0
- hypermotion-1.0.0/app/llm/openai_provider.py +81 -0
- hypermotion-1.0.0/app/main.py +266 -0
- hypermotion-1.0.0/app/models.py +202 -0
- hypermotion-1.0.0/app/orchestrator.py +477 -0
- hypermotion-1.0.0/app/scheduler.py +79 -0
- hypermotion-1.0.0/app/tools/__init__.py +11 -0
- hypermotion-1.0.0/app/tools/cache.py +31 -0
- hypermotion-1.0.0/app/tools/facebook.py +502 -0
- hypermotion-1.0.0/app/tools/image_generator.py +205 -0
- hypermotion-1.0.0/app/tools/news.py +44 -0
- hypermotion-1.0.0/app/tools/quiz_generator.py +455 -0
- hypermotion-1.0.0/app/tools/reddit.py +48 -0
- hypermotion-1.0.0/app/tools/trends.py +57 -0
- hypermotion-1.0.0/app/tools/webfetch.py +40 -0
- hypermotion-1.0.0/app/tools/youtube_search.py +57 -0
- hypermotion-1.0.0/hypermotion.egg-info/PKG-INFO +218 -0
- hypermotion-1.0.0/hypermotion.egg-info/SOURCES.txt +48 -0
- hypermotion-1.0.0/hypermotion.egg-info/dependency_links.txt +1 -0
- hypermotion-1.0.0/hypermotion.egg-info/entry_points.txt +2 -0
- hypermotion-1.0.0/hypermotion.egg-info/requires.txt +23 -0
- hypermotion-1.0.0/hypermotion.egg-info/top_level.txt +2 -0
- hypermotion-1.0.0/pyproject.toml +79 -0
- hypermotion-1.0.0/setup.cfg +4 -0
- hypermotion-1.0.0/tests/test_facebook.py +154 -0
- hypermotion-1.0.0/tests/test_gateway.py +270 -0
- hypermotion-1.0.0/tests/test_pipeline.py +100 -0
|
@@ -0,0 +1,218 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: hypermotion
|
|
3
|
+
Version: 1.0.0
|
|
4
|
+
Summary: Multi-Agent Autonomous Content Research, Scriptwriting, SEO & Facebook Growth Engine
|
|
5
|
+
Author: sayeeddesignerz-creator
|
|
6
|
+
License-Expression: MIT
|
|
7
|
+
Project-URL: Homepage, https://github.com/sayeeddesignerz-creator/Hyper-Motion
|
|
8
|
+
Project-URL: Repository, https://github.com/sayeeddesignerz-creator/Hyper-Motion
|
|
9
|
+
Project-URL: Issues, https://github.com/sayeeddesignerz-creator/Hyper-Motion/issues
|
|
10
|
+
Keywords: ai,automation,content-generation,facebook,seo,multi-agent,fastapi,social-media,growth-engine
|
|
11
|
+
Classifier: Development Status :: 4 - Beta
|
|
12
|
+
Classifier: Intended Audience :: Developers
|
|
13
|
+
Classifier: Programming Language :: Python :: 3
|
|
14
|
+
Classifier: Programming Language :: Python :: 3.10
|
|
15
|
+
Classifier: Programming Language :: Python :: 3.11
|
|
16
|
+
Classifier: Programming Language :: Python :: 3.12
|
|
17
|
+
Classifier: Topic :: Internet :: WWW/HTTP :: HTTP Servers
|
|
18
|
+
Classifier: Topic :: Scientific/Engineering :: Artificial Intelligence
|
|
19
|
+
Requires-Python: >=3.10
|
|
20
|
+
Description-Content-Type: text/markdown
|
|
21
|
+
Requires-Dist: fastapi<1.0.0,>=0.111.0
|
|
22
|
+
Requires-Dist: uvicorn[standard]<1.0.0,>=0.30.0
|
|
23
|
+
Requires-Dist: pydantic<3.0.0,>=2.7.0
|
|
24
|
+
Requires-Dist: pydantic-settings<3.0.0,>=2.3.0
|
|
25
|
+
Requires-Dist: pyyaml<7.0.0,>=6.0.0
|
|
26
|
+
Requires-Dist: httpx<1.0.0,>=0.27.0
|
|
27
|
+
Requires-Dist: python-dotenv<2.0.0,>=1.0.0
|
|
28
|
+
Requires-Dist: sse-starlette<3.0.0,>=2.0.0
|
|
29
|
+
Requires-Dist: google-genai<2.0.0,>=1.0.0
|
|
30
|
+
Requires-Dist: openai<2.0.0,>=1.30.0
|
|
31
|
+
Requires-Dist: feedparser<7.0.0,>=6.0.0
|
|
32
|
+
Requires-Dist: pytrends<5.0.0,>=4.9.0
|
|
33
|
+
Requires-Dist: rapidfuzz<4.0.0,>=3.9.0
|
|
34
|
+
Requires-Dist: tenacity<10.0.0,>=8.3.0
|
|
35
|
+
Requires-Dist: aiosqlite<1.0.0,>=0.20.0
|
|
36
|
+
Requires-Dist: apscheduler<4.0.0,>=3.10.4
|
|
37
|
+
Requires-Dist: pillow>=10.0.0
|
|
38
|
+
Requires-Dist: rich>=13.0.0
|
|
39
|
+
Provides-Extra: dev
|
|
40
|
+
Requires-Dist: pytest<9.0.0,>=8.2.0; extra == "dev"
|
|
41
|
+
Requires-Dist: pytest-asyncio<1.0.0,>=0.23.0; extra == "dev"
|
|
42
|
+
Requires-Dist: pytest-httpx<1.0.0,>=0.30.0; extra == "dev"
|
|
43
|
+
|
|
44
|
+
<div align="center">
|
|
45
|
+
|
|
46
|
+
# ⚡ Hyper Motion
|
|
47
|
+
|
|
48
|
+
**Multi-Agent Autonomous Content Research · Scriptwriting · SEO · Facebook Growth Engine**
|
|
49
|
+
|
|
50
|
+
[](https://python.org)
|
|
51
|
+
[](https://fastapi.tiangolo.com)
|
|
52
|
+
[](LICENSE)
|
|
53
|
+
[](https://github.com/sayeeddesignerz-creator/Hyper-Motion)
|
|
54
|
+
|
|
55
|
+
</div>
|
|
56
|
+
|
|
57
|
+
---
|
|
58
|
+
|
|
59
|
+
## 🚀 Install in One Command
|
|
60
|
+
|
|
61
|
+
```bash
|
|
62
|
+
pip install hypermotion
|
|
63
|
+
```
|
|
64
|
+
|
|
65
|
+
> Requires **Python 3.10+**. A virtual environment is strongly recommended.
|
|
66
|
+
|
|
67
|
+
---
|
|
68
|
+
|
|
69
|
+
## ⚙️ Quick Start
|
|
70
|
+
|
|
71
|
+
### 1 — Install
|
|
72
|
+
|
|
73
|
+
```bash
|
|
74
|
+
pip install hypermotion
|
|
75
|
+
```
|
|
76
|
+
|
|
77
|
+
### 2 — Initialize a fresh workspace
|
|
78
|
+
|
|
79
|
+
```bash
|
|
80
|
+
# Creates .env template + empty data/output dirs — nothing from anyone else
|
|
81
|
+
hypermotion init
|
|
82
|
+
```
|
|
83
|
+
|
|
84
|
+
Or into a specific folder:
|
|
85
|
+
|
|
86
|
+
```bash
|
|
87
|
+
hypermotion init ./my-hypermotion
|
|
88
|
+
cd my-hypermotion
|
|
89
|
+
```
|
|
90
|
+
|
|
91
|
+
### 3 — Add your API keys
|
|
92
|
+
|
|
93
|
+
Edit the generated `.env` file:
|
|
94
|
+
|
|
95
|
+
```env
|
|
96
|
+
# Minimum required — pick at least one LLM provider
|
|
97
|
+
GEMINI_API_KEY=your-gemini-key-here
|
|
98
|
+
|
|
99
|
+
# Optional extras (adds fallback & image generation)
|
|
100
|
+
OPENAI_API_KEY=
|
|
101
|
+
OPENROUTER_API_KEY=
|
|
102
|
+
|
|
103
|
+
# Facebook Growth Engine (sandbox mode works without these)
|
|
104
|
+
FACEBOOK_PAGE_ID=
|
|
105
|
+
FACEBOOK_PAGE_ACCESS_TOKEN=
|
|
106
|
+
```
|
|
107
|
+
|
|
108
|
+
> 🔒 `.env` is listed in `.gitignore` — it is **never** committed or shared.
|
|
109
|
+
|
|
110
|
+
### 4 — Start the server
|
|
111
|
+
|
|
112
|
+
```bash
|
|
113
|
+
hypermotion start
|
|
114
|
+
```
|
|
115
|
+
|
|
116
|
+
Open **[http://localhost:8500](http://localhost:8500)** — Mission Control loads instantly.
|
|
117
|
+
|
|
118
|
+
---
|
|
119
|
+
|
|
120
|
+
## 🧩 CLI Reference
|
|
121
|
+
|
|
122
|
+
| Command | Description |
|
|
123
|
+
|---|---|
|
|
124
|
+
| `hypermotion init` | Scaffold a clean workspace (fresh `.env`, empty dirs) |
|
|
125
|
+
| `hypermotion init ./path --force` | Re-scaffold, overwriting existing files |
|
|
126
|
+
| `hypermotion start` | Start the FastAPI server |
|
|
127
|
+
| `hypermotion start --dir ./path` | Start from a specific project directory |
|
|
128
|
+
| `hypermotion version` | Print version |
|
|
129
|
+
|
|
130
|
+
---
|
|
131
|
+
|
|
132
|
+
## 🛡️ Fresh Install Guarantee
|
|
133
|
+
|
|
134
|
+
Every `hypermotion init` creates:
|
|
135
|
+
|
|
136
|
+
```
|
|
137
|
+
your-project/
|
|
138
|
+
├── .env ← YOUR keys only (generated from template)
|
|
139
|
+
├── .gitignore ← Secrets & output excluded automatically
|
|
140
|
+
├── data/ ← Empty — YOUR runtime DB only
|
|
141
|
+
├── output/ ← Empty — YOUR generated media only
|
|
142
|
+
│ ├── facebook_media/
|
|
143
|
+
│ └── quizzes/
|
|
144
|
+
├── .cache/ ← Empty — YOUR cache only
|
|
145
|
+
└── config/ ← Empty — YOUR YAML config only
|
|
146
|
+
```
|
|
147
|
+
|
|
148
|
+
**No API keys, images, databases, or any data from other users is ever included.**
|
|
149
|
+
|
|
150
|
+
---
|
|
151
|
+
|
|
152
|
+
## 🔋 What's Inside
|
|
153
|
+
|
|
154
|
+
| Capability | Details |
|
|
155
|
+
|---|---|
|
|
156
|
+
| **Trend Radar** | Google Trends · Google News RSS · Reddit Hot · YouTube Trending |
|
|
157
|
+
| **Fact-Checking Lab** | Claim extraction · Web consensus scoring · Evidence citations |
|
|
158
|
+
| **Script Forge** | Second-by-second scripts · B-roll cues · CTAs |
|
|
159
|
+
| **SEO Matrix** | 4 A/B title variants · 200+ word descriptions · Tags & hashtags |
|
|
160
|
+
| **Facebook Engine** | Feed posts · Stories · Reels · AI visuals · Live publishing |
|
|
161
|
+
| **LLM Gateway** | Gemini → OmniRoute → OpenAI → OpenRouter (auto-fallback) |
|
|
162
|
+
| **Autonomous Scheduler** | Runs every N minutes, hands-free 24/7 |
|
|
163
|
+
| **Mission Control UI** | Dark glassmorphic dashboard at `localhost:8500` |
|
|
164
|
+
|
|
165
|
+
---
|
|
166
|
+
|
|
167
|
+
## 🔌 Optional: OmniRoute (Local AI Proxy)
|
|
168
|
+
|
|
169
|
+
Pool multiple API keys and route them intelligently:
|
|
170
|
+
|
|
171
|
+
```bash
|
|
172
|
+
npm install -g omniroute
|
|
173
|
+
omniroute
|
|
174
|
+
```
|
|
175
|
+
|
|
176
|
+
Then in `.env`:
|
|
177
|
+
|
|
178
|
+
```env
|
|
179
|
+
OMNIROUTE_BASE_URL=http://localhost:20128/v1
|
|
180
|
+
OMNIROUTE_API_KEY=your-omniroute-key
|
|
181
|
+
OMNIROUTE_MODEL=auto
|
|
182
|
+
```
|
|
183
|
+
|
|
184
|
+
---
|
|
185
|
+
|
|
186
|
+
## 🛠️ Manual / Development Setup
|
|
187
|
+
|
|
188
|
+
```bash
|
|
189
|
+
git clone https://github.com/sayeeddesignerz-creator/Hyper-Motion.git
|
|
190
|
+
cd Hyper-Motion
|
|
191
|
+
python -m venv .venv
|
|
192
|
+
.venv\Scripts\activate # Windows
|
|
193
|
+
# source .venv/bin/activate # macOS/Linux
|
|
194
|
+
pip install -e ".[dev]"
|
|
195
|
+
hypermotion init
|
|
196
|
+
hypermotion start
|
|
197
|
+
```
|
|
198
|
+
|
|
199
|
+
Run tests:
|
|
200
|
+
|
|
201
|
+
```bash
|
|
202
|
+
pytest tests/ -v
|
|
203
|
+
```
|
|
204
|
+
|
|
205
|
+
---
|
|
206
|
+
|
|
207
|
+
## ⚠️ Security
|
|
208
|
+
|
|
209
|
+
- **Never commit `.env`** — it is excluded by `.gitignore`
|
|
210
|
+
- All output (`data/`, `output/`) is local to your machine
|
|
211
|
+
- Facebook tokens are stored only in your `.env` — not logged or transmitted anywhere except the Meta Graph API
|
|
212
|
+
- Rotate any API key that was accidentally exposed
|
|
213
|
+
|
|
214
|
+
---
|
|
215
|
+
|
|
216
|
+
## 📄 License
|
|
217
|
+
|
|
218
|
+
MIT © [sayeeddesignerz-creator](https://github.com/sayeeddesignerz-creator)
|
|
@@ -0,0 +1,175 @@
|
|
|
1
|
+
<div align="center">
|
|
2
|
+
|
|
3
|
+
# ⚡ Hyper Motion
|
|
4
|
+
|
|
5
|
+
**Multi-Agent Autonomous Content Research · Scriptwriting · SEO · Facebook Growth Engine**
|
|
6
|
+
|
|
7
|
+
[](https://python.org)
|
|
8
|
+
[](https://fastapi.tiangolo.com)
|
|
9
|
+
[](LICENSE)
|
|
10
|
+
[](https://github.com/sayeeddesignerz-creator/Hyper-Motion)
|
|
11
|
+
|
|
12
|
+
</div>
|
|
13
|
+
|
|
14
|
+
---
|
|
15
|
+
|
|
16
|
+
## 🚀 Install in One Command
|
|
17
|
+
|
|
18
|
+
```bash
|
|
19
|
+
pip install hypermotion
|
|
20
|
+
```
|
|
21
|
+
|
|
22
|
+
> Requires **Python 3.10+**. A virtual environment is strongly recommended.
|
|
23
|
+
|
|
24
|
+
---
|
|
25
|
+
|
|
26
|
+
## ⚙️ Quick Start
|
|
27
|
+
|
|
28
|
+
### 1 — Install
|
|
29
|
+
|
|
30
|
+
```bash
|
|
31
|
+
pip install hypermotion
|
|
32
|
+
```
|
|
33
|
+
|
|
34
|
+
### 2 — Initialize a fresh workspace
|
|
35
|
+
|
|
36
|
+
```bash
|
|
37
|
+
# Creates .env template + empty data/output dirs — nothing from anyone else
|
|
38
|
+
hypermotion init
|
|
39
|
+
```
|
|
40
|
+
|
|
41
|
+
Or into a specific folder:
|
|
42
|
+
|
|
43
|
+
```bash
|
|
44
|
+
hypermotion init ./my-hypermotion
|
|
45
|
+
cd my-hypermotion
|
|
46
|
+
```
|
|
47
|
+
|
|
48
|
+
### 3 — Add your API keys
|
|
49
|
+
|
|
50
|
+
Edit the generated `.env` file:
|
|
51
|
+
|
|
52
|
+
```env
|
|
53
|
+
# Minimum required — pick at least one LLM provider
|
|
54
|
+
GEMINI_API_KEY=your-gemini-key-here
|
|
55
|
+
|
|
56
|
+
# Optional extras (adds fallback & image generation)
|
|
57
|
+
OPENAI_API_KEY=
|
|
58
|
+
OPENROUTER_API_KEY=
|
|
59
|
+
|
|
60
|
+
# Facebook Growth Engine (sandbox mode works without these)
|
|
61
|
+
FACEBOOK_PAGE_ID=
|
|
62
|
+
FACEBOOK_PAGE_ACCESS_TOKEN=
|
|
63
|
+
```
|
|
64
|
+
|
|
65
|
+
> 🔒 `.env` is listed in `.gitignore` — it is **never** committed or shared.
|
|
66
|
+
|
|
67
|
+
### 4 — Start the server
|
|
68
|
+
|
|
69
|
+
```bash
|
|
70
|
+
hypermotion start
|
|
71
|
+
```
|
|
72
|
+
|
|
73
|
+
Open **[http://localhost:8500](http://localhost:8500)** — Mission Control loads instantly.
|
|
74
|
+
|
|
75
|
+
---
|
|
76
|
+
|
|
77
|
+
## 🧩 CLI Reference
|
|
78
|
+
|
|
79
|
+
| Command | Description |
|
|
80
|
+
|---|---|
|
|
81
|
+
| `hypermotion init` | Scaffold a clean workspace (fresh `.env`, empty dirs) |
|
|
82
|
+
| `hypermotion init ./path --force` | Re-scaffold, overwriting existing files |
|
|
83
|
+
| `hypermotion start` | Start the FastAPI server |
|
|
84
|
+
| `hypermotion start --dir ./path` | Start from a specific project directory |
|
|
85
|
+
| `hypermotion version` | Print version |
|
|
86
|
+
|
|
87
|
+
---
|
|
88
|
+
|
|
89
|
+
## 🛡️ Fresh Install Guarantee
|
|
90
|
+
|
|
91
|
+
Every `hypermotion init` creates:
|
|
92
|
+
|
|
93
|
+
```
|
|
94
|
+
your-project/
|
|
95
|
+
├── .env ← YOUR keys only (generated from template)
|
|
96
|
+
├── .gitignore ← Secrets & output excluded automatically
|
|
97
|
+
├── data/ ← Empty — YOUR runtime DB only
|
|
98
|
+
├── output/ ← Empty — YOUR generated media only
|
|
99
|
+
│ ├── facebook_media/
|
|
100
|
+
│ └── quizzes/
|
|
101
|
+
├── .cache/ ← Empty — YOUR cache only
|
|
102
|
+
└── config/ ← Empty — YOUR YAML config only
|
|
103
|
+
```
|
|
104
|
+
|
|
105
|
+
**No API keys, images, databases, or any data from other users is ever included.**
|
|
106
|
+
|
|
107
|
+
---
|
|
108
|
+
|
|
109
|
+
## 🔋 What's Inside
|
|
110
|
+
|
|
111
|
+
| Capability | Details |
|
|
112
|
+
|---|---|
|
|
113
|
+
| **Trend Radar** | Google Trends · Google News RSS · Reddit Hot · YouTube Trending |
|
|
114
|
+
| **Fact-Checking Lab** | Claim extraction · Web consensus scoring · Evidence citations |
|
|
115
|
+
| **Script Forge** | Second-by-second scripts · B-roll cues · CTAs |
|
|
116
|
+
| **SEO Matrix** | 4 A/B title variants · 200+ word descriptions · Tags & hashtags |
|
|
117
|
+
| **Facebook Engine** | Feed posts · Stories · Reels · AI visuals · Live publishing |
|
|
118
|
+
| **LLM Gateway** | Gemini → OmniRoute → OpenAI → OpenRouter (auto-fallback) |
|
|
119
|
+
| **Autonomous Scheduler** | Runs every N minutes, hands-free 24/7 |
|
|
120
|
+
| **Mission Control UI** | Dark glassmorphic dashboard at `localhost:8500` |
|
|
121
|
+
|
|
122
|
+
---
|
|
123
|
+
|
|
124
|
+
## 🔌 Optional: OmniRoute (Local AI Proxy)
|
|
125
|
+
|
|
126
|
+
Pool multiple API keys and route them intelligently:
|
|
127
|
+
|
|
128
|
+
```bash
|
|
129
|
+
npm install -g omniroute
|
|
130
|
+
omniroute
|
|
131
|
+
```
|
|
132
|
+
|
|
133
|
+
Then in `.env`:
|
|
134
|
+
|
|
135
|
+
```env
|
|
136
|
+
OMNIROUTE_BASE_URL=http://localhost:20128/v1
|
|
137
|
+
OMNIROUTE_API_KEY=your-omniroute-key
|
|
138
|
+
OMNIROUTE_MODEL=auto
|
|
139
|
+
```
|
|
140
|
+
|
|
141
|
+
---
|
|
142
|
+
|
|
143
|
+
## 🛠️ Manual / Development Setup
|
|
144
|
+
|
|
145
|
+
```bash
|
|
146
|
+
git clone https://github.com/sayeeddesignerz-creator/Hyper-Motion.git
|
|
147
|
+
cd Hyper-Motion
|
|
148
|
+
python -m venv .venv
|
|
149
|
+
.venv\Scripts\activate # Windows
|
|
150
|
+
# source .venv/bin/activate # macOS/Linux
|
|
151
|
+
pip install -e ".[dev]"
|
|
152
|
+
hypermotion init
|
|
153
|
+
hypermotion start
|
|
154
|
+
```
|
|
155
|
+
|
|
156
|
+
Run tests:
|
|
157
|
+
|
|
158
|
+
```bash
|
|
159
|
+
pytest tests/ -v
|
|
160
|
+
```
|
|
161
|
+
|
|
162
|
+
---
|
|
163
|
+
|
|
164
|
+
## ⚠️ Security
|
|
165
|
+
|
|
166
|
+
- **Never commit `.env`** — it is excluded by `.gitignore`
|
|
167
|
+
- All output (`data/`, `output/`) is local to your machine
|
|
168
|
+
- Facebook tokens are stored only in your `.env` — not logged or transmitted anywhere except the Meta Graph API
|
|
169
|
+
- Rotate any API key that was accidentally exposed
|
|
170
|
+
|
|
171
|
+
---
|
|
172
|
+
|
|
173
|
+
## 📄 License
|
|
174
|
+
|
|
175
|
+
MIT © [sayeeddesignerz-creator](https://github.com/sayeeddesignerz-creator)
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
"""
|
|
2
|
+
Agents package exports.
|
|
3
|
+
"""
|
|
4
|
+
from app.agents.base import BaseAgent
|
|
5
|
+
from app.agents.trend_hunter import TrendHunterAgent
|
|
6
|
+
from app.agents.fact_checker import FactCheckerAgent
|
|
7
|
+
from app.agents.strategist import StrategistAgent
|
|
8
|
+
from app.agents.script_forge import ScriptForgeAgent
|
|
9
|
+
from app.agents.seo_optimizer import SEOOptimizerAgent
|
|
10
|
+
from app.agents.audience_miner import AudienceMinerAgent
|
|
11
|
+
from app.agents.learner import LearnerAgent
|
|
12
|
+
from app.agents.facebook_growth_agent import FacebookGrowthAgent
|
|
13
|
+
from app.agents.facebook_content_agent import FacebookContentAgent
|
|
14
|
+
|
|
15
|
+
__all__ = [
|
|
16
|
+
"BaseAgent",
|
|
17
|
+
"TrendHunterAgent",
|
|
18
|
+
"FactCheckerAgent",
|
|
19
|
+
"StrategistAgent",
|
|
20
|
+
"ScriptForgeAgent",
|
|
21
|
+
"SEOOptimizerAgent",
|
|
22
|
+
"AudienceMinerAgent",
|
|
23
|
+
"LearnerAgent",
|
|
24
|
+
"FacebookGrowthAgent",
|
|
25
|
+
"FacebookContentAgent"
|
|
26
|
+
]
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
"""
|
|
2
|
+
Audience Miner Agent — mines viewer comments, extracts content ideas, and drafts high-engagement responses.
|
|
3
|
+
"""
|
|
4
|
+
from __future__ import annotations
|
|
5
|
+
|
|
6
|
+
import uuid
|
|
7
|
+
from typing import List, Dict, Any
|
|
8
|
+
|
|
9
|
+
from app.agents.base import BaseAgent
|
|
10
|
+
from app.models import AudienceInsight
|
|
11
|
+
|
|
12
|
+
AUDIENCE_PROMPT = """You are an Audience Intelligence & Community Management Specialist.
|
|
13
|
+
Topic / Video: {topic}
|
|
14
|
+
Comments Sample:
|
|
15
|
+
{comments_sample}
|
|
16
|
+
|
|
17
|
+
Analyze the audience reaction:
|
|
18
|
+
1. Overall sentiment ("positive", "skeptical", "inquisitive", "mixed")
|
|
19
|
+
2. Extract top 3 new video/content ideas suggested by viewers
|
|
20
|
+
3. Extract top 3 recurring viewer questions or confusions
|
|
21
|
+
4. Draft 2 thoughtful, engaging creator replies that spark further conversation.
|
|
22
|
+
|
|
23
|
+
Return JSON:
|
|
24
|
+
{{
|
|
25
|
+
"sentiment": "mixed",
|
|
26
|
+
"extracted_ideas": ["Topic idea 1", "Topic idea 2", "Topic idea 3"],
|
|
27
|
+
"viewer_questions": ["Question 1?", "Question 2?", "Question 3?"],
|
|
28
|
+
"draft_replies": [
|
|
29
|
+
{{"comment": "Is this actually viable?", "reply": "Great question! While the early tests are promising..."}},
|
|
30
|
+
{{"comment": "Wait, did they test this on humans?", "reply": "Currently still in peer-reviewed trials, but..."}}
|
|
31
|
+
]
|
|
32
|
+
}}
|
|
33
|
+
"""
|
|
34
|
+
|
|
35
|
+
class AudienceMinerAgent(BaseAgent):
|
|
36
|
+
def __init__(self, gateway=None):
|
|
37
|
+
super().__init__("AudienceMiner", gateway)
|
|
38
|
+
|
|
39
|
+
async def analyze_community(self, topic: str, comments: List[str]) -> AudienceInsight:
|
|
40
|
+
self.logger.info(f"Mining audience insights for: '{topic}'")
|
|
41
|
+
sample_text = "\n".join([f"- {c}" for c in comments[:10]]) if comments else "- What happens next with this tech?\n- Is this actually real or just marketing hype?"
|
|
42
|
+
|
|
43
|
+
prompt = AUDIENCE_PROMPT.format(topic=topic, comments_sample=sample_text)
|
|
44
|
+
try:
|
|
45
|
+
res = await self.gateway.generate_json(prompt, system_instruction="You are an audience engagement expert.")
|
|
46
|
+
return AudienceInsight(
|
|
47
|
+
id=str(uuid.uuid4())[:8],
|
|
48
|
+
topic_or_video=topic,
|
|
49
|
+
sentiment=res.get("sentiment", "inquisitive"),
|
|
50
|
+
extracted_ideas=res.get("extracted_ideas", [f"Future implications of {topic}"]),
|
|
51
|
+
viewer_questions=res.get("viewer_questions", ["How soon will this be available?"]),
|
|
52
|
+
draft_replies=res.get("draft_replies", [])
|
|
53
|
+
)
|
|
54
|
+
except Exception as e:
|
|
55
|
+
self.logger.warning(f"Audience mining failed: {e}")
|
|
56
|
+
return AudienceInsight(
|
|
57
|
+
id=str(uuid.uuid4())[:8],
|
|
58
|
+
topic_or_video=topic,
|
|
59
|
+
sentiment="inquisitive",
|
|
60
|
+
extracted_ideas=[f"Part 2: Deep dive into {topic}"],
|
|
61
|
+
viewer_questions=["What is the real timeline?"],
|
|
62
|
+
draft_replies=[]
|
|
63
|
+
)
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
"""
|
|
2
|
+
Base Agent class for Ultimate Content Agent.
|
|
3
|
+
"""
|
|
4
|
+
from __future__ import annotations
|
|
5
|
+
|
|
6
|
+
import logging
|
|
7
|
+
from typing import Optional
|
|
8
|
+
from app.llm.gateway import LLMGateway
|
|
9
|
+
from app.config import get_settings
|
|
10
|
+
|
|
11
|
+
class BaseAgent:
|
|
12
|
+
def __init__(self, name: str, gateway: Optional[LLMGateway] = None):
|
|
13
|
+
self.name = name
|
|
14
|
+
self.logger = logging.getLogger(f"Agent.{name}")
|
|
15
|
+
self.gateway = gateway or LLMGateway()
|
|
16
|
+
self.settings = get_settings()
|
|
@@ -0,0 +1,107 @@
|
|
|
1
|
+
"""
|
|
2
|
+
Engagement Agent — auto-replies to Facebook post comments and Messenger inbox messages.
|
|
3
|
+
Uses the LLM Gateway to generate contextual, on-brand replies.
|
|
4
|
+
"""
|
|
5
|
+
from __future__ import annotations
|
|
6
|
+
|
|
7
|
+
import logging
|
|
8
|
+
from typing import Any, Dict, List, Optional
|
|
9
|
+
|
|
10
|
+
from app.agents.base import BaseAgent
|
|
11
|
+
from app.llm.gateway import LLMGateway
|
|
12
|
+
from app.config import get_settings
|
|
13
|
+
|
|
14
|
+
logger = logging.getLogger("Agent.Engagement")
|
|
15
|
+
|
|
16
|
+
REPLY_SYSTEM_PROMPT = """You are the social media manager for a Facebook Page.
|
|
17
|
+
Your job is to craft short, warm, and engaging replies to comments and Messenger messages.
|
|
18
|
+
|
|
19
|
+
Rules:
|
|
20
|
+
- Keep replies under 3 sentences.
|
|
21
|
+
- Sound human, conversational, and positive — never robotic.
|
|
22
|
+
- If a comment is a question, answer it helpfully.
|
|
23
|
+
- If it's praise, thank them genuinely and encourage engagement (follow, share, etc).
|
|
24
|
+
- If it's criticism, respond calmly and professionally.
|
|
25
|
+
- Match the language of the commenter (if they write in another language, reply in that language).
|
|
26
|
+
- Never mention that you are an AI.
|
|
27
|
+
- End with a soft CTA when relevant (e.g. "Stay tuned for more!" or "Drop your thoughts below 👇").
|
|
28
|
+
|
|
29
|
+
Page context:
|
|
30
|
+
- Page Name: {page_name}
|
|
31
|
+
- Page Niche: {niche}
|
|
32
|
+
- Tone: {tone}
|
|
33
|
+
"""
|
|
34
|
+
|
|
35
|
+
|
|
36
|
+
class EngagementAgent(BaseAgent):
|
|
37
|
+
def __init__(self, gateway: Optional[LLMGateway] = None):
|
|
38
|
+
super().__init__("Engagement", gateway)
|
|
39
|
+
self.settings = get_settings()
|
|
40
|
+
|
|
41
|
+
async def generate_comment_reply(
|
|
42
|
+
self,
|
|
43
|
+
comment_text: str,
|
|
44
|
+
post_context: str = "",
|
|
45
|
+
commenter_name: str = "there",
|
|
46
|
+
) -> str:
|
|
47
|
+
"""Generate an AI reply to a Facebook comment."""
|
|
48
|
+
channel = self.settings.channel
|
|
49
|
+
system = REPLY_SYSTEM_PROMPT.format(
|
|
50
|
+
page_name=channel.name,
|
|
51
|
+
niche=channel.niche,
|
|
52
|
+
tone=channel.tone.style,
|
|
53
|
+
)
|
|
54
|
+
user_prompt = (
|
|
55
|
+
f"Post context: {post_context[:200] if post_context else 'General page post'}\n"
|
|
56
|
+
f"Commenter ({commenter_name}) wrote: \"{comment_text}\"\n\n"
|
|
57
|
+
"Write a concise, friendly reply to this comment."
|
|
58
|
+
)
|
|
59
|
+
try:
|
|
60
|
+
reply = await self.gateway.generate_text(
|
|
61
|
+
prompt=user_prompt,
|
|
62
|
+
system_instruction=system,
|
|
63
|
+
temperature=0.7,
|
|
64
|
+
max_tokens=300,
|
|
65
|
+
agent_name="engagement",
|
|
66
|
+
)
|
|
67
|
+
logger.info(f"Generated comment reply for: {comment_text[:60]!r}")
|
|
68
|
+
raw_reply = reply.strip().strip('"')
|
|
69
|
+
# If the reply does not start with the commenter's name, prefix it so Facebook triggers a push notification
|
|
70
|
+
if commenter_name and commenter_name.lower() not in ("there", "someone", "unknown", ""):
|
|
71
|
+
if not raw_reply.lower().startswith(f"@{commenter_name.lower()}") and not raw_reply.lower().startswith(commenter_name.lower()):
|
|
72
|
+
return f"@{commenter_name} {raw_reply}"
|
|
73
|
+
return raw_reply
|
|
74
|
+
except Exception as e:
|
|
75
|
+
logger.error(f"Failed to generate comment reply: {e}")
|
|
76
|
+
prefix = f"@{commenter_name} " if commenter_name and commenter_name.lower() not in ("there", "someone") else ""
|
|
77
|
+
return f"{prefix}Thanks for your comment! Keep practicing and stay tuned for more! 🚀"
|
|
78
|
+
|
|
79
|
+
async def generate_messenger_reply(
|
|
80
|
+
self,
|
|
81
|
+
message_text: str,
|
|
82
|
+
sender_name: str = "there",
|
|
83
|
+
) -> str:
|
|
84
|
+
"""Generate an AI reply to a Messenger inbox message."""
|
|
85
|
+
channel = self.settings.channel
|
|
86
|
+
system = REPLY_SYSTEM_PROMPT.format(
|
|
87
|
+
page_name=channel.name,
|
|
88
|
+
niche=channel.niche,
|
|
89
|
+
tone=channel.tone.style,
|
|
90
|
+
)
|
|
91
|
+
user_prompt = (
|
|
92
|
+
f"Messenger message from {sender_name}: \"{message_text}\"\n\n"
|
|
93
|
+
"Write a helpful, friendly reply to this message."
|
|
94
|
+
)
|
|
95
|
+
try:
|
|
96
|
+
reply = await self.gateway.generate_text(
|
|
97
|
+
prompt=user_prompt,
|
|
98
|
+
system_instruction=system,
|
|
99
|
+
temperature=0.7,
|
|
100
|
+
max_tokens=300,
|
|
101
|
+
agent_name="engagement",
|
|
102
|
+
)
|
|
103
|
+
logger.info(f"Generated Messenger reply for: {message_text[:60]!r}")
|
|
104
|
+
return reply.strip().strip('"')
|
|
105
|
+
except Exception as e:
|
|
106
|
+
logger.error(f"Failed to generate Messenger reply: {e}")
|
|
107
|
+
return f"Hi {sender_name}! Thanks for reaching out. We will get back to you shortly!"
|