This repository was archived by the owner on Mar 4, 2026. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathapp.py
More file actions
87 lines (70 loc) · 2.12 KB
/
app.py
File metadata and controls
87 lines (70 loc) · 2.12 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
import os
import asyncio
from dotenv import load_dotenv
# LangGraph & LangChain
from langgraph.prebuilt import create_react_agent
from langchain_community.tools.tavily_search import TavilySearchResults
from server import run_server
from services.vector_db import initalise_vector_db
from services.state_store import init_states
from core.discord_bot import setup_discord_bot
# tools and utils
from tools.reminder import ReminderTool
# from tools.calender.calender import CalenderAgentTool
from tools.spotify import SpotifyTool
from tools.user import UserTool
from tools.weather import WeatherTool
from util.llm_provider import llm_initializer
from util.custom_memory_saver import CustomMemorySaver
from util.agent_state import KayoriState
from templates.core.private_template import private_template
from templates.core.public_template import public_template
# --- Load Environment ---
load_dotenv()
TOKEN = os.getenv("DISCORD_BOT_TOKEN")
# --- Memory & Vector DB ---
memory = CustomMemorySaver()
vector_store = initalise_vector_db(api_key="PINECONE")
# --- Tools ---
private_tools = [
TavilySearchResults(max_results=3),
SpotifyTool(),
UserTool(),
WeatherTool,
ReminderTool(userId=os.getenv("USER_ID"))
# CalenderAgentTool(),
]
# just hardcoding rn coz it's a pain to setup rn, and im tired as shit
public_tools = [
TavilySearchResults(max_results=3),
WeatherTool,
ReminderTool(userId="1387877964506464256")
]
# --- LLM Setup ---
llm = llm_initializer(model="gemini-2.5-flash", temperature=0.7)
# --- Agents ---
private_executer = create_react_agent(
llm,
private_tools,
checkpointer=memory,
prompt=private_template,
state_schema=KayoriState,
)
public_executer = create_react_agent(
llm,
public_tools,
checkpointer=memory,
prompt=public_template,
state_schema=KayoriState,
)
# --- Discord Bot Setup ---
client = setup_discord_bot(private_executer, public_executer, vector_store)
# --- Entry Point ---
async def main():
await asyncio.gather(
init_states(),
client.start(TOKEN),
run_server()
)
if __name__ == "__main__":
asyncio.run(main())