langchain-multi-env-setup

Featured

Configure LangChain across dev/staging/production environments with isolated API keys, environment-specific settings, and secrets. Trigger: "langchain environments", "langchain staging", "langchain dev prod", "environment configuration", "langchain env setup".

AI & Automation 2,926 stars 433 forks Updated yesterday MIT

Install

View on GitHub

Quality Score: 99/100

Stars 20%
100
Recency 20%
100
Frontmatter 20%
70
Documentation 15%
100
Issue Health 10%
50
License 10%
100
Description 5%
100

Skill Content

# LangChain Multi-Environment Setup ## Overview Configure LangChain across development, staging, and production with separate API keys, environment-specific model settings, LangSmith project isolation, and validated configuration. ## Environment Strategy | Environment | API Key Source | Model | LangSmith Project | Cache | |-------------|---------------|-------|-------------------|-------| | Development | `.env.local` | gpt-4o-mini | `dev-{user}` | Off | | Staging | CI secrets | gpt-4o-mini | `staging` | Redis | | Production | Secret Manager | gpt-4o | `production` | Redis | ## Step 1: Configuration with Zod Validation ```typescript // config/langchain.ts import { z } from "zod"; import "dotenv/config"; const EnvironmentSchema = z.enum(["development", "staging", "production"]); const ConfigSchema = z.object({ environment: EnvironmentSchema, openaiApiKey: z.string().min(1, "OPENAI_API_KEY is required"), model: z.string().default("gpt-4o-mini"), temperature: z.number().min(0).max(2).default(0), maxRetries: z.number().default(3), timeout: z.number().default(30000), langsmith: z.object({ enabled: z.boolean(), apiKey: z.string().optional(), project: z.string(), }), cache: z.object({ enabled: z.boolean(), ttlSeconds: z.number().default(300), }), }); export type LangChainConfig = z.infer<typeof ConfigSchema>; function detectEnvironment(): z.infer<typeof EnvironmentSchema> { const env = process.env.NODE_ENV ?? "development"; if (en...

Details

Author
jeremylongshore
Repository
jeremylongshore/claude-code-plugins-plus-skills
Created
1 years ago
Last Updated
yesterday
Language
Python
License
MIT

Integrates with

Bundled in these plugins

Similar Skills

Semantically similar based on skill content — not just same category