Flexible LangChain Agent
(Spider) Murphy is a Discord AI agent that combines cutting-edge language model capabilities with practical tools for real-time information retrieval and conversation.
Tools:
get_weather- Real-time weather information for any locationweb_search- Google AI-powered search with advanced query supportclock- Current date and time retrievalcalculate- Mathematical expression evaluation with math functionssearch_chat_history- Advanced conversation search with boolean operatorsread_webpage- Web content extraction using Trafilatura + BeautifulSoup
Context Awareness:
- Contextual awareness - Maintains conversation history and thread context
- File attachment processing - Reads and processes
message.txtattachments - Reply chain tracking - Understands message replies and references
- Thread-aware responses - Responds when mentioned in threads
- Message splitting - Automatically handles Discord's 2000-character limit
Easy to schedule:
startup.bat- Headless startup file w/ logging, perfect for scheduled tasks
# Clone the repository
git clone https://github.com/Daethyra/Murphy.git
cd Murphy
# Install dependencies
pip install -r requirements.txtCreate a .env file with:
DISCORD_TOKEN=your_discord_bot_token_here
DEEPSEEK_API_KEY=your_deepseek_api_key_here
SERPAPI_KEY=your_serpapi_key_herepython -m murphy.chatbot- Mention the bot (
@Spider Murphy) in any channel - Direct messages for private conversations
- Thread mentions for focused discussions
@Spider Murphy what's the weather in Night City?
@Spider Murphy search for "look up recent attacks on free speech in September"
@Spider Murphy calculate sqrt(256) + 2^8
@Spider Murphy search_chat_history user:Daethyra AND "web scraping"
@Spider Murphy read https://example.com/article
- File attachments: Send
message.txtwith additional context(copy/pasting large amounts of text) - Thread context: Bot has contextual conversation history, meaning it's memory is based on where it is mentioned
- Boolean search: Use
AND,OR,NOToperators in chat history searches - Role filtering:
user:usernameorassistant:in searches - Date filters:
after:2024-01-01,before:2024-12-31
Edit the system prompt in chatbot.py to adjust Spider Murphy's character traits, speech patterns, or knowledge base.
- Define new tools in
agent_tools.pyusing@tooldecorator - Import and add to tools list in
chatbot.py - Update requirements if needed
Check the LangChain documentation for help
Change AI model parameters in chatbot.py:
model = ChatDeepSeek(
temperature=0.67, # Adjust creativity
model="deepseek-chat",
# max_tokens=2048, # Control response length
)This project is licensed under the MIT License - see the LICENSE file for full details.
