Environment Configuration
Configure your environment variables to customize MindedJS behavior and connect to external services.
Environment Variables
Create a .env
file in your project root to configure MindedJS:
# .env file
Core Configuration
RUN_LOCALLY
RUN_LOCALLY
Controls whether the agent runs fully local in memory or connects to the Minded platform.
RUN_LOCALLY=true
true
: Agent runs fully local in memory without external connectionsfalse
(default): Agent connects to the Minded platform
Chat Model Credentials
MindedJS currently supports OpenAI and Azure OpenAI chat models. Under the hood, these are implemented using LangChain chat models. If you want to use a chat model that is not currently supported, please reach out to us.
Supported Chat Model Configurations
OpenAI
OPENAI_API_KEY=your-openai-api-key
Azure OpenAI
AZURE_OPENAI_API_KEY=your-azure-openai-api-key
AZURE_OPENAI_ENDPOINT=your-azure-openai-endpoint
AZURE_OPENAI_API_DEPLOYMENT_NAME=your-deployment-name
AZURE_OPENAI_API_VERSION=your-api-version
Platform Connection
MINDED_CONNECTION_TOKEN
MINDED_CONNECTION_TOKEN
Required to connect to the Minded platform for advanced features and monitoring. Each token is specific to the agent you are working on.
MINDED_CONNECTION_TOKEN=your-minded-connection-token
Example .env File
Here's a complete example of a .env
file:
# Core Configuration
RUN_LOCALLY=false
# Chat Model (OpenAI example)
OPENAI_API_KEY=sk-your-openai-api-key-here
# Platform Connection
MINDED_CONNECTION_TOKEN=your-minded-connection-token-here
Loading Environment Variables
MindedJS automatically loads environment variables from your .env
file. Make sure to:
Create the
.env
file in your project rootAdd
.env
to your.gitignore
file to keep credentials secureNever commit your
.env
file to version control
# Add to .gitignore
.env
Runtime Environment Detection
MindedJS uses specific environment variables to determine the runtime environment and adjust behavior accordingly.
Environment Variables
Local Development
development
false
Running locally on developer machine
Minded Platform
development
true
Running in Minded platform sandbox
Staging Service
staging
true
Agent deployed as staging service
Production Service
production
true
Agent deployed as production service
Usage in Code
// Check if running on Minded Cloud
if (process.env.MINDED_CLOUD === 'true') {
// Running on Minded infrastructure (dev/staging/prod)
logger.info({ message: 'Running on Minded Cloud' });
}
// Check specific environment
if (process.env.NODE_ENV === 'production' && process.env.MINDED_CLOUD === 'true') {
// Production environment on Minded Cloud
logger.info({ message: 'Production mode' });
}
Environment-Specific Behavior
const isDevelopment = process.env.NODE_ENV === 'development';
const isMindedCloud = process.env.MINDED_CLOUD === 'true';
// Enable debug features only in development
if (isDevelopment) {
// Enable verbose logging
logger.setLevel('debug');
}
// Use different endpoints based on environment
const apiEndpoint = isMindedCloud ? 'https://api.minded.com' : 'http://localhost:3000';
Next Steps
With your environment configured, continue to:
Project Configuration - Set up your
minded.json
fileQuick Start - Build your first agent
Last updated