Agent skill · software engineering · jeremylongshore

langchain-sdk-patterns

Compose LangChain 1.0 Python runnables with the production defaults

Why this skill is useful

Provides specific patterns and configurations for LangChain 1.0 that enhance AI capabilities in handling runnables and error management.

What it needs

Requires langchain-anthropic, langchain-core, langchain-openai, pydantic, python installed locally. About 7k tokens when loaded. Last updated 2026-08-07. 2,604 stars on the source repository.

What this skill does

LangChain SDK Patterns (Python) Overview chain.batch(inputs) in LangChain 1.0 does not parallelize by default. The maxconcurrency parameter defaults to 1 in several provider packages (notably older langchain-openai), so a call like chain.batch(inputs1000) runs 1,000 sequential round-trips — same wall-clock time as a for loop, plus the overhead of the batch machinery. Users file "batch is slow" tickets, benchmark it against asyncio, and move to a different framework — when the fix is two lines: Then three more traps wait: P07 — .withfallbacks([backup]) defaults exceptionstohandle=(Exception,), and on Python <3.12 that tuple includes KeyboardInterrupt. A Ctrl+C during a long run does not stop the process — it silently hands off to the fallback chain and keeps billing. P57 — ChatPromptTemplate.frommessages(..., templateformat="f-string") (the default) parses every { in every string, including user input. A user who pastes {"error": "..."} raises KeyError: 'error' at invoke time. P53 — Pydantic v2 rejects extra fields by default; models cheerfully add summary or confidence to your Plan schema and withstructuredoutput crashes with ValidationError: extra fields not permitted. This skill walks through LCEL composition (RunnableSequence, RunnableParallel, RunnableBranch, RunnablePassthrough, RunnableLambda); the correct exceptionstohandle whitelist per provider; maxconcurrency tuning with safe ceilings (10 for most providers, 20+ with a semaphore); and prompt templates that survive untrusted input. Pin: langchain-core 1.0.x, langchain-anthropic 1.0.x, langchain-openai 1.0.x. Pain-catalog anchors: P07, P08, P53, P57. …

How to use it

Reference it in AdaL, Claude Code, Cursor or any coding agent — nothing to install:

@skills jeremylongshore/langchain-sdk-patterns

View the source on GitHub

Browse the @skills marketplace