Skip to content

Commit 30a75e4

Browse files
committed
modularized workers
1 parent 14ed59a commit 30a75e4

File tree

16 files changed

+492
-253
lines changed

16 files changed

+492
-253
lines changed

src/server/workers/config.py

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
import os
2+
from dotenv import load_dotenv
3+
4+
dotenv_path = os.path.join(os.path.dirname(__file__), '..', '.env')
5+
if os.path.exists(dotenv_path):
6+
load_dotenv(dotenv_path=dotenv_path)
7+
else:
8+
load_dotenv()
9+
10+
SUPERMEMORY_MCP_BASE_URL = os.getenv("SUPERMEMORY_MCP_BASE_URL", "https://mcp.supermemory.ai/")
11+
SUPERMEMORY_MCP_ENDPOINT_SUFFIX = os.getenv("SUPERMEMORY_MCP_ENDPOINT_SUFFIX", "/sse")
12+
SUPPORTED_POLLING_SERVICES = ["gmail", "gcalendar"]
Lines changed: 216 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,216 @@
1+
# src/server/workers/executor/config.py
2+
import os
3+
from dotenv import load_dotenv
4+
5+
dotenv_path = os.path.join(os.path.dirname(__file__), '..', '..', '.env')
6+
if os.path.exists(dotenv_path):
7+
load_dotenv(dotenv_path=dotenv_path)
8+
else:
9+
load_dotenv()
10+
11+
MONGO_URI = os.getenv("MONGO_URI", "mongodb://localhost:27017/")
12+
MONGO_DB_NAME = os.getenv("MONGO_DB_NAME", "sentient_dev_db")
13+
14+
LLM_PROVIDER = os.getenv("LLM_PROVIDER", "OLLAMA")
15+
OLLAMA_BASE_URL = os.getenv("OLLAMA_BASE_URL", "http://localhost:11434")
16+
OLLAMA_MODEL_NAME = os.getenv("OLLAMA_MODEL_NAME", "qwen3:4b")
17+
NOVITA_API_KEY = os.getenv("NOVITA_API_KEY")
18+
NOVITA_MODEL_NAME = os.getenv("NOVITA_MODEL_NAME", "qwen/qwen3-4b-fp8")
19+
20+
SUPERMEMORY_MCP_BASE_URL = os.getenv("SUPERMEMORY_MCP_BASE_URL", "https://mcp.supermemory.ai/")
21+
SUPERMEMORY_MCP_ENDPOINT_SUFFIX = os.getenv("SUPERMEMORY_MCP_ENDPOINT_SUFFIX", "/sse")
22+
23+
# The executor needs to know about all possible tools.
24+
# This is a replication of the logic from main/config.py
25+
INTEGRATIONS_CONFIG = {
26+
"github": {
27+
"display_name": "GitHub",
28+
"description": "Connect to manage repositories, issues, and more. Enables the agent to search public and private repos, list your repos, view repository details, list issues, create new issues, and read file contents.",
29+
"auth_type": "oauth",
30+
"icon": "IconBrandGithub",
31+
"mcp_server_config": {
32+
"name": "github_server",
33+
"url": os.getenv("GITHUB_MCP_SERVER_URL", "http://localhost:9010/sse")
34+
}
35+
},
36+
"gdrive": { # User-configurable OAuth
37+
"display_name": "Google Drive",
38+
"description": "Access and manage files in your Google Drive. Allows the agent to search for files by name or content and read the contents of various file types like documents and spreadsheets.",
39+
"auth_type": "oauth",
40+
"icon": "IconBrandGoogleDrive",
41+
"mcp_server_config": {
42+
"name": "gdrive_server",
43+
"url": os.getenv("GDRIVE_MCP_SERVER_URL", "http://localhost:9003/sse")
44+
}
45+
},
46+
"gcalendar": { # User-configurable OAuth
47+
"display_name": "Google Calendar",
48+
"description": "Read and manage events on your Google Calendar. Enables the agent to list upcoming events, add new events, search for specific events, update event details, and delete events.",
49+
"auth_type": "oauth",
50+
"icon": "IconCalendarEvent",
51+
"mcp_server_config": {
52+
"name": "gcal_server",
53+
"url": os.getenv("GCAL_MCP_SERVER_URL", "http://localhost:9002/sse")
54+
}
55+
},
56+
"gmail": { # User-configurable OAuth
57+
"display_name": "Gmail",
58+
"description": "Read, send, and manage emails. The agent can search your inbox, send new emails, create drafts, reply to threads, forward messages, and manage emails by deleting them or marking them as read/unread.",
59+
"auth_type": "oauth",
60+
"icon": "IconMail",
61+
"mcp_server_config": {
62+
"name": "gmail_server",
63+
"url": os.getenv("GMAIL_MCP_SERVER_URL", "http://localhost:9001/sse")
64+
}
65+
},
66+
"gdocs": {
67+
"display_name": "Google Docs",
68+
"description": "Create and manage documents in Google Docs. Allows the agent to generate new, multi-section documents with titles, headings, paragraphs, and bullet points.",
69+
"auth_type": "oauth",
70+
"icon": "IconFileText",
71+
"mcp_server_config": {
72+
"name": "gdocs_server",
73+
"url": os.getenv("GDOCS_MCP_SERVER_URL", "http://localhost:9004/sse")
74+
}
75+
},
76+
"gslides": {
77+
"display_name": "Google Slides",
78+
"description": "Create and manage presentations in Google Slides. The agent can build new slide decks with titles, content, images, and charts based on a structured outline you provide.",
79+
"auth_type": "oauth",
80+
"icon": "IconPresentation",
81+
"mcp_server_config": {
82+
"name": "gslides_server",
83+
"url": os.getenv("GSLIDES_MCP_SERVER_URL", "http://localhost:9014/sse")
84+
}
85+
},
86+
"gsheets": {
87+
"display_name": "Google Sheets",
88+
"description": "Create and manage spreadsheets in Google Sheets. The agent can help organize data by creating new spreadsheets with one or more sheets, including headers and rows.",
89+
"auth_type": "oauth",
90+
"icon": "IconTable",
91+
"mcp_server_config": {
92+
"name": "gsheets_server",
93+
"url": os.getenv("GSHEETS_MCP_SERVER_URL", "http://localhost:9015/sse")
94+
}
95+
},
96+
"gmaps": {
97+
"display_name": "Google Maps",
98+
"description": "Search for places and get directions. The agent can look up addresses, points of interest, and find routes for driving, walking, bicycling, or transit.",
99+
"auth_type": "builtin",
100+
"icon": "IconMapPin",
101+
"mcp_server_config": {
102+
"name": "gmaps_server",
103+
"url": os.getenv("GMAPS_MCP_SERVER_URL", "http://localhost:9016/sse")
104+
}
105+
},
106+
"gshopping": {
107+
"display_name": "Google Shopping",
108+
"description": "Search for products online. The agent can find items to purchase by searching Google Shopping and returning a list of products with titles, links, and prices.",
109+
"auth_type": "builtin",
110+
"icon": "IconShoppingCart",
111+
"mcp_server_config": {
112+
"name": "gshopping_server",
113+
"url": os.getenv("GSHOPPING_MCP_SERVER_URL", "http://localhost:9017/sse")
114+
}
115+
},
116+
"slack": { # User-configurable Manual
117+
"display_name": "Slack",
118+
"description": "Connect to your Slack workspace. Allows the agent to list channels, post messages, reply in threads, add reactions, read channel history, and get user information.",
119+
"auth_type": "manual",
120+
"icon": "IconBrandSlack",
121+
"mcp_server_config": {
122+
"name": "slack_server",
123+
"url": os.getenv("SLACK_MCP_SERVER_URL", "http://localhost:9006/sse")
124+
}
125+
},
126+
"notion": {
127+
"display_name": "Notion",
128+
"description": "Connect to your Notion workspace. The agent can search for pages and databases, read page content, create new pages, append content to existing pages, and query databases with filters.",
129+
"auth_type": "manual",
130+
"icon": "IconBrandNotion",
131+
"mcp_server_config": {
132+
"name": "notion_server",
133+
"url": os.getenv("NOTION_MCP_SERVER_URL", "http://localhost:9009/sse")
134+
}
135+
},
136+
"news": { # Built-in
137+
"display_name": "News",
138+
"description": "Fetches top headlines and news articles from around the world. The agent can get top headlines by country or category, or search for articles on any topic.",
139+
"auth_type": "builtin",
140+
"icon": "IconNews",
141+
"mcp_server_config": {
142+
"name": "news_server",
143+
"url": os.getenv("NEWS_MCP_SERVER_URL", "http://localhost:9012/sse")
144+
}
145+
},
146+
"internet_search": { # Built-in
147+
"display_name": "Internet Search",
148+
"description": "Allows the agent to search the web using Google Search to find real-time, factual information on any topic.",
149+
"auth_type": "builtin",
150+
"icon": "IconWorldSearch",
151+
"mcp_server_config": {
152+
"name": "google_search",
153+
"url": os.getenv("GOOGLE_SEARCH_MCP_SERVER_URL", "http://localhost:9005/sse")
154+
}
155+
},
156+
"accuweather": { # Built-in
157+
"display_name": "AccuWeather",
158+
"description": "Provides current weather conditions and daily forecasts. The agent can get the current weather for any location or a forecast for the next 1-5 days.",
159+
"auth_type": "builtin",
160+
"icon": "IconCloud",
161+
"mcp_server_config": {
162+
"name": "weather_server",
163+
"url": os.getenv("ACCUWEATHER_MCP_SERVER_URL", "http://localhost:9007/sse")
164+
}
165+
},
166+
"quickchart": { # Built-in
167+
"display_name": "QuickChart",
168+
"description": "Generates charts and data visualizations on the fly. The agent can create bar charts, line charts, pie charts, and more, then provide a URL or download the image.",
169+
"auth_type": "builtin",
170+
"icon": "IconChartPie",
171+
"mcp_server_config": {
172+
"name": "quickchart_server",
173+
"url": os.getenv("QUICKCHART_MCP_SERVER_URL", "http://localhost:9008/sse")
174+
}
175+
},
176+
"progress_updater": { # Built-in tool for executor
177+
"display_name": "Progress Updater",
178+
"description": "Internal tool for the system to provide real-time progress updates on long-running tasks.",
179+
"auth_type": "builtin",
180+
"icon": "IconActivity",
181+
"mcp_server_config": {
182+
"name": "progress_updater_server",
183+
"url": os.getenv("PROGRESS_UPDATER_MCP_SERVER_URL", "http://localhost:9011/sse")
184+
}
185+
},
186+
"chat_tools": { # Built-in, for chat agent
187+
"display_name": "Chat Agent Tools",
188+
"description": "Internal tools for the main conversational agent, such as handing off complex tasks to the planning system and checking task status.",
189+
"auth_type": "builtin",
190+
"icon": "IconMessage",
191+
"mcp_server_config": {
192+
"name": "chat_tools_server",
193+
"url": os.getenv("CHAT_TOOLS_MCP_SERVER_URL", "http://localhost:9013/sse")
194+
}
195+
},
196+
"journal": { # Built-in, for chat agent
197+
"display_name": "Journal Tools",
198+
"description": "Tools for managing the user's Journal. The agent can add new entries, search existing entries by keyword, and get a summary for a specific day.",
199+
"auth_type": "builtin",
200+
"icon": "IconMessage",
201+
"mcp_server_config": {
202+
"name": "journal_server",
203+
"url": os.getenv("JOURNAL_MCP_SERVER_URL", "http://localhost:9018/sse")
204+
}
205+
},
206+
"supermemory": {
207+
"display_name": "Long-Term Memory",
208+
"description": "The agent's long-term memory about the user. Use 'search' to recall facts, relationships, and preferences. Use 'addToSupermemory' to save new, permanent information about the user. This is critical for personalization.",
209+
"auth_type": "builtin",
210+
"icon": "IconBrain",
211+
"mcp_server_config": {
212+
"name": "supermemory",
213+
"url": None
214+
}
215+
}
216+
}

src/server/workers/executor/tasks.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,8 @@
1111
from workers.celery_app import celery_app
1212
from workers.utils.api_client import notify_user
1313

14-
# Load environment variables for the worker
15-
from main.config import (
14+
# Load environment variables for the worker from its own config
15+
from workers.executor.config import (
1616
MONGO_URI, MONGO_DB_NAME, INTEGRATIONS_CONFIG, LLM_PROVIDER,
1717
OLLAMA_BASE_URL, OLLAMA_MODEL_NAME, SUPERMEMORY_MCP_BASE_URL,
1818
SUPERMEMORY_MCP_ENDPOINT_SUFFIX
@@ -29,7 +29,7 @@
2929
'api_key': 'ollama', # Ollama doesn't require a key
3030
}
3131
elif LLM_PROVIDER == "NOVITA":
32-
from main.config import NOVITA_API_KEY, NOVITA_MODEL_NAME
32+
from workers.executor.config import NOVITA_API_KEY, NOVITA_MODEL_NAME
3333
llm_cfg = {
3434
"model": NOVITA_MODEL_NAME,
3535
"api_key": NOVITA_API_KEY,

src/server/workers/memory/config.py

Lines changed: 0 additions & 28 deletions
This file was deleted.

src/server/workers/memory/db.py

Lines changed: 0 additions & 26 deletions
This file was deleted.

src/server/workers/memory/llm.py

Lines changed: 0 additions & 88 deletions
This file was deleted.

0 commit comments

Comments
 (0)