langchain-ci-integration
Configure LangChain CI/CD integration with GitHub Actions and testing. Use when setting up automated testing, configuring CI pipelines, or integrating LangChain tests into your build process. Trigger with phrases like "langchain CI", "langchain GitHub Actions", "langchain automated tests", "CI langchain", "langchain pipeline".
Install
mkdir -p .claude/skills/langchain-ci-integration && curl -L -o skill.zip "https://mcp.directory/api/skills/download/3063" && unzip -o skill.zip -d .claude/skills/langchain-ci-integration && rm skill.zipInstalls to .claude/skills/langchain-ci-integration
About this skill
LangChain CI Integration
Overview
CI/CD pipeline for LangChain applications: mocked unit tests (free, fast), gated integration tests with real LLMs (costs money, slow), RAG pipeline validation, and LangSmith trace integration.
GitHub Actions Workflow
# .github/workflows/langchain-tests.yml
name: LangChain Tests
on:
pull_request:
paths: ["src/**", "tests/**", "package.json"]
jobs:
unit-tests:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with: { node-version: "20" }
- run: npm ci
- name: Unit tests (no API calls)
run: npx vitest run tests/unit/ --reporter=verbose
integration-tests:
runs-on: ubuntu-latest
if: github.event.pull_request.draft == false
needs: unit-tests
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with: { node-version: "20" }
- run: npm ci
- name: Integration tests (real LLM calls)
env:
OPENAI_API_KEY: ${{ secrets.OPENAI_API_KEY }}
LANGSMITH_TRACING: "true"
LANGSMITH_API_KEY: ${{ secrets.LANGSMITH_API_KEY }}
LANGSMITH_PROJECT: "ci-${{ github.run_id }}"
run: npx vitest run tests/integration/ --reporter=verbose
typecheck:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with: { node-version: "20" }
- run: npm ci
- run: npx tsc --noEmit
Unit Tests: Mocked LLM (Free, Fast)
// tests/unit/chains.test.ts
import { describe, it, expect } from "vitest";
import { FakeListChatModel } from "@langchain/core/utils/testing";
import { ChatPromptTemplate } from "@langchain/core/prompts";
import { StringOutputParser } from "@langchain/core/output_parsers";
describe("Summarize Chain", () => {
const fakeLLM = new FakeListChatModel({
responses: ["Summary: LangChain enables LLM app development."],
});
it("produces output from prompt -> model -> parser", async () => {
const chain = ChatPromptTemplate.fromTemplate("Summarize: {text}")
.pipe(fakeLLM)
.pipe(new StringOutputParser());
const result = await chain.invoke({ text: "Long document..." });
expect(result).toContain("LangChain");
});
it("passes correct variables to prompt", () => {
const prompt = ChatPromptTemplate.fromTemplate("Translate {text} to {lang}");
expect(prompt.inputVariables).toContain("text");
expect(prompt.inputVariables).toContain("lang");
});
});
Unit Tests: Tool Validation
// tests/unit/tools.test.ts
import { describe, it, expect } from "vitest";
import { calculator, searchTool } from "../../src/tools";
describe("Calculator Tool", () => {
it("evaluates valid expressions", async () => {
expect(await calculator.invoke({ expression: "10 * 5" })).toBe("50");
});
it("returns error for invalid input", async () => {
const result = await calculator.invoke({ expression: "abc" });
expect(result).toContain("Error");
});
it("has correct metadata", () => {
expect(calculator.name).toBe("calculator");
expect(calculator.description).toBeTruthy();
});
});
Integration Tests: RAG Pipeline
// tests/integration/rag.test.ts
import { describe, it, expect } from "vitest";
import { ChatOpenAI, OpenAIEmbeddings } from "@langchain/openai";
import { MemoryVectorStore } from "langchain/vectorstores/memory";
import { ChatPromptTemplate } from "@langchain/core/prompts";
import { StringOutputParser } from "@langchain/core/output_parsers";
import { RunnableSequence, RunnablePassthrough } from "@langchain/core/runnables";
describe.skipIf(!process.env.OPENAI_API_KEY)("RAG Pipeline", () => {
it("retrieves relevant documents and answers correctly", async () => {
const embeddings = new OpenAIEmbeddings({ model: "text-embedding-3-small" });
const store = await MemoryVectorStore.fromTexts(
[
"LangChain was created by Harrison Chase in 2022.",
"LCEL stands for LangChain Expression Language.",
"Pinecone is a vector database for AI applications.",
],
[{}, {}, {}],
embeddings
);
const retriever = store.asRetriever({ k: 2 });
const model = new ChatOpenAI({ model: "gpt-4o-mini", temperature: 0 });
const prompt = ChatPromptTemplate.fromTemplate(
"Context: {context}\n\nQuestion: {question}\nAnswer:"
);
const chain = RunnableSequence.from([
{
context: retriever.pipe((docs) => docs.map((d) => d.pageContent).join("\n")),
question: new RunnablePassthrough(),
},
prompt,
model,
new StringOutputParser(),
]);
const answer = await chain.invoke("Who created LangChain?");
expect(answer.toLowerCase()).toContain("harrison");
});
it("handles questions outside context gracefully", async () => {
// Test that RAG doesn't hallucinate
const embeddings = new OpenAIEmbeddings({ model: "text-embedding-3-small" });
const store = await MemoryVectorStore.fromTexts(
["TypeScript is maintained by Microsoft."],
[{}],
embeddings
);
const retriever = store.asRetriever({ k: 1 });
const model = new ChatOpenAI({ model: "gpt-4o-mini", temperature: 0 });
const prompt = ChatPromptTemplate.fromTemplate(
"Based ONLY on this context, answer the question. Say 'I don't know' if not found.\n\nContext: {context}\n\nQuestion: {question}"
);
const chain = RunnableSequence.from([
{
context: retriever.pipe((docs) => docs.map((d) => d.pageContent).join("\n")),
question: new RunnablePassthrough(),
},
prompt,
model,
new StringOutputParser(),
]);
const answer = await chain.invoke("What is the capital of France?");
expect(answer.toLowerCase()).toMatch(/don.t know|not (in|found)|no information/);
});
});
Cost Control in CI
# Gate integration tests behind PR labels or manual trigger
integration-tests:
if: |
github.event.pull_request.draft == false &&
contains(github.event.pull_request.labels.*.name, 'test:integration')
Error Handling
| Issue | Cause | Fix |
|---|---|---|
| Unit tests call real API | Didn't use FakeListChatModel | Replace ChatOpenAI with fake in tests |
| Integration test missing key | Secret not configured | Add OPENAI_API_KEY to repo secrets |
| Flaky RAG test | Embedding variability | Use deterministic data, set temperature: 0 |
| CI timeout | Model latency | Set timeout: 15000 on test, use gpt-4o-mini |
Resources
Next Steps
For deployment, see langchain-deploy-integration.
More by jeremylongshore
View all skills by jeremylongshore →You might also like
flutter-development
aj-geddes
Build beautiful cross-platform mobile apps with Flutter and Dart. Covers widgets, state management with Provider/BLoC, navigation, API integration, and material design.
drawio-diagrams-enhanced
jgtolentino
Create professional draw.io (diagrams.net) diagrams in XML format (.drawio files) with integrated PMP/PMBOK methodologies, extensive visual asset libraries, and industry-standard professional templates. Use this skill when users ask to create flowcharts, swimlane diagrams, cross-functional flowcharts, org charts, network diagrams, UML diagrams, BPMN, project management diagrams (WBS, Gantt, PERT, RACI), risk matrices, stakeholder maps, or any other visual diagram in draw.io format. This skill includes access to custom shape libraries for icons, clipart, and professional symbols.
ui-ux-pro-max
nextlevelbuilder
"UI/UX design intelligence. 50 styles, 21 palettes, 50 font pairings, 20 charts, 8 stacks (React, Next.js, Vue, Svelte, SwiftUI, React Native, Flutter, Tailwind). Actions: plan, build, create, design, implement, review, fix, improve, optimize, enhance, refactor, check UI/UX code. Projects: website, landing page, dashboard, admin panel, e-commerce, SaaS, portfolio, blog, mobile app, .html, .tsx, .vue, .svelte. Elements: button, modal, navbar, sidebar, card, table, form, chart. Styles: glassmorphism, claymorphism, minimalism, brutalism, neumorphism, bento grid, dark mode, responsive, skeuomorphism, flat design. Topics: color palette, accessibility, animation, layout, typography, font pairing, spacing, hover, shadow, gradient."
godot
bfollington
This skill should be used when working on Godot Engine projects. It provides specialized knowledge of Godot's file formats (.gd, .tscn, .tres), architecture patterns (component-based, signal-driven, resource-based), common pitfalls, validation tools, code templates, and CLI workflows. The `godot` command is available for running the game, validating scripts, importing resources, and exporting builds. Use this skill for tasks involving Godot game development, debugging scene/resource files, implementing game systems, or creating new Godot components.
nano-banana-pro
garg-aayush
Generate and edit images using Google's Nano Banana Pro (Gemini 3 Pro Image) API. Use when the user asks to generate, create, edit, modify, change, alter, or update images. Also use when user references an existing image file and asks to modify it in any way (e.g., "modify this image", "change the background", "replace X with Y"). Supports both text-to-image generation and image-to-image editing with configurable resolution (1K default, 2K, or 4K for high resolution). DO NOT read the image file first - use this skill directly with the --input-image parameter.
fastapi-templates
wshobson
Create production-ready FastAPI projects with async patterns, dependency injection, and comprehensive error handling. Use when building new FastAPI applications or setting up backend API projects.
Related MCP Servers
Browse all serversPica is automated workflow software for business process automation, integrating actions across services via a unified i
Search 2025 Korean tax law amendment PDFs with natural language — fast tax document NLP search using ChromaDB, LangChain
Boost your AI code assistant with Context7: inject real-time API documentation from OpenAPI specification sources into y
Boost productivity with Task Master: an AI-powered tool for project management and agile development workflows, integrat
Connect Blender to Claude AI for seamless 3D modeling. Use AI 3D model generator tools for faster, intuitive, interactiv
Integrate FireCrawl for advanced web scraping to extract clean, structured data from complex websites—fast, scalable, an
Stay ahead of the MCP ecosystem
Get weekly updates on new skills and servers.