langchain-reference-architecture
Implement LangChain reference architecture patterns for production. Use when designing LangChain systems, implementing scalable patterns, or architecting enterprise LLM applications. Trigger with phrases like "langchain architecture", "langchain design", "langchain scalable", "langchain enterprise", "langchain patterns".
- License 许可
- MIT
- 最近更新
- 2026-05-26
- Stars
- ★ 0
- Forks
- 0
01 前言 Front Matter
- name
- langchain-reference-architecture
- author
- Jeremy Longshore <jeremy@intentsolutions.io>
- license
- MIT
- version
- 1.0.0
- description
- Implement LangChain reference architecture patterns for production. Use when designing LangChain systems, implementing scalable patterns, or architecting enterprise LLM applications. Trigger with phrases like "langchain architecture", "langchain design", "langchain scalable", "langchain enterprise", "langchain patterns".
- allowed-tools
- Read, Write, Edit
- compatible-with
- claude-code, codex, openclaw
02 资源文件 1
- 参考文档references/implementation.md7.5 KB
03 SKILL.md 正文
LangChain Reference Architecture
Contents
Overview
Production-ready architectural patterns for building scalable, maintainable LangChain applications including layered architecture, provider abstraction, chain registry, RAG, and multi-agent orchestration.
Prerequisites
- Understanding of LangChain fundamentals
- Experience with software architecture
- Knowledge of cloud infrastructure
Instructions
Step 1: Adopt Layered Architecture
Organize code into API, core (business logic), infrastructure, and config layers. Each layer has clear responsibilities and dependencies flow inward.
Step 2: Implement Provider Abstraction
Use an LLMFactory with abstract LLMProvider classes to decouple from specific LLM vendors (OpenAI, Anthropic, etc.).
Step 3: Set Up Chain Registry
Create a ChainRegistry to manage named chains at runtime, enabling dynamic chain selection via API endpoints.
Step 4: Build RAG Architecture
Combine a retriever (vector store) with an LLM chain using RunnablePassthrough for context injection.
Step 5: Orchestrate Multi-Agent Systems
Use an AgentOrchestrator with LLM-based routing to dispatch requests to specialized agents.
Step 6: Use Configuration-Driven Design
Leverage pydantic_settings.BaseSettings for validated, environment-driven configuration.
See detailed implementation for complete code patterns and architecture diagrams.
Output
- Layered architecture with clear separation
- Provider abstraction for LLM flexibility
- Chain registry for runtime management
- Multi-agent orchestration pattern
Error Handling
| Issue | Cause | Solution |
|---|---|---|
| Circular dependencies | Wrong layering | Separate concerns strictly by layer |
| Provider not found | Missing registration | Check LLMFactory provider map |
| Chain not found | Unregistered chain | Register chains at startup |
Examples
Basic usage: Apply langchain reference architecture to a standard project setup with default configuration options.
Advanced scenario: Customize langchain reference architecture for production environments with multiple constraints and team-specific requirements.
Resources
Next Steps
Use langchain-multi-env-setup for environment management.
04 同仓库更多 Skills
zustand-store-ts
Create Zustand stores with TypeScript, subscribeWithSelector middleware, and proper state/action separation. Use when building React state management, creating global stores, or implementing reactive state patterns with Zustand.
zustand-store-creator
Zustand Store Creator - Auto-activating skill for Frontend Development. Triggers on: zustand store creator, zustand store creator Part of the Frontend Development skill category.
zero-trust-config-helper
Zero Trust Config Helper - Auto-activating skill for Security Advanced. Triggers on: zero trust config helper, zero trust config helper Part of the Security Advanced skill category.
zapier-integration-helper
Zapier Integration Helper - Auto-activating skill for Business Automation. Triggers on: zapier integration helper, zapier integration helper Part of the Business Automation skill category.
zai-cli
Execute z.AI CLI providing vision, search, reader, and GitHub exploration via CLI and MCP. Use when user needs image/video analysis, OCR, UI-to-code conversion, error diagnosis, real-time web search, web page to markdown extraction, or GitHub code exploration. Trigger with phrases like "analyze this image", "search the web for", "read this page", "explore this repo", or "use zai". Requires Z_AI_API_KEY.
yt-research
Research competitor YouTube channels, niches, and trending topics for your content strategy. Use this skill whenever the user says "research channels", "analyze competitors", "find trending topics", "niche analysis", "competitive research", "what are other creators doing", "scrape YouTube channels", or wants to understand the competitive landscape for a specific tool or topic area. Use when working with yt research. Trigger with 'yt', 'research'.