A lean AI agent that can search the web and scrape URLs. Optional Discord bot wrapper included.
- Install dependencies
pip install -r requirements.txt- Set your OpenRouter API key
export OPENROUTER_API_KEY=your_api_key_here- Run
python agent.py # demoRequirements:
.bot_tokenfile with your Discord bot tokenOPENROUTER_API_KEYenvironment variable
Run:
python discord_bot.pyConfiguration (config.yaml):
auto_restart: true # auto-restart on file changes
base_url: "https://openrouter.ai/api/v1/chat/completions"
default_model: "amazon/nova-2-lite-v1:free"
image_caption_model: "nvidia/nemotron-nano-12b-v2-vl:free"Features:
- Auto-restart on code changes (configurable)
- Reply chain context support
- Image captioning with vision models
- Reaction-based eval logging (🧪 to log question, ✅ to mark accepted answer)
- User info persistence (add_userinfo/read_userinfo tools)
- DM support (all DMs are treated as queries)
from agent import Agent
import os
agent = Agent(os.getenv("OPENROUTER_API_KEY"))
answer = agent.run("Latest AI news?", verbose=True)
print(answer)web_search(query)- Search the web via pysearx (uses Brave, Google, Bing, DuckDuckGo, Startpage)read_url(url)- Read and extract content from URLs (YouTube, Wikipedia, PDFs, web pages)- Supports GitHub authentication (create
.github_tokenfile to avoid rate limits)
- Supports GitHub authentication (create
code(task)- Generate Python code and immediately execute it in an isolated Docker containerread_file(filepath)- Read files from current directory (1MB limit, path traversal protected)add_userinfo(username, info)- Store user information for future referenceread_userinfo(username)- Recall stored user information (case-insensitive)
Create a .github_token file in the project root with your GitHub Personal Access Token:
echo "ghp_yourTokenHere" > .github_tokenThis prevents rate limiting when scraping GitHub repositories.
Set the PROXY_FILE environment variable to point to a proxy whitelist file for pysearx:
export PROXY_FILE=whitelist_2026-01-11_15.txtOr add it to your .env file. This improves search reliability by rotating through validated proxies.
- Python 3.8+
- OpenRouter API key (free tier available)
- Internet connection for search/scrape
python tests/test_user_info.pyMIT