Open-source, self-hosted platform for AI apps — WordPress for the AI era.
Build, embed, and ship AI chatbots and assistants with WordPress-style plugins and themes, bring-your-own-key support for OpenAI, Anthropic, and Gemini, and an embeddable widget for any website. A self-hosted, open-source alternative to closed AI-chat SaaS like Chatbase and Intercom Fin — your code, your keys, your infrastructure.
📖 Full documentation is available at agentaflow.github.io/agentbase — covering self-hosting, plugin & theme development, AI model configuration, and the full API reference.
The full Agentbase platform in this repository is GPL-3.0 and self-hostable with Docker — your code, your keys, your infrastructure, no vendor lock-in. AgentaFlow additionally operates a managed cloud and the public marketplace catalog as optional paid hosted services for teams who prefer not to run their own. Everything documented here runs entirely on infrastructure you control.
AI-Native — Built from the ground up for AI-first applications
Application Dashboard — Managing AI applications, plugins, and configurations
Chat Application — Fully functional AI chat app powered by your chosen model
Create Application — Quickly scaffold and configure a new AI application
agentbase/
├── packages/
│ ├── core/ # NestJS API (PostgreSQL + MongoDB)
│ ├── frontend/ # Next.js 14 (App Router + Tailwind)
│ ├── ai-service/ # FastAPI (AI provider integrations + SSE streaming)
│ ├── installer/ # Self-hosted CLI installer (Commander + Inquirer)
│ ├── shared/ # Shared TypeScript types
│ ├── plugins/ # Plugin SDK + examples
│ └── themes/ # Theme SDK + starter themes
├── docs/ # Documentation site (Nextra)
├── docker-compose.yml # Local dev databases
├── docker-compose.prod.yml # Production stack
└── .env.example # Environment template
| Layer | Technology |
|---|---|
| Core API | Node.js + NestJS + TypeORM |
| Frontend | Next.js 14 + React + Tailwind CSS |
| AI Service | Python + FastAPI |
| SQL Database | PostgreSQL 16 |
| Document DB | MongoDB 7 |
| Cache | Redis 7 |
| Infrastructure | Docker — self-host on any cloud or bare metal (production Compose + Azure Bicep IaC included) |
| License | GPL-3.0 |
- Node.js 20+
- Python 3.11+
- Docker & Docker Compose
- pnpm 9+
# Clone the repo
git clone https://github.com/agentaflow/agentbase.git
cd agentbase
# Copy environment variables
cp .env.example .env
# Start databases
docker compose up -d
# Install dependencies
pnpm install
# Start all services
pnpm devServices will be available at:
- Frontend: http://localhost:3000
- Core API: http://localhost:3001
- API Docs: http://localhost:3001/api/docs
- AI Service: http://localhost:8000
pnpm dev:core # NestJS API only
pnpm dev:frontend # Next.js frontend only
pnpm dev:ai # FastAPI AI service onlyFor production self-hosted deployments, use the CLI installer:
cd packages/installer
pnpm install
npx ts-node src/cli.ts check # Verify system requirements
npx ts-node src/cli.ts install # Interactive installation wizard
npx ts-node src/cli.ts status # Check service status
npx ts-node src/cli.ts update # Update to latest versionAgentbase is plain Docker — deploy it on any cloud or bare metal, no lock-in:
- Docker Compose (universal baseline) — production stack in docker-compose.prod.yml
- Azure — reference infrastructure-as-code (Bicep) in infra/, documented in docs/azure/
- DigitalOcean / GCP — guides planned (contributions welcome)
- Multi-Provider Support — OpenAI (GPT-4, GPT-4 Turbo, GPT-4o, GPT-4o Mini, GPT-3.5 Turbo), Anthropic (Claude Sonnet 4.5, Claude Haiku 4.5), Google Gemini (2.0 Flash, 1.5 Pro, 1.5 Flash), HuggingFace (Llama 3.1, Mistral, Mixtral, Phi-3, and more via Inference API)
- BYOK (Bring Your Own Key) — Users can securely store their own provider API keys, encrypted at rest with AES-256-GCM. BYOK keys bypass the platform quota gate entirely and are decrypted ephemerally per request — never cached or exposed to browser clients
- Model Configuration Dashboard — Per-app model configs with provider selection, parameter tuning (temperature, max tokens, top-p), and system prompts
- A/B Testing — Model config versioning with traffic splitting and performance metrics tracking
- Streaming Responses — Server-Sent Events (SSE) for real-time token-by-token output
- Conversation Management — Create, continue, archive conversations per application
- Prompt Templates — Reusable templates with
{{variable}}substitution - Knowledge Base (RAG) — Vector-based semantic search with OpenAI embeddings, document chunking, and context retrieval
- WordPress-Style Hooks — Actions and filters with priority-based execution
- Plugin SDK — TypeScript interfaces and utilities for plugin development
- Advanced Capabilities — Database access (scoped key-value store), custom API endpoints, cron scheduling, webhooks, admin UI extensions, inter-plugin event bus
- Lifecycle Management — Install, activate, deactivate, uninstall with dependency resolution
- Marketplace — Browse, search, rate, and review plugins and themes across multiple categories
- Plugin Versioning — Multiple versions per plugin with changelogs, compatibility checks, and checksums
- Developer Portal — Submit plugins/themes for marketplace review, admin approval workflow
- Download Tracking — Automatic install/download counters
- Per-App Installation — Install and configure plugins independently per application
- Theme Engine — CSS custom property generation with 4 built-in presets
- White-Label Branding — Custom colors, fonts, logos, email templates, and CSS injection
- Custom Domains — DNS verification (CNAME/TXT), SSL tracking, domain settings
- Embeddable Widget — Standalone JavaScript widget for any website with theme support
- Organizations — Team creation with member management (Owner/Admin/Member/Viewer roles)
- SSO Integration — SAML 2.0 and OIDC support with auto-provisioning
- Notifications — In-app notification system with real-time updates
- Audit Logging — Comprehensive audit trail for all platform actions
- Stripe Integration — 4 subscription tiers (Free, Starter $29/mo, Pro $99/mo, Enterprise $499/mo)
- Usage Metering — Token and message quotas with enforcement before AI calls; paid plans report overage tokens to Stripe as metered usage records for automatic per-1K-token billing
- Webhooks — 11 event types with HMAC-SHA256 signing and delivery tracking
- Data Export/Import — JSON and CSV export, bulk import with error handling
- OAuth2 — GitHub and Google OAuth with automatic account linking
- JWT + Refresh Tokens — Secure authentication with token rotation
- API Keys — Create, scope, rate-limit, and revoke API keys per application
- Provider Key Vault — User BYOK provider keys stored encrypted with AES-256-GCM; only a 4-character hint is ever returned by the API
- Role-Based Access Control — Admin, Developer, User roles with permission guards
- Security Hardening — Helmet middleware, CORS, rate limiting, HSTS, CSP headers
- Usage Analytics — Track conversations, messages, tokens, costs per application
- Event Tracking — MongoDB-backed event stream (message_sent, widget_loaded, api_call, error)
- System Health — Real-time service checks (PostgreSQL, MongoDB, Redis, AI Service)
- Platform Statistics — Users, applications, subscriptions, resource usage
- Self-Hosted Installer CLI — Interactive installation wizard (
agentbase install) with system requirements checking, database setup, admin account creation, and.envgeneration - Update Mechanism —
agentbase updatewith automatic backups, migration running, and dependency updates - System Status —
agentbase statusshows version, service health, and Docker container status - Docker Production Stack — Multi-stage builds with Alpine images, health checks, non-root user
- Nginx Reverse Proxy — SSL termination, rate limiting, security headers, SSE streaming
- Email Service — SMTP transport with HTML templates (welcome, password reset, usage warnings)
- File Uploads — S3-compatible storage (AWS S3, MinIO, DigitalOcean Spaces, Cloudflare R2)
- Automated Backups — PostgreSQL and MongoDB backup scripts with 7-day retention
- Self-Hosting Guide — Complete installation and configuration instructions
- Plugin Development — Getting started, SDK reference, advanced capabilities, publishing guide
- AI Models Guide — Provider configuration, model settings, A/B testing
- API Reference — Full marketplace, model configs, and provider keys API documentation
- Examples Gallery — AI chatbot, plugin with database, custom theme, embeddable widget, RAG pipeline
POST /api/auth/register— Register new userPOST /api/auth/login— LoginGET /api/auth/me— Get current userGET /api/auth/github— OAuth: Redirect to GitHubGET /api/auth/github/callback— OAuth: GitHub callbackGET /api/auth/google— OAuth: Redirect to GoogleGET /api/auth/google/callback— OAuth: Google callbackGET /api/auth/providers— List available OAuth providersPOST /api/auth/refresh— Refresh access tokenPOST /api/auth/change-password— Change passwordPOST /api/auth/password-reset/request— Request password reset emailPOST /api/auth/password-reset— Reset password with token
POST /api/applications— Create applicationGET /api/applications— List user's applicationsGET /api/applications/:id— Get applicationPUT /api/applications/:id— Update applicationDELETE /api/applications/:id— Delete application
GET /api/plugins— List marketplace pluginsPOST /api/plugins— Create pluginPUT /api/plugins/:id/publish— Publish pluginPOST /api/applications/:appId/plugins— Install pluginPUT /api/applications/:appId/plugins/:id/activate— Activate pluginPUT /api/applications/:appId/plugins/:id/deactivate— Deactivate pluginDELETE /api/applications/:appId/plugins/:id— Uninstall pluginALL /api/plugins/:pluginId/endpoints/*— Dynamic plugin custom endpoints
GET /api/marketplace/browse— Browse pluginsGET /api/marketplace/featured— Featured pluginsGET /api/marketplace/categories— Plugin categoriesGET /api/marketplace/plugins/:id— Plugin detail with rating statsGET /api/marketplace/plugins/:id/reviews— Plugin reviewsPOST /api/marketplace/plugins/:id/reviews— Submit reviewGET /api/marketplace/plugins/:id/versions— Plugin versionsPOST /api/marketplace/plugins/:id/versions— Publish new versionGET /api/marketplace/themes— Browse themesGET /api/marketplace/themes/featured— Featured themesGET /api/marketplace/themes/categories— Theme categoriesGET /api/marketplace/themes/:id— Theme detailGET /api/marketplace/themes/:id/reviews— Theme reviewsPOST /api/marketplace/themes/:id/reviews— Submit theme reviewPOST /api/marketplace/submit/plugin— Developer: submit pluginPOST /api/marketplace/submit/theme— Developer: submit themeGET /api/marketplace/admin/pending/plugins— Admin: pending pluginsPOST /api/marketplace/admin/plugins/:id/approve— Admin: approve pluginPOST /api/marketplace/admin/plugins/:id/reject— Admin: reject pluginGET /api/marketplace/admin/pending/themes— Admin: pending themesPOST /api/marketplace/admin/themes/:id/approve— Admin: approve themePOST /api/marketplace/admin/themes/:id/reject— Admin: reject theme
GET /api/provider-keys— List saved provider keys (key hints only)PUT /api/provider-keys/:provider— Save or replace a key (openai|anthropic|gemini|huggingface)DELETE /api/provider-keys/:provider— Remove a saved keyPOST /api/provider-keys/:provider/validate— Validate a saved key with a live test call
GET /api/model-configs?applicationId=— List model configsPOST /api/model-configs— Create model configGET /api/model-configs/:id— Get model configPUT /api/model-configs/:id— Update model configDELETE /api/model-configs/:id— Delete model configPATCH /api/model-configs/:id/default— Set default modelGET /api/model-configs/:id/versions— List A/B test versionsPOST /api/model-configs/:id/versions— Create A/B test version
POST /api/prompts— Create prompt templateGET /api/prompts?applicationId=— List templates for appGET /api/prompts/:id— Get prompt templatePUT /api/prompts/:id— Update prompt templateDELETE /api/prompts/:id— Delete prompt templatePUT /api/prompts/:id/default— Set as default templatePOST /api/prompts/render— Render template with variables
GET /api/themes— List themesPOST /api/themes— Create themePUT /api/applications/:id/theme— Set application themePUT /api/applications/:id/theme/customize— Customize theme
GET /api/ai/providers— List AI providersPOST /api/ai/conversations— Create conversationPOST /api/ai/conversations/:id/messages— Send message (standard)POST /api/ai/conversations/:id/stream— Send message (SSE streaming)GET /api/ai/conversations/by-app/:appId— List conversationsDELETE /api/ai/conversations/:id— Archive conversation
Agentbase supports multiple AI providers out of the box. With BYOK, any model the provider exposes via their API is supported — just supply your key and specify the model ID; the platform routes the request directly to the provider with no additional configuration.
- OpenAI — o3 Mini, o1, o1 Mini, GPT-4o, GPT-4o Mini, GPT-4 Turbo, GPT-4, GPT-3.5 Turbo
- Anthropic — Claude Opus 4.8, Claude Sonnet 4.6, Claude Sonnet 4.5, Claude Haiku 4.5
- Google Gemini — Gemini 2.0 Flash, Gemini 2.0 Flash Thinking, Gemini 1.5 Pro, Gemini 1.5 Flash
- HuggingFace — Llama 3.1 8B, Mistral 7B, Mixtral 8x7B, Phi-3 Mini, Zephyr 7B (any model via Inference API)
Configure provider keys in one of two ways:
- Platform keys (paid plans) — set
OPENAI_API_KEY,ANTHROPIC_API_KEY, etc. in.env. Usage is metered and included in your plan quota; overages are billed automatically via Stripe. - BYOK (all plans including Free) — users can save their own provider API keys in Dashboard → Settings → AI Providers. Keys are AES-256-GCM encrypted at rest and bypass the monthly quota gate entirely.
Agentbase handles provider routing, rate limiting, and conversation management automatically.
Required for BYOK: set
ENCRYPTION_KEYto a 64-hex-char secret (generate withnode -e "console.log(require('crypto').randomBytes(32).toString('hex'))").
See CHANGELOG.md for a detailed history of changes across all phases.
Agentbase is pre-launch and actively developed — it's a great time to get involved and shape the project early. We welcome contributions of all sizes, from docs fixes to new plugins, themes, and providers.
- Start here: CONTRIBUTING.md for development guidelines and the local setup above.
- Good places to jump in:
- DigitalOcean / GCP deployment guides (Azure reference IaC already exists in infra/ to model from)
- New marketplace plugins and themes built on the Plugin SDK and Theme SDK
- Additional AI provider integrations and example apps
- Documentation, tutorials, and the examples gallery
- Found a bug or have an idea? Open an issue — well-scoped issues and PRs are the fastest way to help.
GNU General Public License v3.0 — see LICENSE
Built by AgentaFlow



