Agent skill

langchain-agents

Stars 0
Forks 0

Install this agent skill to your Project

npx add-skill https://github.com/cuba6112/skillfactory/tree/main/skills/langchain-agents

SKILL.md

LangChain Agents

Overview

LangChain provides a standard interface for building LLM agents that can use tools. Modern agent development is moving toward LangGraph to handle stateful, multi-turn, and non-linear logic that simple loops cannot capture.

When to Use

  • Multi-Provider Apps: When you want to swap between OpenAI, Anthropic, and local models without changing business logic.
  • Stateful Agents: When you need human-in-the-loop, long-term persistence, or complex execution graphs.
  • Observability: Using LangSmith to debug exactly where an agentic chain failed.

Decision Tree

  1. Is it a simple tool-calling loop?
    • YES: Use the create_agent abstraction.
  2. Does it require cycles, complex state transitions, or human approval?
    • YES: Build using LangGraph.
  3. Do you need to track exactly how much an agent run cost or where it halluncinated?
    • YES: Enable LangSmith tracing.

Workflows

1. Creating a Simple Tool-Enabled Agent

  1. Define a Python function with a docstring to serve as a tool.
  2. Initialize a ChatModel (e.g., ChatAnthropic).
  3. Call create_agent(model, tools=[...]) to generate the agent.
  4. Execute the agent using agent.invoke({"messages": [...]}).

2. Debugging with LangSmith

  1. Enable LangSmith environment variables (LANGSMITH_API_KEY, LANGSMITH_TRACING).
  2. Run the agent as usual; traces are automatically captured.
  3. Visualize the execution path and captured state transitions in the LangSmith UI to identify where the agent went wrong.

3. Adding Memory to an Agent

  1. Initialize a Checkpointer or Memory object.
  2. Pass the memory to the agent's invoke call to maintain state across turns.
  3. The agent will automatically append tool outputs and model responses to the conversation thread.

Non-Obvious Insights

  • Abstraction Layer: LangChain's primary value is standardizing the interface across providers, preventing vendor lock-in.
  • Simple vs. Complex: For many basic tasks, you don't need LangGraph; the high-level agent_executor is often enough for under 10 lines of code.
  • Durable Execution: Using LangGraph allows for "checkpoints," meaning an agent can stop, wait for human input, and resume hours later without losing state.

Evidence

  • "Standardizes how you interact with models so that you can seamlessly swap providers..." - LangChain Docs
  • "LangChain agents are built on top of LangGraph in order to provide durable execution, streaming... persistence." - LangChain Docs
  • "You do not need to know LangGraph for basic LangChain agent usage." - LangChain Docs

Scripts

  • scripts/langchain-agents_tool.py: Python script for tool definition and agent invocation.
  • scripts/langchain-agents_tool.js: Equivalent logic using LangChain.js.

Dependencies

  • langchain
  • langgraph
  • langsmith

References

  • references/README.md

Expand your agent's capabilities with these related and highly-rated skills.

cuba6112/skillfactory

prompt-engineering

Comprehensive prompt engineering techniques for Claude models. Use this skill when crafting, optimizing, or debugging prompts for Claude API, Claude Code, or any Claude-powered application. Covers system prompts, role prompting, multishot examples, chain of thought, XML structuring, long context handling, extended thinking, prompt chaining, Claude 4.x-specific best practices, and agentic orchestration including subagents, agent loops, skills, MCP integration, and multi-agent workflows.

0 0
Explore
cuba6112/skillfactory

adk-rag-agent

Build RAG (Retrieval-Augmented Generation) agents with Google ADK and Vertex AI RAG Engine. Use when implementing document Q&A, knowledge base search, or citation-backed responses. Covers VertexAiRagRetrieval tool, corpus setup, and citation formatting.

0 0
Explore
cuba6112/skillfactory

headless-cli-agents

Build agentic systems using Claude CLI in headless mode or the Claude Agent SDK. Use when building automation pipelines, CI/CD integrations, multi-agent orchestration, or programmatic Claude interactions. Covers CLI flags (-p, --output-format), session management (--resume, --continue), Python SDK (claude-agent-sdk), custom tools, and agent loop patterns.

0 0
Explore
cuba6112/skillfactory

notion-knowledge-capture

Capture conversations and decisions into structured Notion pages; use when turning chats/notes into wiki entries, how-tos, decisions, or FAQs with proper linking.

0 0
Explore
cuba6112/skillfactory

mcp-builder

Guide for creating high-quality MCP (Model Context Protocol) servers that enable LLMs to interact with external services through well-designed tools. Use when building MCP servers to integrate external APIs or services, whether in Python (FastMCP) or Node/TypeScript (MCP SDK).

0 0
Explore
cuba6112/skillfactory

gh-fix-ci

Inspect GitHub PR checks with gh, pull failing GitHub Actions logs, summarize failure context, then create a fix plan and implement after user approval. Use when a user asks to debug or fix failing PR CI/CD checks on GitHub Actions and wants a plan + code changes; for external checks (e.g., Buildkite), only report the details URL and mark them out of scope.

0 0
Explore

Didn't find tool you were looking for?

Be as detailed as possible for better results