Loading...
Loading...
Guide for adding new environment variables to the codebase. Ensures env.ts schemas include descriptions and .env.example is kept in sync. Triggers on: add env variable, new environment variable, env.ts change, add config variable, INKEEP_, adding to .env.
npx skill4agent add inkeep/agents adding-env-variablescheck:env-descriptionsenv.ts.describe()pnpm check:env-descriptionsenv.ts| Package | File | Purpose |
|---|---|---|
| agents-api | | Main API server configuration |
| agents-core | | Shared core configuration |
| agents-cli | | CLI tool configuration |
packages/agents-mcp/src/lib/env.ts.env.example.env.example# ============ SECTION NAME ============
# Description of what this variable does
# Additional context if needed (e.g., where to get API keys)
MY_NEW_VARIABLE=default-value-or-empty# ============ AI PROVIDERS ============
# Required for agent execution
# Get your API keys from:
# Anthropic: https://console.anthropic.com/
# OpenAI: https://platform.openai.com/
ANTHROPIC_API_KEY=
OPENAI_API_KEY=env.ts.describe().env.exampleconst envSchema = z.object({
// ... existing variables ...
MY_NEW_VARIABLE: z
.string()
.optional()
.describe('Description of what this variable does'),
});.describe().env.example// AI Provider keys
ANTHROPIC_API_KEY: z
.string()
.describe('Anthropic API key for Claude models (required for agent execution). Get from https://console.anthropic.com/'),
// Database configuration
INKEEP_AGENTS_MANAGE_DATABASE_URL: z
.string()
.describe('PostgreSQL connection URL for the management database (Doltgres with Git version control)'),
// Authentication
BETTER_AUTH_SECRET: z
.string()
.optional()
.describe('Secret key for Better Auth session encryption (change in production)'),
// Feature flags
LANGFUSE_ENABLED: z
.string()
.optional()
.transform((val) => val === 'true')
.describe('Enable Langfuse LLM observability (set to "true" to enable)'),MY_REQUIRED_VAR: z
.string()
.describe('This variable is required for the application to function'),MY_OPTIONAL_VAR: z
.string()
.optional()
.describe('Optional configuration for feature X'),MY_VAR_WITH_DEFAULT: z
.string()
.optional()
.default('default-value')
.describe('Configuration with a sensible default'),LOG_LEVEL: z
.enum(['trace', 'debug', 'info', 'warn', 'error'])
.default('info')
.describe('Logging verbosity level'),POOL_SIZE: z
.coerce.number()
.optional()
.default(10)
.describe('Maximum number of connections in the pool'),FEATURE_ENABLED: z
.string()
.optional()
.transform((val) => val === 'true')
.describe('Enable feature X (set to "true" to enable)'),JWT_SECRET: z
.string()
.min(32, 'JWT_SECRET must be at least 32 characters')
.optional()
.describe('Secret key for signing JWT tokens (minimum 32 characters)'),
ADMIN_EMAIL: z
.string()
.optional()
.refine((val) => !val || /^[^\s@]+@[^\s@]+\.[^\s@]+$/.test(val), {
message: 'Invalid email address',
})
.describe('Admin email address for notifications'),.env.exampleenv.ts.env.example# ============ DATABASE ============
INKEEP_AGENTS_MANAGE_DATABASE_URL=...
INKEEP_AGENTS_RUN_DATABASE_URL=...
# ============ AI PROVIDERS ============
ANTHROPIC_API_KEY=
OPENAI_API_KEY=env.tsconst envSchema = z.object({
// Database
INKEEP_AGENTS_MANAGE_DATABASE_URL: z
.string()
.describe('PostgreSQL connection URL for the management database'),
INKEEP_AGENTS_RUN_DATABASE_URL: z
.string()
.describe('PostgreSQL connection URL for the runtime database'),
// AI Providers
ANTHROPIC_API_KEY: z
.string()
.describe('Anthropic API key for Claude models'),
OPENAI_API_KEY: z
.string()
.optional()
.describe('OpenAI API key for GPT models'),
});env.ts| Use Case | File |
|---|---|
| API server configuration | |
| Shared across packages | |
| CLI-specific | |
| Multiple packages | Add to |
.env.exampleenv.ts.describe().env.exampleoptional()default()pnpm check:env-descriptions.describe().env.example.describe()agents-mcp