Index of every page on this site: llms.txt
All skills
jeremylongshore avatar

/langchain-local-dev-loop

@0d57af8
Run it yourself

Build a fast, deterministic local test loop for LangChain 1.0 / LangGraph 1.0 — FakeListChatModel fixtures, pytest config, VCR cassettes with key redaction, warning-filter policy. Use when adding tests to a new chain, fixing a flaky test, or making integration tests reproducible. Trigger with "langchain pytest", "FakeListChatModel", "VCR langchain", "langchain test fixtures", "langchain integration test".

Use this Skill: https://skilld.dev/gh/jeremylongshore/tons-of-skills-marketplace/langchain-local-dev-loop

Nothing lands on disk. Nothing to clean up.

Fork this Skill

Edit a local copy. It keeps the author and licence.

referencesone-pager.md

≈852 tokens on demand. Your agent reads this file only when SKILL.md points to it.

langchain-local-dev-loop — One-Pager

Build a fast, deterministic local test loop for LangChain 1.0 / LangGraph 1.0 — FakeListChatModel fixtures, pytest config, VCR cassettes with key redaction, warning-filter policy.

The Problem

An engineer writes assert chain.invoke(input).content == "expected" — it passes locally at temperature=0 against Claude but fails intermittently in CI, because Anthropic's temperature=0 still samples (P05). They switch to FakeListChatModel — now downstream token callbacks blow up with KeyError: 'token_usage' because the fake model emits no response_metadata (P43). They record a VCR cassette for an integration smoke test, and PR review flags Authorization: Bearer sk-ant-... committed into the fixture file (P44). On top of that, pytest collection itself fails before any test runs because langchain_community imports emit DeprecationWarning and the suite runs -W error (P45).

The Solution

This skill installs a four-layer local dev loop: (1) FakeListChatModel and FakeListLLM for deterministic unit tests, with a subclass that synthesizes response_metadata so downstream token counters keep working; (2) pytest fixtures that wire the fake model into chains, agents, retrievers, and embedders; (3) VCR cassettes for integration tests with filter_headers=["authorization","x-api-key","anthropic-version"] and a pre-commit hook grepping for sk-* / sk-ant-*; (4) pyproject.toml filterwarnings policy plus an @pytest.mark.integration gate that defaults-skips unless RUN_INTEGRATION=1. LangGraph tests use MemorySaver with a fixed thread_id per test and assert state shape per node. Pinned to LangChain 1.0.x / LangGraph 1.0.x / pytest current / vcrpy current.

Who / What / When

Aspect Details
Who Python engineers and researchers adding tests to a LangChain 1.0 / LangGraph 1.0 codebase — unit, integration, smoke, or load
What Fake-model fixtures (with metadata subclass), VCR cassette policy + key-leak pre-commit hook, pyproject.toml pytest/markers/filterwarnings skeleton, LangGraph per-test thread_id pattern, 4 references (fake-model-fixtures, vcr-cassette-hygiene, pytest-config, langgraph-test-patterns)
When Adding tests to a new chain or graph; fixing a flaky test caused by provider non-determinism; making an integration test reproducible without real API calls; wiring CI for deterministic runs

Key Features

  1. FakeListChatModel + metadata-emitting subclass — Deterministic responses cycled from a responses=[...] list; subclass overrides _generate to inject generation_info={"token_usage": {...}} so downstream callbacks reading response_metadata["token_usage"] keep working (P43 fix)
  2. VCR cassette hygiene — filter_headers config removes authorization / x-api-key / anthropic-version before any cassette is written, paired with a pre-commit hook that greps cassette files for sk- / sk-ant- and blocks the commit on a match (P44 fix)
  3. pyproject.toml pytest skeleton — filterwarnings = ["ignore::DeprecationWarning:langchain_community.*"] (P45 fix), markers = ["integration: requires RUN_INTEGRATION=1"], env-var gate that defaults-skips integration tests unless RUN_INTEGRATION=1, per-provider testpaths

Quick Start

See SKILL.md for full instructions.

Source: SKILL.md on GitHub

skilld matched fixed text patterns in SKILL.md and file names. Patterns miss obfuscated code.

skilld run checks every file with the same patterns. It asks for approval before it loads a Skill with a behavior marked Needs approval.

No alerts2mo3 checks · Risk SAFE
  • Gen Agent Trust Hub2mo

    This skill provides a comprehensive guide and configuration for building a deterministic local development loop for LangChain 1.0 and LangGraph 1.0. It focuses on using fake model fixtures to replace live API calls, configuring VCR to record and replay network interactions with automatic credential redaction, and setting up pytest with appropriate warning filters. A notable security feature is the inclusion of a pre-commit hook designed to prevent the accidental commit of API keys in VCR cassettes. No malicious patterns or security risks were detected.

  • Socket2mo

    No alerts

  • Snyk2mo

    Risk: LOW · No issues

Signed by skilld at 0d57af8. This ties the file your Agent reads to that commit on GitHub. It does not review the instructions.

Last checked against GitHub yesterday.

Activeupdated 2 months ago
What it can do
Reads files Edits files Runs commands
version
2.7.0
author
Jeremy Longshore <jeremy@intentsolutions.io>
compatibility
Designed for Claude Code
All 6 allowed tools
ReadWriteEditBash(pytest:*)Bash(python:*)Bash(pip:*)
Other metadata
tags
[
  "saas",
  "langchain",
  "langgraph",
  "python",
  "langchain-1.0",
  "testing",
  "pytest",
  "vcr"
]

README badge

README badge for jeremylongshore/tons-of-skills-marketplace/langchain-local-dev-loop