agentleFS
belos-streetbelos-street/grimoire/skills/langchain/skill.md

langchain

Skill8 starsChanged 3 months agoMITView on GitHub

LangChain framework for building AI agents and LLM applications with tools, memory, and streaming support

17 other projects use a version of this.

Adopted by

Most recently taken up by

Used with

Projects with it also use analytics-metrics, aws-account-management and 9 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.
  • hoodiniSkill

    analytics-metrics

    Build data visualization and analytics dashboards. Use when creating charts, KPI displays, metrics dashboards, or data visualization components. Triggers on analytics, dashboard, charts, metrics, KPI, data visualization, Recharts.

    Also in 3 projects that use this

  • hoodiniSkill

    aws-account-management

    Manage AWS accounts, organizations, IAM, and billing. Use when setting up AWS Organizations, managing IAM policies, controlling costs, or implementing multi-account strategies. Triggers on AWS Organizations, AWS IAM, AWS billing, Cost Explorer, SCPs, multi-account, AWS SSO, Identity Center.

    Also in 3 projects that use this

  • MongoDBSkill

    mongodb

    Front door for MongoDB and MongoDB Atlas. Use it before answering which database, MongoDB deployment, Atlas tier, or database hosting to use, even for advice-only questions. MongoDB updates frequently, so check this skill first. Also use it before setting up, provisioning, or connecting to MongoDB or Atlas, or creating a throwaway or prototype database. Also use when the user mentions "MongoDB", "Atlas", "MongoDB quickstart", "document database", "NoSQL", "BSON", "Mongoose", "PyMongo", "RAG", "Vector Search", "aggregation pipeline", "change streams", or "backend", and for general MongoDB development questions (CRUD, transactions, drivers and ODMs, server versions) from current docs. If a more specific MongoDB skill is installed and matches the task (schema design, query writing or optimization, search and vector search, stream processing, connection tuning, MCP server setup, queryable encryption sizing), load that instead; if it isn't installed, use this skill, which routes to it.

    Also in 3 projects that use this

  • imehrSkill

    railway

    Railway.com deployment and management - deployment, logs, migrations, troubleshooting, monorepo strategies, security, and CLI reference. Use when deploying to Railway, configuring services, managing environment variables, or debugging deployment issues.

    Also in 3 projects that use this

  • +7 more from hoodini

The file

We split this skill into the rules it gives an agent

4 rules. 0 are common, 3 are distinctive, and 1 is very specific to this project.

  • 0

    Common

    Most of the 13 edited versions we read keep these.

  • 3

    Distinctive

    This author's own choices. Worth a look.

  • 1

    Very specific

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

  • Common
  • Distinctive
  • Very specific
  1. Very specific:

    Use create_agent as the unified interface for creating agents

    line 18
  2. Distinctive:

    Prefer structured output for reliable data extraction

    line 19
  3. Distinctive:

    Always implement error handling for production agents

    line 20
  4. Distinctive:

    Use streaming for better user experience

    line 21

“Common” is measured: kept by at least 6 in 10 of the 13 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

LangChain is the easy way to build custom agents and applications powered by LLMs. With under 10 lines of code, you can connect to OpenAI, Anthropic, Google, and more.

Preferences

  • Use create_agent as the unified interface for creating agents
  • Prefer structured output for reliable data extraction
  • Always implement error handling for production agents
  • Use streaming for better user experience
  • Leverage middleware for cross-cutting concerns

Core Components

TopicDescriptionReference
AgentsCore agent architecture with create_agentagents-basics.md
ModelsModel integration (OpenAI, Anthropic, etc.)models-integration.md
MessagesMessage formats and conversation structuremessages-format.md
ToolsTool definition and dynamic tool selectionagents-tools.md
MemoryShort-term and conversation memorymemory-short-term.md
StreamingStreaming output for real-time responsesstreaming-output.md
Structured OutputStructured data extraction from LLMsstructured-output.md

Middleware

TopicDescriptionReference
Middleware OverviewMiddleware architecture and patternsmiddleware-overview.md
Human-in-the-LoopAdd human intervention to agentsmiddleware-human-in-loop.md

Additional Features

TopicDescriptionReference
Prompt TemplatesReusable prompt templatesprompt-templates.md
RAG BasicsRetrieval Augmented Generationrag-basics.md
Error HandlingProduction error handling patternserror-handling.md

Quick Reference

Basic Agent

from langchain.agents import create_agent

def get_weather(city: str) -> str:
    """Get weather for a given city."""
    return f"It's always sunny in {city}!"

agent = create_agent(
    model="claude-sonnet-4-6",
    tools=[get_weather],
    system_prompt="You are a helpful assistant",
)

result = agent.invoke(
    {"messages": [{"role": "user", "content": "what is the weather in sf"}]}
)

Agent with Model Instance

from langchain.agents import create_agent
from langchain_openai import ChatOpenAI

model = ChatOpenAI(
    model="gpt-4",
    temperature=0.1,
    max_tokens=1000,
    timeout=30
)

agent = create_agent(model, tools=[get_weather])

Streaming Agent

from langchain.agents import create_agent

agent = create_agent(
    model="gpt-4",
    tools=[get_weather],
    streaming=True
)

async for chunk in agent.stream({"messages": [...]}):
    print(chunk.content, end="", flush=True)

Structured Output

from pydantic import BaseModel
from langchain.agents import create_agent

class WeatherReport(BaseModel):
    city: str
    temperature: float
    condition: str

agent = create_agent(
    model="gpt-4",
    output_schema=WeatherReport
)

result = agent.invoke({"messages": [...]})
weather = result.structured_output

Key Imports

from langchain.agents import create_agent
from langchain.tools import tool
from langchain_openai import ChatOpenAI
from langchain_anthropic import ChatAnthropic
from langchain.agents.middleware import (
    wrap_model_call,
    SummarizationMiddleware,
    HumanInTheLoopMiddleware
)

Official Documentation

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.