-
Notifications
You must be signed in to change notification settings - Fork 4
Configuration Guide
Alessio Rocchi edited this page Jan 27, 2026
·
1 revision
Complete guide to configuring aistack for your environment.
- Configuration File
- Environment Variables
- Provider Configuration
- Memory Configuration
- Agent Configuration
- GitHub Configuration
- Plugin Configuration
- MCP Configuration
- Authentication Configuration
- Configuration Validation
- Best Practices
aistack uses a JSON configuration file located at aistack.config.json in your project root.
# Initialize creates a default config
npx @blackms/aistack init
# Or create manually
touch aistack.config.json{
"version": "1.0.0",
"providers": { },
"memory": { },
"agents": { },
"github": { },
"plugins": { },
"mcp": { },
"auth": { },
"hooks": { }
}aistack supports environment variable interpolation using ${VAR_NAME} syntax:
{
"providers": {
"anthropic": {
"apiKey": "${ANTHROPIC_API_KEY}"
}
}
}# Anthropic (if using)
export ANTHROPIC_API_KEY="sk-ant-api03-..."
# OpenAI (if using)
export OPENAI_API_KEY="sk-..."
# GitHub (if using token auth)
export GITHUB_TOKEN="ghp_..."
# JWT Secret (if using auth)
export JWT_SECRET="your-secret-key-min-32-chars"# Ollama base URL (default: http://localhost:11434)
export OLLAMA_BASE_URL="http://localhost:11434"
# Database path (default: ./data/aistack.db)
export AISTACK_DB_PATH="./data/aistack.db"
# Log level (default: info)
export LOG_LEVEL="debug"Create a .env file in your project root:
# .env
ANTHROPIC_API_KEY=sk-ant-api03-...
OPENAI_API_KEY=sk-...
GITHUB_TOKEN=ghp_...
JWT_SECRET=your-secret-key-min-32-charsLoad with dotenv:
npm install dotenv// In your script
require('dotenv').config();{
"providers": {
"default": "anthropic",
"anthropic": {
"apiKey": "${ANTHROPIC_API_KEY}",
"model": "claude-sonnet-4-20250514",
"maxTokens": 4096,
"temperature": 0.7
}
}
}Available Models:
-
claude-sonnet-4-20250514(default, recommended) claude-opus-4-20241229claude-3-5-sonnet-20241022
{
"providers": {
"default": "openai",
"openai": {
"apiKey": "${OPENAI_API_KEY}",
"model": "gpt-4o",
"maxTokens": 4096,
"temperature": 0.7
}
}
}Available Models:
-
gpt-4o(default) gpt-4o-minigpt-4-turbogpt-3.5-turbo
{
"providers": {
"default": "ollama",
"ollama": {
"baseUrl": "http://localhost:11434",
"model": "llama3.2",
"maxTokens": 4096,
"temperature": 0.7
}
}
}Popular Models:
-
llama3.2(default) codellamamistralmixtral
{
"providers": {
"default": "claude-code",
"cliProviders": {
"claudeCode": {
"model": "sonnet"
},
"gemini": {
"model": "gemini-2.0-flash"
}
}
}
}{
"providers": {
"default": "anthropic",
"anthropic": {
"apiKey": "${ANTHROPIC_API_KEY}",
"model": "claude-sonnet-4-20250514"
},
"openai": {
"apiKey": "${OPENAI_API_KEY}",
"model": "gpt-4o"
},
"ollama": {
"baseUrl": "http://localhost:11434",
"model": "llama3.2"
}
}
}{
"memory": {
"path": "./data/aistack.db",
"defaultNamespace": "default"
}
}{
"memory": {
"path": "./data/aistack.db",
"defaultNamespace": "default",
"vectorSearch": {
"enabled": true,
"provider": "openai",
"model": "text-embedding-3-small",
"dimensions": 1536
}
}
}Vector Search Providers:
-
openai- Uses OpenAI embedding API -
ollama- Uses Ollama embeddings (local)
OpenAI Embedding Models:
-
text-embedding-3-small(1536 dims, default) -
text-embedding-3-large(3072 dims)
Ollama Embedding Models:
-
nomic-embed-text(768 dims, default) -
mxbai-embed-large(1024 dims)
{
"memory": {
"path": "./data/aistack.db",
"defaultNamespace": "default",
"options": {
"verbose": false,
"fileMustExist": false,
"timeout": 5000
}
}
}{
"agents": {
"maxConcurrent": 10,
"defaultTimeout": 300,
"retryAttempts": 3,
"retryDelay": 1000
}
}Options:
-
maxConcurrent- Maximum concurrent agents (1-20, default: 10) -
defaultTimeout- Default timeout in seconds (10-3600, default: 300) -
retryAttempts- Number of retry attempts (0-10, default: 3) -
retryDelay- Delay between retries in ms (100-10000, default: 1000)
{
"github": {
"enabled": true,
"useGhCli": true
}
}Requires gh CLI to be authenticated:
gh auth login{
"github": {
"enabled": true,
"useGhCli": false,
"token": "${GITHUB_TOKEN}"
}
}{
"github": {
"enabled": false
}
}{
"plugins": {
"enabled": true,
"directory": "./plugins",
"autoload": true
}
}{
"plugins": {
"enabled": false
}
}{
"mcp": {
"transport": "stdio"
}
}{
"mcp": {
"transport": "http",
"port": 3000,
"host": "localhost"
}
}{
"auth": {
"enabled": true,
"jwtSecret": "${JWT_SECRET}",
"accessTokenExpiry": "15m",
"refreshTokenExpiry": "7d"
}
}{
"auth": {
"enabled": false
}
}Token Expiry Formats:
-
15m- 15 minutes -
1h- 1 hour -
7d- 7 days -
30d- 30 days
npx @blackms/aistack validate-configimport { validateConfig, loadConfig } from '@blackms/aistack';
const config = loadConfig('./aistack.config.json');
const { valid, errors } = validateConfig(config);
if (!valid) {
console.error('Configuration errors:', errors);
process.exit(1);
}Missing API Key:
Error: providers.anthropic.apiKey is required
Fix: Set ANTHROPIC_API_KEY environment variable
Invalid Path:
Error: memory.path must be a valid file path
Fix: Use absolute or relative path: ./data/aistack.db
Invalid Port:
Error: mcp.port must be between 1024 and 65535
Fix: Use valid port number: 3000
- Never commit API keys to version control
# Add to .gitignore
echo "aistack.config.json" >> .gitignore
echo ".env" >> .gitignore- Use environment variables
{
"providers": {
"anthropic": {
"apiKey": "${ANTHROPIC_API_KEY}"
}
}
}- Restrict file permissions
chmod 600 aistack.config.json
chmod 600 .env
chmod 600 ./data/aistack.db- Limit concurrent agents
{
"agents": {
"maxConcurrent": 5
}
}- Set appropriate timeouts
{
"agents": {
"defaultTimeout": 300
}
}- Enable vector search for large datasets
{
"memory": {
"vectorSearch": {
"enabled": true,
"provider": "openai"
}
}
}Development:
{
"providers": {
"default": "ollama",
"ollama": {
"baseUrl": "http://localhost:11434",
"model": "llama3.2"
}
},
"memory": {
"path": "./data/dev.db"
},
"auth": {
"enabled": false
}
}Production:
{
"providers": {
"default": "anthropic",
"anthropic": {
"apiKey": "${ANTHROPIC_API_KEY}",
"model": "claude-sonnet-4-20250514"
}
},
"memory": {
"path": "/var/lib/aistack/prod.db",
"vectorSearch": {
"enabled": true,
"provider": "openai"
}
},
"auth": {
"enabled": true,
"jwtSecret": "${JWT_SECRET}"
}
}{
"version": "1.0.0",
"providers": {
"default": "anthropic",
"anthropic": {
"apiKey": "${ANTHROPIC_API_KEY}",
"model": "claude-sonnet-4-20250514",
"maxTokens": 4096,
"temperature": 0.7
},
"openai": {
"apiKey": "${OPENAI_API_KEY}",
"model": "gpt-4o"
},
"ollama": {
"baseUrl": "http://localhost:11434",
"model": "llama3.2"
}
},
"memory": {
"path": "./data/aistack.db",
"defaultNamespace": "default",
"vectorSearch": {
"enabled": true,
"provider": "openai",
"model": "text-embedding-3-small"
}
},
"agents": {
"maxConcurrent": 10,
"defaultTimeout": 300,
"retryAttempts": 3
},
"github": {
"enabled": true,
"useGhCli": true
},
"plugins": {
"enabled": true,
"directory": "./plugins",
"autoload": true
},
"mcp": {
"transport": "stdio"
},
"auth": {
"enabled": true,
"jwtSecret": "${JWT_SECRET}",
"accessTokenExpiry": "15m",
"refreshTokenExpiry": "7d"
},
"hooks": {
"sessionStart": true,
"sessionEnd": true,
"preTask": true,
"postTask": true
}
}- First Agent Tutorial - Create your first agent
- Troubleshooting - Common configuration issues
- Memory System - Learn about persistent memory
- Configuration Schema - Complete schema reference
Related:
Getting Started
Core Concepts
Agent Guides
- Overview
- Coder
- Researcher
- Tester
- Reviewer
- Adversarial
- Architect
- Coordinator
- Analyst
- DevOps
- Documentation
- Security Auditor
MCP Tools
- Overview
- Agent Tools
- Memory Tools
- Task Tools
- Session Tools
- System Tools
- GitHub Tools
- Review Loop Tools
- Identity Tools
Recipes
- Index
- Code Review
- Doc Sync
- Multi-Agent
- Adversarial Testing
- Full-Stack Feature
- Memory Patterns
- GitHub Integration
Advanced
- Plugin Development
- Custom Agent Types
- Workflow Engine
- Vector Search Setup
- Web Dashboard
- Programmatic API
- Resource Monitoring
Reference