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

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 connections

  • false (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

If you need support for additional chat models, please contact us and we'll work on adding support for your preferred provider.

Platform Connection

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

Your connection token is available on the Minded platform in the agent page within the GitHub integration popup. You can also use the npx command provided there to automatically set the minded 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:

  1. Create the .env file in your project root

  2. Add .env to your .gitignore file to keep credentials secure

  3. Never 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

Environment
NODE_ENV
MINDED_CLOUD
Description

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:

  1. Project Configuration - Set up your minded.json file

  2. Quick Start - Build your first agent

Last updated