Index of every page on this site: llms.txt
All skills
langchain-ai avatar

/langchain-fundamentals

@7a385cd official
Run it yourself

Retired skill, replaced by `langchain-build-agent`. Use for building agents with LangChain create_agent, tools, and models: it tells you to switch to `langchain-build-agent`.

Use this Skill: https://skilld.dev/gh/langchain-ai/langchain-skills/langchain-fundamentals

Nothing lands on disk. Nothing to clean up.

Fork this Skill

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

SKILL.md

≈50 tokens for metadata: the name and description. ≈123 when used: this file.

Description uses 2.5% of example budget

Before choosing a Skill, your Agent reads its name and description. All available Skills share that space.

  • A shorter description leaves more room for other Skills. This entry exceeds our 1% size suggestion.

In our Claude Code example, all Skill names and descriptions share 8,000 characters. This Skill uses ≈199 characters, or 2.5%.

The 1% threshold is a size suggestion. Longer descriptions can still fit.

Your model, settings, and other Skills decide how much text your Agent can read.

Example settings and source

The example uses a 200k-token context and default Claude Code settings. The count includes the name, description, separators, and when_to_use when present. Codex also counts local file paths.

Skit's source and limits: Codex 0.160.1, Claude Code 2.1.292.

langchain-fundamentals (retired)

langchain-fundamentals was retired from langchain-skills. Use the langchain-build-agent skill instead.

  1. If langchain-build-agent is available, use it for this task.

  2. Otherwise, install it, then use it:

    npx skills add langchain-ai/langchain-skills --skill langchain-build-agent --yes
  3. Tell the user that langchain-fundamentals is retired and that they can remove it with npx skills remove langchain-fundamentals.

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.

1 alerttoday5 checks · Risk SAFE
  • Gen Agent Trust Hub1d

    This skill is a retired placeholder that provides instructions for migrating to a newer skill. It includes a command to install the updated version from the vendor's repository, which is part of standard software maintenance.

  • Sockettoday

    No alerts

  • Snyk1d

    Risk: CRITICAL · 1 issue

  • Runlayer8mo

    1/1 file flagged

  • ZeroLeaks7mo

    1 finding · Score: 86/100

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

Last checked against GitHub yesterday.

Activeupdated yesterday
metadata
{
  "internal": "true"
}
  • Python
  • TypeScript
  • langchain
  • agents
  • llm
  • tools
  • middleware
  • human-in-the-loop
  • state-persistence
  • structured-output

README badge

README badge for langchain-ai/langchain-skills/langchain-fundamentals

Build production LangChain agents using `create_agent()`, the `@tool` decorator, and middleware patterns for human approval and error handling. This skill covers agent configuration with Claude or GPT models, tool definition, state persistence with checkpointers, and structured output validation.

Generated from the current SKILL.md.

Do I need to use create_agent() or are there alternatives?
create_agent() is the recommended and current way to build LangChain agents. All other alternatives are outdated. It handles the agent loop, tool execution, and state management.
How do I maintain conversation state across multiple agent calls?
Add a checkpointer (like MemorySaver) and pass a thread_id in the config when invoking the agent. This persists the conversation state and allows the agent to remember previous interactions.
What is middleware and when should I use it?
Middleware intercepts the agent loop to add human approval, error handling, logging, and custom flows. Use HumanInTheLoopMiddleware for human-in-the-loop workflows or custom decorators like @wrap_tool_call for advanced control. Middleware is essential for production agents.
How do I prevent an agent from running indefinitely?
Set recursion_limit (Python) or recursionLimit (TypeScript) in the invoke config to cap the number of agent steps. For example, config={'recursion_limit': 10} stops execution after 10 iterations.
How do I get structured, typed output from an agent?
Use the response_format parameter when creating an agent with a Pydantic model, or call with_structured_output() on the model instance. Both return validated, typed responses instead of raw strings.

Generated from the current SKILL.md. These answers refresh after source changes.