agentleFS
HarambeeAIHarambeeAI/bayes-ship/skills/langchain-fundamentals/SKILL.md

langchain-fundamentals

Skill1 starsChanged 7 months agoMITView on GitHub

Build agents with LangChain's create_agent, tools, structured output, and middleware. Use when implementing AI agent features with the LangChain framework. Covers tool calling, agent loops, and integration patterns.

6 other projects use a version of this.

Adopted by

Most recently taken up by

Used with

Projects with it also use managed-deep-agents, deepagents-python-quickstart and 4 more.

Other files people use alongside this one.

Files found in the same public projects as a version of this one, more often than they turn up anywhere else. Each project counts once, large collections count for less, and this file's own repository is left out.
  • LangChainSkill

    managed-deep-agents

    INVOKE THIS SKILL when building, testing, or deploying Managed Deep Agents in LangSmith. Walks a user through their first agent end to end — interviewing them about what they want to build, mapping it onto what MDA can actually do, then scaffolding and deploying it. Covers the file-based project layout; define_deep_agent / defineDeepAgent; instructions, skills, memory, identity, tools, MCP servers, connections, middleware, sandboxes, schedules, channels, and evals; the mda CLI; GitHub deployments; and Context Hub.

    Also in 4 projects that use this

  • LangChainSkill

    deepagents-python-quickstart

    Scaffold a minimal local Deep Agent in Python by following the official quickstart, using provider-native web search instead of Tavily. Use when the user wants to quickly build or try a Deep Agent locally.

    Also in 3 projects that use this

  • +4 more from langchain-ai

The file

We split this skill into the rules it gives an agent

2 rules. 0 are common, 2 are distinctive, and 0 are very specific to this project.

  • 0

    Common

    Most of the 5 edited versions we read keep these.

  • 2

    Distinctive

    This author's own choices. Worth a look.

  • 0

    Very specific

    Tied to their project's names, files or tools. Probably skip.

  • Common
  • Distinctive
  • Very specific
  1. Distinctive:

    When building AI-powered features that require tool-calling agents, structured LLM output, or LangChain middleware patterns.

    line 9
  2. Distinctive:

    Always prefer LCEL for chains:

    line 56

“Common” is measured: kept by at least 6 in 10 of the 5 edited versions of this file we could read. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.

Keep what fits and drop the rest. Your version, ready for your agents.
Files
SKILL.md

LangChain Fundamentals

When to use

When building AI-powered features that require tool-calling agents, structured LLM output, or LangChain middleware patterns. Applicable during execution phase tasks tagged with AI/agent functionality.

Core patterns

Agent creation (Python)

from langchain_anthropic import ChatAnthropic
from langchain.agents import create_agent

llm = ChatAnthropic(model="claude-sonnet-4-20250514")
agent = create_agent(
    model=llm,
    tools=[tool_a, tool_b],
    system_prompt="You are a helpful assistant."
)
result = agent.invoke({"messages": [{"role": "user", "content": "..."}]})

Tool definition

from langchain_core.tools import tool

@tool
def search_database(query: str) -> str:
    """Search the product database. Use when user asks about products."""
    # Implementation
    return results

Structured output

from pydantic import BaseModel

class Analysis(BaseModel):
    summary: str
    key_points: list[str]
    confidence: float

structured_llm = llm.with_structured_output(Analysis)
result = structured_llm.invoke("Analyze this document...")

LCEL (LangChain Expression Language)

Always prefer LCEL for chains:

from langchain_core.runnables import RunnablePassthrough

chain = (
    {"context": retriever, "question": RunnablePassthrough()}
    | prompt
    | llm
    | output_parser
)

Dependencies

langchain>=0.3
langchain-anthropic>=0.3
langchain-core>=0.3

Reference

Download now (ZIP)

Does it work?

Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.

No reviews yet

People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.

  • It worked
  • Partly
  • It didn't
What did you use it for? e.g. Reviewing pull requests in a Rails app

Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.

Your trail

Files you open will collect here, so you can find them again.

Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.

Now do this for your own.

Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.