langgraph-for-agents

Workflows

Use LangGraph/LangChain to build agents

Install

openclaw skills install langgraph-for-agents

LangGraph for Agents

When to use

  • Use this skill when the user asks to build agents or multi-agent systems using LangGraph/LangChain.

How to refer

Integrated Reference Examples

Read the examples in ./references/ to understand common patterns. Start with ./references/README.md for an overview, then read the target file, it will show more details.

External Resources

[Search] If the "search" tool is available, you can refine the query keywords and execute the search.

[Browse] If the "browse" tool is available, you can visit the following three websites:

[Fetch] If the "fetch" tool is available, you can retrieve content from the following URL:

Project Structure

For demos or tests, use a single .py file. For production-grade applications, use:

├── app/                      
│   ├── api/        # API endpoints
│   ├── backend/    # LangGraph/LangChain logic
│   └── frontend/   # User interface
├── .env.example
├── requirements.txt
└── README.md

Process for Agent System Design

Step 1: Determine System Level

  • Single-Agent System: Focus on the internal structure of one agent.
  • Multi-Agent System: Focus on collaboration and communication between multiple agents.

Step 2: Choose Framework

  • LangGraph: Best for stateful, complex workflows.
  • LangChain: Best for standard agent patterns based on tool calling.

Step 3: Design Specific Implementation

For Single-Agent Systems:

  • With LangGraph: Build a workflow with several nodes, or implement a ReAct Agent with manual tool_node.
  • With LangChain: Build a ReAct Agent by create_agent API.

For Multi-Agent Systems:

  • With LangGraph:

    • Option 1: Treat each node as an independent agent, connecting them via the Graph API.
    • Option 2: Encapsulate a multi-node workflow as a single agent, calling other agents as tools.
  • With LangChain:

    • Create a main ReAct Agent and encapsulate other agents as tools for collaboration.

Build Philosophy

  • Prefer Native: Check if a tool or integration already exists in LangChain before custom building.
  • Single File First: Keep core logic in one file initially to simplify debugging.
  • Clean Code: Provide only essential comments and use clear, descriptive variable names.
  • Real Data: Use actual API URLs and schemas whenever possible.