Overview
Composio SDK can be configured using environment variables, allowing you to manage settings across different environments (development, staging, production) without changing code.Core Environment Variables
COMPOSIO_API_KEY
Your Composio API key for authentication.COMPOSIO_BASE_URL
Custom API base URL for self-hosted or regional deployments.https://backend.composio.dev
Usage:
COMPOSIO_LOG_LEVEL
Control the verbosity of SDK logs.silent, error, warn, info, debug
Default: info
Usage:
COMPOSIO_DISABLE_TELEMETRY
Disable anonymous usage telemetry.true, false
Default: false
Usage:
Toolkit Version Variables
Set specific versions for toolkits to ensure consistent behavior across deployments.Format
Examples
Usage
Override in Code
Development vs Production
Development Environment
Production Environment
Loading Environment Variables
Using dotenv (Node.js)
Multiple Environment Files
Vercel/Next.js
Docker
Kubernetes
Environment Variable Validation
Validate required environment variables at startup:Type-Safe Environment Variables
Use TypeScript for type safety:Environment Configuration Helper
Best Practices
Never Commit Secrets
Add
.env files to .gitignore and use secret management for production.Use Specific Versions
Pin toolkit versions in production to prevent breaking changes.
Validate Early
Validate environment variables at application startup to fail fast.
Document Variables
Maintain a
.env.example file documenting all environment variables.Example .env.example
Troubleshooting
Variables Not Loading
Version Not Applied
Precedence Order
Configuration precedence (highest to lowest):- Explicitly passed to SDK constructor
- Environment variables
- SDK defaults
Next Steps
Tool Execution
Use configured toolkit versions in tool execution
Error Handling
Configure error logging levels
Authentication Flows
Set up authentication with environment-based configuration
Custom Tools
Create custom tools with environment-aware settings