Setup

Configuration & Environment

Complete guide to configuring the AI Agent Automation Platform using environment variables and settings.

The .env File

The primary way to configure the backend engine is through environment variables. Copy the .env.example file to .env in the backend directory.

Server Settings

PORTThe port the Express server will listen on (default: 5000).Required
NODE_ENVSet to 'production' or 'development'.Required
MONGO_URIThe connection string for your MongoDB instance (default: mongodb://localhost:27017).Required
MONGO_MAX_POOL_SIZEMongoDB connection pool max size (default: 100).
MONGO_MIN_POOL_SIZEMongoDB connection pool min size (default: 10).
JWT_SECRETA strong secret for signing authentication tokens.Required

AI Provider Settings

OLLAMA_HOSTBase URL of your local Ollama instance (e.g., http://localhost:11434). Required when using the 'ollama' provider.
GROQ_API_KEYAPI key for the Groq provider. Required when using Groq-hosted LLM models.
OPENAI_API_KEYAPI key for OpenAI models (e.g., gpt-4o, gpt-4o-mini). Required when using the 'openai' provider.
GEMINI_API_KEYAPI key for Google Gemini models (e.g., gemini-2.5-flash). Required when using the 'gemini' provider.
HF_API_KEYAPI key for Hugging Face Inference API. Required only when using the 'huggingface' provider.

Worker Runtime Settings

WORKER_POLL_INTERVAL_MSPoll interval in ms (default: 2000).
WORKER_BATCH_SIZENumber of tasks to claim at once (default: 1).
WORKER_MAX_ATTEMPTSMax retry attempts per task (default: 3).
WORKER_CONCURRENCY_LIMITMax concurrent tasks processed by this worker (default: 5).
WORKER_SERVICE_TOKENToken for internal service authentication (if using internal broadcast endpoints).
WORKER_IDUnique identifier for this worker instance.

Security & Rate Limiting

RATE_LIMIT_WINDOW_MSRate limit window in ms (default: 900000 = 15 min).
RATE_LIMIT_GLOBAL_MAXMax requests per window for global limiter (default: 100).
RATE_LIMIT_AUTH_MAXMax auth attempts per window (default: 5).
RATE_LIMIT_EXPENSIVE_MAXMax expensive operations per minute (default: 10).
RATE_LIMIT_WEBHOOK_MAXMax webhook requests per minute (default: 20).

Email Settings

EMAIL_HOSTSMTP host for sending emails.
EMAIL_PORTSMTP port (e.g., 587 for TLS).
EMAIL_USERSMTP username.
EMAIL_PASSSMTP password.
EMAIL_FROMDefault sender email address.

Telemetry

TELEMETRY_ENABLEDEnable anonymous telemetry (default: true). Set to 'false' to disable.
TELEMETRY_ENDPOINTEndpoint for telemetry collection.
DISABLE_ALL_ANALYTICSSet to 'true' to disable all outbound analytics.

MCP Settings

MCP_ENABLEDEnable MCP subsystem (default: false).
MCP_CONFIG_PATHPath to MCP config JSON file.
MCP_CONFIG_JSONInline MCP config JSON.
MCP_SERVER_URLDefault server URL for streamable-http transport.

Integrations

GITHUB_TOKENGitHub personal access token for GitHub tool.
SLACK_WEBHOOK_URLSlack incoming webhook URL.
DISCORD_WEBHOOK_URLDiscord webhook URL.

Tool Sandbox

TOOL_SANDBOX_UIDOptional Unix User ID for sandboxed tool processes.
TOOL_SANDBOX_GIDOptional Unix Group ID for sandboxed tool processes.
TOOL_EXECUTION_TIMEOUT_MSTimeout for custom tool executions (default: 30000).

Internal Auth

INTERNAL_AUTH_TOKENToken for internal runner-to-API broadcast requests.

Example .env

.env
PORT=5000
MONGO_URI=mongodb://localhost:27017
JWT_SECRET=<SECRET_1f4b2c3d>

# AI Providers
GROQ_API_KEY=
OPENAI_API_KEY=
GEMINI_API_KEY=
HF_API_KEY=
OLLAMA_HOST=http://localhost:11434

# Worker Runtime
WORKER_POLL_INTERVAL_MS=2000
WORKER_BATCH_SIZE=1
WORKER_MAX_ATTEMPTS=3
WORKER_CONCURRENCY_LIMIT=5
WORKER_SERVICE_TOKEN=

# Email
EMAIL_HOST=
EMAIL_PORT=
EMAIL_USER=
EMAIL_PASS=
EMAIL_FROM=

# Telemetry
TELEMETRY_ENABLED=true
TELEMETRY_ENDPOINT=https://telematry-website.vercel.app/collector
DISABLE_ALL_ANALYTICS=false

# MCP
MCP_ENABLED=false
MCP_CONFIG_PATH=
MCP_CONFIG_JSON=
MCP_SERVER_URL=

# Integrations
GITHUB_TOKEN=
SLACK_WEBHOOK_URL=
DISCORD_WEBHOOK_URL=

# Rate Limiting
RATE_LIMIT_WINDOW_MS=900000
RATE_LIMIT_GLOBAL_MAX=100
RATE_LIMIT_AUTH_MAX=5
RATE_LIMIT_EXPENSIVE_MAX=10
RATE_LIMIT_WEBHOOK_MAX=20

# Tool Sandbox
TOOL_SANDBOX_UID=
TOOL_SANDBOX_GID=
TOOL_EXECUTION_TIMEOUT_MS=30000

Pro-Tip: Run Models Locally with Ollama

You can run LLMs locally using Ollama for faster iteration and zero API costs. Set OLLAMA_HOST in your .env, create an agent with provider ollama, and assign it to your workflow. The system will automatically route execution to your local model.