A self-hosted personal AI agent running on Azure's free tier services β inspired by Cloudflare's Moltworker, forged for the Azure ecosystem.
- Minimal cost: <$10/month using Azure free tiers
- Security-first: Managed Identity, Key Vault, Entra ID, content safety
- No Mac mini: Fully cloud-hosted, no dedicated hardware
- Production-ready: CI/CD, observability, scale-to-zero
- Extensible skills: Free Anthropic Computer Use + Azure-native integrations
User βββΊ Telegram / Slack / Discord / WhatsApp
β
βΌ
ββββββββββββββββββββ ββββββββββββββββββββββ
β Azure Functions βββββββ Entra ID (ZT+MFA) β
β JWT + Routing β ββββββββββββββββββββββ
ββββββββββ¬ββββββββββ
β Storage Queue
βΌ
βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
β Container Apps Environment β
β β
β βββββββββββββββββββββββββββ βββββββββββββββββββββββββββββ β
β β Agent (Container App) βββββΊβ OpenClaw Gateway (opt.) β β
β β β’ Queue Worker β β β’ ClawHub skills β β
β β β’ Tool-calling loop β β β’ Multi-channel β β
β β β’ 429 retry + backoff β β β’ wss:// internal only β β
β ββββββββββββ¬βββββββββββββββ βββββββββββββββββββββββββββββ β
β β fallback β
βββββββββββββββΌβββββββββββββββββββββββββββββββββββββββββββββββββββ
β
βββββββββββββ΄ββββββββββββ
βΌ βΌ
ββββββββββββββββ ββββββββββββββββ ββββββββββββββββ
β Azure OpenAI β β Key Vault β β Blob + Table β
β GPT-4o-mini β β Secrets β β Storage β
β Tool calling β β MI auth β β State β
ββββββββββββββββ ββββββββββββββββ ββββββββββββββββ
Key features of the current architecture:
- Tool-calling loop: Agent calls Azure OpenAI with function definitions, executes tool results, loops up to 5 rounds
- 429 retry with backoff: Exponential backoff respecting
Retry-Afterheaders for rate-limited S0 tier - OpenClaw fallback: If OpenClaw Gateway is unavailable, seamlessly falls back to direct Azure OpenAI
- Queue-based processing: DLQ after 3 failures; exponential backoff (2sβ30s) for scale-to-zero efficiency
- Conversation memory: Last 20 messages per session (24h TTL) loaded from Table Storage before each LLM call
- Graceful shutdown: SIGTERM/SIGINT handlers drain in-flight messages
See docs/architecture.md for detailed diagrams.
| Service | Monthly Cost | Notes |
|---|---|---|
| Azure Functions | $0.00 | 1M executions + 400K GB-s free/month |
| Azure Container Apps | $0.00 | 180K vCPU-sec + 360K GB-s free/month |
| Azure Blob Storage | ~$0.50 | Includes storage + read/write transactions |
| Azure Key Vault | ~$0.03 | $0.03 per 10,000 operations |
| Application Insights | $0.00 | 5GB ingestion/month free |
| OpenAI API (GPT-4o-mini) | ~$7.50 | ~500K tokens (input/output combined) |
| Anthropic Skills | $0.00 | FREE (runs locally, no API costs) |
| Tavily Web Search | ~$0.01 | Optional (~100 searches/month) |
| Bandwidth | $0.00 | First 100GB outbound/month free |
| TOTAL | ~$8.04 | Under $10/month for ~1,500 messages |
Note: All skills are FREE (Anthropic Computer Use). Only Tavily web search has minimal costs (~$0.01/search). See docs/COST.md for optimization tips.
- Azure subscription (create free account)
- Azure CLI >= 2.50
- Node.js >= 20 LTS
- Python >= 3.9 (for Anthropic skills)
- Docker (for building agent container)
- Terraform >= 1.5 (if using Terraform deploy)
- Azure Functions Core Tools >= 4.x
- Azure OpenAI access (requires approval β typically 1β3 days)
- Telegram Bot Token (from @BotFather)
- (Optional) Tavily API key for web search (~$0.01/search)
- (Optional) OpenClaw for enhanced skills β deployed as Azure Container App (see
infra/terraform/main.tf)
Cost disclaimer: Molten targets <$10/month using Azure free tiers (Functions, Container Apps, 5GB App Insights). Azure OpenAI (S0 tier, ~$7.50 for 500K tokens) is the primary cost driver. Scale-to-zero Container Apps and Consumption Functions ensure you pay nothing at idle. See the cost breakdown and docs/COST.md for details.
New to Azure or Molten? See docs/GETTING-STARTED.md for a complete walkthrough from zero to working bot.
Full infrastructure-as-code with plan/apply workflow.
git clone https://github.com/kimvaddi/molten.git
cd molten
az login
az account set --subscription "YOUR_SUBSCRIPTION_ID"
cd infra/terraform
cp terraform.tfvars.example terraform.tfvars
# Edit terraform.tfvars with your OpenAI endpoint, key, Telegram token, etc.
terraform init
terraform plan
terraform applyThen deploy the code:
# Deploy Function App
cd ../../src/functions && npm install && npm run build
func azure functionapp publish $(terraform -chdir=../../infra/terraform output -raw function_app_name)
# Set Telegram webhook
WEBHOOK_URL=$(terraform -chdir=../../infra/terraform output -raw telegram_webhook_url)
curl -X POST "https://api.telegram.org/bot${TELEGRAM_TOKEN}/setWebhook?url=${WEBHOOK_URL}"Interactive script that creates everything β including optional auto-creation of Azure OpenAI resources, Function App deployment, and Telegram webhook registration.
git clone https://github.com/kimvaddi/molten.git
cd molten
az login
# Bash (Linux/macOS/WSL)
chmod +x deploy/azure-cli/deploy.sh
./deploy/azure-cli/deploy.sh
# PowerShell (Windows)
.\deploy\azure-cli\deploy.ps1Need step-by-step guidance? See docs/GETTING-STARTED.md for a complete walkthrough.
Molten uses Anthropic Computer Use for zero-cost skill execution:
| Skill | Category | Cost | Description |
|---|---|---|---|
| bash | Anthropic | $0.00 | Execute shell commands (secure sandbox) |
| text_editor | Anthropic | $0.00 | Create, edit, delete files |
| web-search | Azure | ~$0.01 | Tavily web search (optional) |
| calendar | Azure | $0.00 | Microsoft Graph calendar |
| Azure | $0.00 | Microsoft Graph email |
- β FREE - No API subscription, runs locally
- β Open Source - MIT license, fully auditable
- β Self-Hosted - Data stays in your Azure infrastructure
- β Extensible - Add custom skills in TypeScript or Python
- β Enterprise-Grade - Built-in security, timeouts, sandboxing
import { getSkillsRegistry } from "./skills/skillsRegistry";
const skillsRegistry = await getSkillsRegistry();
// Execute bash command
const result = await skillsRegistry.executeSkill({
skillId: "bash",
parameters: {
command: "df -h",
timeout: 10,
},
userId: "user123",
});
// Edit files
await skillsRegistry.executeSkill({
skillId: "text_editor",
parameters: {
action: "create",
file_path: "/tmp/notes.txt",
content: "Meeting notes...",
},
userId: "user123",
});Learn more: docs/SKILLS-INTEGRATION.md
| Strategy | Savings |
|---|---|
| Azure Functions Consumption tier | FREE: 1M executions/month |
| GPT-4o-mini (not GPT-4) | 10x cheaper tokens |
| Semantic response cache | 50-80% fewer API calls |
max_tokens=512 cap |
Bounded per-request cost |
| Storage Queue (not Service Bus) | Free tier eligible |
| GitHub Container Registry | Free vs Azure ACR ($5/mo) |
- No secrets in code: All via Key Vault + Managed Identity
- Entra ID authentication: For admin UI
- Content safety filters: Block harmful prompts/responses
- HTTPS-only: TLS 1.2+ enforced
- RBAC: Least-privilege access
See docs/security-baseline.md.
molten/
βββ infra/
β βββ terraform/ # Terraform IaC (primary)
βββ deploy/
β βββ azure-cli/ # Azure CLI scripts (bash + PowerShell)
β βββ powershell/ # Azure PowerShell deployment
β βββ arm/ # ARM templates
β βββ bicep/ # Bicep modules
βββ src/
β βββ functions/ # Azure Functions (webhooks + queue dispatch)
β βββ agent/ # Agent runtime (Container Apps, Node.js 22)
β β βββ Dockerfile # Multi-stage build: node:22-alpine + python3
β β βββ src/
β β βββ index.ts # Express server, webhook endpoints, queue enqueue
β β βββ queue-worker.ts # Queue consumer, tool-calling loop, OpenClaw fallback
β β βββ openclaw/ # OpenClaw Gateway WebSocket client (10s timeout)
β β βββ integrations/ # Telegram, Slack, Discord, WhatsApp platform handlers
β β βββ llm/ # Azure OpenAI (callModelWithTools, 429 retry, safety)
β β βββ skills/ # Skills registry + anthropic_executor.py
β β βββ state/ # Blob store + Table store
β β βββ utils/ # Cache (5-min TTL), auth, logging
β βββ shared/ # Shared types and config
βββ docs/ # Architecture, cost, security, runbook
βββ .github/workflows/ # CI/CD pipelines
| Method | Description | One-Command? | Guide |
|---|---|---|---|
| Terraform | Infrastructure as Code (recommended) | No β infra + manual code deploy | infra/terraform |
| Azure CLI | Interactive shell scripts | Yes β infra + code + webhook | deploy/azure-cli |
| PowerShell | Native Windows deployment (Az module) | No β infra + manual code deploy | deploy/powershell |
| ARM Templates | Azure Resource Manager JSON | No β infra only (no Container App) | deploy/arm |
| Bicep | Azure DSL for ARM | No β infra only (no Container App) | deploy/bicep |
Contributions welcome! Please read CONTRIBUTING.md and SECURITY.md before submitting PRs.
MIT License - see LICENSE file for details.
Molten - Forged in Azure π₯
