A modular, self-hosted AI agent that connects to Discord, Telegram, and Slack. The agent can orchestrate multi-step tasks using pluggable modules (web research, code execution, persistent memory, file management, etc.), supports multiple LLM providers with automatic fallback, and maintains persistent memory with semantic recall.
βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
β Communication Layer β
β Discord Bot β Telegram Bot β Slack Bot β
β (discord.py) (python-telegram-bot) (slack-bolt) β
ββββββββ¬ββββββββββββββββββ¬βββββββββββββββββββββ¬ββββββββββββββββ
β IncomingMessage (normalized) β
βΌ βΌ βΌ
βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
β Orchestrator Core β
β ββββββββββββββββ ββββββββββββββββββ ββββββββββββββββββββ β
β β Agent Loop β β Context Builderβ β Tool Registry β β
β β (reason/act) β β (memory+ctx) β β (HTTP discovery) β β
β ββββββββ¬ββββββββ ββββββββββββββββββ βββββββββββ¬βββββββββ β
β β β β
β ββββββββ΄ββββββββ βββββββββββββββββββββ β
β β LLM Router β β Memory System ββ β
β β Claude/GPT/ β β (summarizer + ββ β
β β Gemini β β semantic recall)ββ β
β ββββββββββββββββ βββββββββββββββββββββ β
ββββββββββββββββββββββββββββββββββββββββββββββββββΌβββββββββββββ
β POST /execute β
βΌ βΌ
βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
β Module Layer β
β Research β Code Exec β Knowledge β File Mgr β Atlassian β ... β
β (search, (Python/ (remember/ (MinIO (Jira/ β
β scrape) shell) recall) CRUD) Confluence) β
β Claude Code β Deployer β Scheduler β Garmin β Renpho β Loc. β
β (coding in (live URL (background (health (body (geo- β
β Docker) deploy) jobs) data) comp) fence)β
βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
β
ββββββββ΄βββββββββββββββββββββββββββββββββββββββββββββββββββββββ
β Infrastructure β
β PostgreSQL (pgvector) β Redis β MinIO (S3) β
βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
cd agent
cp .env.example .envEdit .env and fill in at minimum:
POSTGRES_PASSWORDβ any secure password- At least one LLM API key (
ANTHROPIC_API_KEY,OPENAI_API_KEY, orGOOGLE_API_KEY) - At least one platform bot token (
DISCORD_TOKEN,TELEGRAM_TOKEN, orSLACK_BOT_TOKEN+SLACK_APP_TOKEN)
make setupThis builds all containers, starts Postgres/Redis/MinIO, runs database migrations, and creates the MinIO bucket. A default persona is automatically created on first startup with access to all registered modules.
make create-owner DISCORD_ID=123456789
# or with multiple platforms:
make create-owner DISCORD_ID=123 TELEGRAM_ID=456 SLACK_ID=789make upSend a message to your bot on Discord/Telegram/Slack. It will respond using the configured LLM and available tools.
make up # Start all services
make down # Stop all services
make restart # Restart all services
make logs # Tail logs from all services
make logs-core # Tail logs from core only
make status # Show service status
make setup # First-time setup (migrations, bucket)
make migrate # Run database migrations
make refresh-tools # Re-discover module manifests
make shell # Open a shell in the core container
make psql # Open a PostgreSQL shell| Module | Tools | Description |
|---|---|---|
research |
web_search, fetch_webpage, summarize_text, news_search |
Search the web, scrape pages, summarize content, search recent news |
code_executor |
run_python, run_shell |
Execute Python code (with numpy, pandas, matplotlib, scipy, sympy, requests) and shell commands in sandboxed subprocesses |
knowledge |
remember, recall, list_memories, forget |
Persistent per-user knowledge base with semantic search via pgvector |
file_manager |
create_document, list_files, get_file_link, delete_file, read_document |
Create, read, and manage documents in MinIO storage |
atlassian |
jira_search, jira_get_issue, jira_create_issue, jira_update_issue, confluence_search, confluence_get_page, confluence_create_page, confluence_update_page, create_meeting_notes, create_feature_doc |
Jira and Confluence integration β search, create, update issues and pages; structured meeting notes and feature docs with optional Jira ticket creation |
claude_code |
run_task, continue_task, task_status, task_logs, cancel_task, list_tasks |
Execute coding tasks using Claude Code CLI in disposable Docker containers; iterate on existing workspaces |
deployer |
deploy, list_deployments, teardown, teardown_all, get_logs |
Deploy projects (React, Next.js, static, Node, Docker) to live URLs with environment variable injection |
scheduler |
add_job, list_jobs, cancel_job |
Background job scheduler for monitoring long-running tasks and sending proactive notifications |
garmin |
get_daily_summary, get_heart_rate, get_sleep, get_body_composition, get_activities, get_stress, get_steps |
Fetch health, fitness, and activity data from Garmin Connect |
renpho_biometrics |
get_measurements, get_latest, get_trend |
Fetch body composition and biometric data from Renpho smart scales |
location |
create_reminder, list_reminders, cancel_reminder, get_location, set_named_place, generate_pairing_credentials |
Location-based reminders via OwnTracks geofences, named places, and GPS tracking |
injective |
get_portfolio, get_market_price, place_order, cancel_order, get_positions |
Blockchain trading (scaffold, owner-only) |
See docs/ADDING_MODULES.md for a complete guide and prompt template.
A web-based analytics dashboard is available at http://localhost:8501 (configurable via DASHBOARD_PORT). It shows:
- User statistics and token usage
- Conversation history
- System health (Postgres, Redis, MinIO)
- Tool usage breakdown
- Platform distribution
- Persona management overview
# Create the owner account (unlimited tokens, all permissions)
make create-owner DISCORD_ID=123456789
# Promote a user
docker compose exec core python /app/cli.py user promote \
--platform discord --platform-id 123456789 --level admin
# Set a token budget
docker compose exec core python /app/cli.py user set-budget \
--platform discord --platform-id 123456789 --tokens 50000
# List all users
docker compose exec core python /app/cli.py user listPersonas control the system prompt, which modules are available, and which LLM model to use. A default persona is automatically created at startup with access to all registered modules, and is updated whenever new modules are added.
# Create a persona bound to a specific Discord server
docker compose exec core python /app/cli.py persona create \
--name "Research Bot" \
--prompt "You are a research assistant. Be thorough and cite sources." \
--platform discord \
--server-id 123456789 \
--modules research,file_manager,code_executor,knowledge
# List personas
docker compose exec core python /app/cli.py persona list
# Set the default persona
docker compose exec core python /app/cli.py persona set-default --id <persona-uuid>| Level | Description | Default Budget |
|---|---|---|
owner |
Full access to all tools including trading | Unlimited |
admin |
Access to admin-level tools | Unlimited |
user |
Standard access | Configurable |
guest |
Auto-created on first message, limited modules | 5,000 tokens/month |
The system supports multiple providers with automatic fallback. Only one API key is required β the system automatically selects a working default model based on available providers.
| Provider | Models | Required Key |
|---|---|---|
| Anthropic | Claude Sonnet, Haiku, etc. | ANTHROPIC_API_KEY |
| OpenAI | GPT-4o, GPT-4o-mini, embeddings | OPENAI_API_KEY |
| Gemini 2.0 Flash, embeddings | GOOGLE_API_KEY |
If the primary model fails, the system tries the fallback chain. Models requiring unavailable providers are skipped instantly.
agent/
βββ shared/ # Shared Python package (config, models, schemas)
βββ core/ # Orchestrator service (FastAPI)
β βββ orchestrator/ # Agent loop, context builder, tool registry
β βββ llm_router/ # Provider abstraction (Anthropic, OpenAI, Google)
β βββ memory/ # Summarizer and semantic recall
βββ comms/ # Platform bots
β βββ discord_bot/
β βββ telegram_bot/
β βββ slack_bot/
βββ modules/ # Pluggable tool modules
β βββ research/
β βββ code_executor/
β βββ knowledge/
β βββ file_manager/
β βββ atlassian/
β βββ claude_code/
β βββ deployer/
β βββ scheduler/
β βββ garmin/
β βββ renpho_biometrics/
β βββ location/
β βββ injective/
βββ dashboard/ # Admin analytics dashboard
βββ alembic/ # Database migrations
βββ nginx/ # Reverse proxy config
βββ docs/ # Documentation
βββ cli.py # Admin CLI
βββ docker-compose.yml
make build # Rebuild all Docker images
make build-core # Rebuild just the core service
make build-module M=research # Rebuild a specific module
make restart-core # Rebuild and restart core
make restart-module M=research # Rebuild and restart a moduleFor development outside Docker, install the shared package first:
cd agent/shared && pip install -e .Then run any service:
cd agent && uvicorn core.main:app --reload --port 8000You'll need Postgres, Redis, and MinIO running (use make infra to start just infrastructure).