langchain-agent
Generates a complete LangGraph ReAct agent structure based on a user-provided tool and endpoint configuration.
Install
mkdir -p .claude/skills/langchain-agent && curl -L -o skill.zip "https://agentskills.codes/api/skills/download/11112" && unzip -o skill.zip -d .claude/skills/langchain-agent && rm skill.zipInstalls to .claude/skills/langchain-agent
Activation
This is the description your AI agent reads to decide when to run this skill — the better it matches your request, the more reliably it fires.
Scaffold a basic LangChain/LangGraph ReAct agent with a tool, wired to any OpenAI-compatible endpoint. Run when the user asks to create, generate, or scaffold a LangChain or LangGraph agent.Key capabilities
- →Scaffold LangGraph ReAct agent
- →Wire custom tools
- →Connect to OpenAI-compatible endpoints
- →Generate project boilerplate
How it works
It generates a Python-based LangGraph agent using the create_react_agent pattern, including stubs for custom tools and environment configuration.
Inputs & outputs
When to use langchain-agent
- →Initialize a new LangGraph project with custom tools
- →Connect a reasoning agent to a local Ollama or vLLM instance
- →Scaffold a standard ReAct loop with a weather-fetching stub
About this skill
You are an agent scaffolding assistant. Your job is to generate a working LangGraph ReAct agent based on the hello-world pattern from https://agentops.redhatskills.com/basic-agents/hello-world.md.
The agent uses create_react_agent — a single function that wires one or more
Python tools into a reason → act → observe loop. It connects to any
OpenAI-compatible endpoint (OpenAI, vLLM, Ollama, RHOAI Model-as-a-Service)
via environment variables.
Step 1: Gather Requirements
Parse $ARGUMENTS for:
--output-dir <path>: Directory to write files into (no default — must be specified or asked)--tool-name <name>: Name of the example tool to scaffold (default:get_weather)--headless: Skip clarifying questions and use all defaults (still requires--output-dir)
Always ask the user where to write files. If --output-dir was NOT provided in
$ARGUMENTS, ask this question first (using AskUserQuestion) regardless of --headless:
- Where should the agent files be written? Provide a directory path (e.g.
./my-agent,~/projects/weather-bot). Do NOT default to the current directory.
If --headless is NOT set, also ask up to 2 more questions:
- What should the example tool do? Describe it in plain English so you can write a realistic stub. (default: return fake weather for a city)
- What model / endpoint will you use? OpenAI, a local vLLM/Ollama server, or RHOAI Model-as-a-Service? (affects the env var instructions in the README)
Step 2: Write agent.py
Write <output-dir>/agent.py with this structure:
"""
Basic LangGraph ReAct agent.
Reads model connection details from environment variables:
OPENAI_API_KEY - API key (use any non-empty string for local models)
OPENAI_BASE_URL - Base URL (omit to use OpenAI; set for vLLM/Ollama/RHOAI)
OPENAI_MODEL_NAME - Model name (default: gpt-4o-mini)
"""
import os
from langchain_openai import ChatOpenAI
from langgraph.prebuilt import create_react_agent
# ---------------------------------------------------------------------------
# Tool definitions
# ---------------------------------------------------------------------------
def <tool_name>(<param>: str) -> str:
"""<docstring describing what the tool does — this becomes the LLM's tool description>"""
# TODO: replace this stub with a real implementation
return f"<stub response for {<param>}>"
# ---------------------------------------------------------------------------
# Agent setup
# ---------------------------------------------------------------------------
llm = ChatOpenAI(
model=os.environ.get("OPENAI_MODEL_NAME", "gpt-4o-mini"),
base_url=os.environ.get("OPENAI_BASE_URL"),
api_key=os.environ.get("OPENAI_API_KEY"),
)
agent = create_react_agent(
llm,
tools=[<tool_name>],
prompt="You are a helpful assistant. When you receive a tool "
"result, summarize it as a final answer.",
)
# ---------------------------------------------------------------------------
# Main
# ---------------------------------------------------------------------------
result = agent.invoke(
{"messages": [{"role": "user", "content": "<default question that exercises the tool>"}]}
)
for msg in result["messages"]:
print(f"{msg.type}: {msg.content}")
Fill in the blanks (<tool_name>, <param>, <docstring>, etc.) from the
user's answers or defaults. The docstring is critical — the LLM reads it to
decide when and how to call the tool.
Step 3: Write requirements.txt
Write <output-dir>/requirements.txt:
langgraph>=0.4
langchain-openai>=0.3
Step 4: Write README.md
Write <output-dir>/README.md with:
-
What this is — one sentence.
-
Install:
python -m venv venv source venv/bin/activate uv pip install -r requirements.txt -
Configure — env var table:
Variable Required Description OPENAI_API_KEYYes API key. Use any non-empty string for local models. OPENAI_BASE_URLNo Base URL for OpenAI-compatible endpoints. Omit for OpenAI. OPENAI_MODEL_NAMENo Model name. Default: gpt-4o-mini.Include example shell snippets for the endpoint type the user selected:
OpenAI:
export OPENAI_API_KEY=sk-...Local model (vLLM / Ollama / RHOAI):
export OPENAI_API_KEY=unused # any non-empty value export OPENAI_BASE_URL=http://localhost:8000/v1 export OPENAI_MODEL_NAME=llama3.1 -
Run —
python agent.py -
How it works — 3-4 sentences explaining the ReAct loop: the LLM sees the tool list, emits a tool call when it needs information, the framework executes the tool and feeds the result back, the LLM returns a final answer.
-
Next steps — bullet list:
- Add more tools (any Python function with a docstring)
- Connect to tracing: https://agentops.redhatskills.com/tracing/connect-to-mlflow.md
- Deploy on OpenShift: see https://agentops.redhatskills.com/basic-agents/hello-world.md
Step 5: Confirm
Tell the user:
- Which files were written and where
- The exact commands to install and run the agent
- That they can replace the stub tool body with a real implementation and add more tools by adding functions to the
toolslist
$ARGUMENTS
When not to use it
- →When the project already has a complex agent structure
Prerequisites
Limitations
- →Requires manual implementation of tool logic
- →Limited to ReAct pattern
How it compares
It provides a standardized, scaffolded starting point for ReAct agents, reducing manual setup time.
Compared to similar skills
langchain-agent side by side with the closest alternatives in the catalog.
| Skill | Installs | Updated | Safety | Difficulty |
|---|---|---|---|---|
| langchain-agent (this skill) | 0 | 3mo | Review | Intermediate |
| copilot-sdk | 7 | 4mo | Review | Intermediate |
| guidance | 3 | 7mo | Review | Intermediate |
| adk-engineer | 3 | 27d | Review | Advanced |
Try saying
Example prompts that trigger this skill in your AI assistant.
You might also like
copilot-sdk
github
Build agentic applications with GitHub Copilot SDK. Use when embedding AI agents in apps, creating custom tools, implementing streaming responses, managing sessions, connecting to MCP servers, or creating custom agents. Triggers on Copilot SDK, GitHub SDK, agentic app, embed Copilot, programmable agent, MCP server, custom agent.
guidance
davila7
Control LLM output with regex and grammars, guarantee valid JSON/XML/code generation, enforce structured formats, and build multi-step workflows with Guidance - Microsoft Research's constrained generation framework
adk-engineer
jeremylongshore
Execute software engineer specializing in creating production-ready ADK agents with best practices, code structure, testing, and deployment automation. Use when asked to "build ADK agent", "create agent code", or "engineer ADK application". Trigger with relevant phrases based on skill purpose.
llm-application-dev
skillcreatorai
Building applications with Large Language Models - prompt engineering, RAG patterns, and LLM integration. Use for AI-powered features, chatbots, or LLM-based automation.
agentica-spawn
parcadei
Spawn Agentica multi-agent patterns
fine-tuning-with-trl
davila7
Fine-tune LLMs using reinforcement learning with TRL - SFT for instruction tuning, DPO for preference alignment, PPO/GRPO for reward optimization, and reward model training. Use when need RLHF, align model with preferences, or train from human feedback. Works with HuggingFace Transformers.