Agent skill · software engineering · jeremylongshore

langchain-core-workflow

Compose LangChain 1.0 chains with RunnableParallel, RunnableBranch,\n\

Why this skill is useful

Provides domain-specific knowledge on LangChain 1.0 composition patterns and error handling that the AI wouldn't reliably generate on its own.

What it needs

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

What this skill does

LangChain Core Workflow (Python) Overview An engineer wires a four-stage LCEL chain: classify the question, retrieve context, format the prompt, invoke the LLM. It looks clean: The call returns this: Nothing in that stack says which stage produced the wrong dict shape. The RunnablePassthrough.assign(docs=retriever) call silently rebuilt the dict and — because retriever was itself a Runnable[str, list[Document]] that took the question string, not the dict — a mis-piped intermediate value overwrote the question key. The prompt template expected {question} and blew up. This is P06 in the pack's pain catalog: .pipe() on mismatched dict shape raises KeyError deep in runnable internals with no hint at the offending stage. The fix is two patterns you install once and never remove: 1. Debug probes — a RunnableLambda that logs dict keys between every two stages. <1ms overhead per invocation. Surfaces the exact stage that mutates the shape. 2. Typed composition — annotate each chain with RunnableSerializable[InputT, OutputT] plus pydantic BaseModel types so mypy flags the mismatch at lint time instead of at .invoke(). Meanwhile, a second trap waits for anyone tempted to wrap tool-using chains in the legacy AgentExecutor: it silently swallows intermediate tool errors as empty-string observations and the agent cheerfully answers "I couldn't find the answer" (P09). For agent loops in LangChain 1.0, skip AgentExecutor and use LangGraph's createreactagent — errors raise, not vanish. This skill cross-references langchain-langgraph-agents (L26) for that path. Composition primitives covered — with input/output shapes and use cases — are RunnableParallel (fan-out, 2–3× wall-clock win on 2 independent retrievals), RunnableBranch (conditional routing with mandatory default), RunnablePassthrough.assign (merge computed fields without losing input), and RunnableLambda (arbitrary Python, used here for debug probes and shape assertions). Pin: langchain-core 1.0.x. …

How to use it

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

@skills jeremylongshore/langchain-core-workflow--1a0d56

View the source on GitHub

Browse the @skills marketplace