Home
Your AI assistant, wherever you chat
OpenFang is a lightweight AI agent gateway inspired by OpenClaw. It connects LLMs to your messaging channels with tools, skills, and persistent memory — all in ~5K lines of Python.
Run it locally. Own your data. Extend it freely.
Quick Start
The gateway runs at localhost:18789 with a web UI for chat, sessions, and configuration.
What It Does
-
Multi-Channel Inbox
Connect Telegram, Discord, and more. One assistant, all your chats.
-
Persistent Memory
Remembers context across conversations. Your assistant learns your preferences.
-
Powerful Tools
Files, shell, web browsing, cron jobs. The assistant can actually do things.
-
Extensible Skills
Add capabilities via Markdown files. No code required for new skills.
-
FastAPI Gateway
REST API + WebSocket events. Build on top of it.
-
Role-Based Permissions
Control who can use dangerous tools. Admin, developer, or open access.
Channels
| Channel | Status | Notes |
|---|---|---|
| Telegram | Ready | Full support with bot token |
| Discord | Ready | Slash commands + DMs |
| Planned | Coming soon | |
| Slack | Planned | Coming soon |
| Signal | Planned | Coming soon |
Configuration
Environment variables or .env file:
# Required: LLM provider
OPENAI_API_KEY=sk-... # Or use Anthropic
# Channels (add tokens to enable)
OPENFANG_TELEGRAM_BOT_TOKEN=... # From @BotFather
OPENFANG_DISCORD_BOT_TOKEN=... # From Discord Developer Portal
# Server
OPENFANG_HOST=0.0.0.0
OPENFANG_PORT=18789
Architecture
src/openfang/
├── agents/ # Top-level agent personas (YAML)
├── capabilities/ # Adapter implementations
├── channels/ # Telegram, Discord, ...
├── gateway/ # FastAPI server + web UI
├── messaging/ # Message dispatcher + resolver
├── skills/ # Markdown skill definitions
├── subagents/ # Specialized task delegation
├── protocols.py # Port interfaces (hexagonal)
├── deps.py # Dependency injection
├── agent.py # pydantic-ai agent factory
├── tools.py # ~40 agent tools
└── chat.py # Conversation management
Built on:
- pydantic-ai — Agent framework with type safety
- FastAPI — Async HTTP server
- HTMX + Alpine.js — Lightweight reactive UI
Why OpenFang?
OpenFang is OpenClaw's little sibling — same spirit, smaller footprint (~5K lines vs 314K). See README for design philosophy and principles.
Next Steps
- API Reference — Auto-generated docs from source
- GitHub — Source code and issues