Overview
Environment variables are used to configure your agent without hardcoding sensitive information. RunAgent provides secure methods for managing environment variables across development and production.Local Development
Using .env Files
Create a.env
file in your project root:
Best Practices
-
Never commit .env files
-
Provide .env.example
-
Validate required variables
Configuration in runagent.config.json
Dynamic Substitution
Use${VAR_NAME}
syntax for runtime substitution:
Variable Types
-
Dynamic variables - Loaded from environment
-
Static values - Hardcoded (non-sensitive only)
-
With defaults (coming soon)
Production Deployment
Setting Variables
When deploying, set environment variables:Security Best Practices
-
Use secret management services
- AWS Secrets Manager
- Google Secret Manager
- Azure Key Vault
- HashiCorp Vault
-
Rotate keys regularly
- Set expiration reminders
- Use versioned secrets
- Update without downtime
-
Limit scope
- Use read-only credentials where possible
- Create service-specific API keys
- Apply principle of least privilege
Common Patterns
Configuration Classes
Environment-Specific Settings
Validation
Special Variables
RunAgent System Variables
Variable | Description | Default |
---|---|---|
RUNAGENT_LOG_LEVEL | Logging level | INFO |
RUNAGENT_TIMEOUT | Request timeout | 30 |
RUNAGENT_MAX_RETRIES | Retry attempts | 3 |
Framework-Specific
Troubleshooting
Variable Not Found
Loading Order
- System environment variables
.env
file (local development)- RunAgent configuration (deployment)
- Runtime overrides
Common Issues
-
Quotes in .env files
-
Spaces around equals
-
Multiline values
See Also
- Configuration File - Config structure
- Security Best Practices - Production security
- Local Development - Development setup