Logo de Langgraph

Langgraph

Communauté
Omar-Obando
langgraph

Use when building stateful agents and workflows with LangGraph, implementing graph-based architectures, managing state persistence, human-in-the-loop capabilities, and multi-agent systems. Includes Python and JavaScript implementations. Based on LangChain/LangGraph official documentation and agent development best practices.

Présentation

ÉditeurOmar-Obando
Dépôtqwen-orchestrator
Nom de la compétencelanggraph
Étoiles
53
Forks
13
Fichiers inclus
Instructions uniquement
LicenceMIT
Liens
  • Instructions en Markdown

    Un fichier SKILL.md que le modèle charge à la demande : il ne consomme donc des tokens que lorsqu’une demande correspond réellement à la compétence.

  • Compatible avec tous les LLM

    Les compétences IA sont en simple Markdown, et non en code propre à un fournisseur. Elles fonctionnent donc avec GPT, Claude, Gemini, Grok ou un modèle local.

  • Tout dans les instructions

    Tout ce dont le modèle a besoin se trouve dans les instructions : aucun fichier supplémentaire à synchroniser.

  • Open source

    Publiée par Omar-Obando sur GitHub. Consultez les sources avant de l’installer.

Installation

Installez la compétence IA Langgraph dans TypingMind pour l’utiliser avec n’importe quel LLM, ou ajoutez-la à un autre agent capable de lire SKILL.md.

1

Installer dans TypingMind

TypingMind installe une compétence directement depuis son dossier GitHub : l’application lit SKILL.md, regroupe les fichiers de ressources et enregistre le tout localement.

  1. Ouvrez l’application et accédez à Plugins → Compétences.
  2. Choisissez « Installer depuis GitHub ».
  3. Collez l’URL du dossier de la compétence indiquée ci-dessous, puis confirmez.
    https://github.com/Omar-Obando/qwen-orchestrator/tree/main/skills/langgraph
  4. Activez la compétence dans chaque discussion où vous souhaitez pouvoir l’utiliser.
Plugins → Compétences → Ajouter → Via URL GitHub, puis collez l’URL du dossier et appuyez sur Continuer.
2

Installer dans un autre agent

Tout agent capable de lire le format Agent Skills peut utiliser cette compétence : copiez le dossier dans le répertoire des compétences de cet agent.

Claude Code — .claude/skills
git clone --depth 1 https://github.com/Omar-Obando/qwen-orchestrator.git /tmp/qwen-orchestrator
mkdir -p .claude/skills
cp -r /tmp/qwen-orchestrator/skills/langgraph .claude/skills/langgraph
Redémarrez Claude Code après la copie pour que la nouvelle compétence soit prise en compte.

Utilisez cette compétence dans TypingMind

Activez Langgraph dans n’importe quelle discussion TypingMind et le modèle s’occupe du reste. Le nom et la description de la compétence figurent dans le prompt système. Dès qu’une demande correspond, le modèle charge lui-même l’intégralité des instructions : vous n’avez jamais à l’invoquer manuellement, et elle ne consomme aucun token tant qu’elle n’est pas utilisée.

Le modèle charge automatiquement Langgraph dès qu’une demande correspond à cette compétence.

Compatible avec tous les modèles IA

Les compétences IA sont de simples instructions Markdown, et non du code propre à un fournisseur. Ainsi, Langgraph n’est pas lié au modèle pour lequel cette compétence a été conçue. Installez-la une seule fois dans TypingMind et utilisez-la avec GPT-5, Claude, Gemini, Grok, DeepSeek, Mistral, Llama ou un modèle local que vous exécutez vous-même, le tout avec vos propres clés API.

  • Chargée uniquement en cas de besoin

    Le prompt système ne contient que le nom et la description. Les instructions sont récupérées à la première demande correspondante : une compétence inutilisée ne coûte donc rien.

  • Changez de modèle en cours de discussion

    La compétence étant constituée d’instructions et non de code, elle reste fonctionnelle lorsque vous changez de modèle : le nouveau modèle lit le même fichier SKILL.md.

Instructions de la compétence

Voici le contenu de SKILL.md que le modèle charge. Lisez-le avant l’installation : une compétence contient des instructions que votre modèle suivra.

LangGraph Skill — Stateful Agents & Graph Workflows

Overview

This skill provides comprehensive guidance for building stateful agents and workflows with LangGraph, implementing graph-based architectures, managing state persistence, human-in-the-loop capabilities, and multi-agent systems. It includes Python and JavaScript implementations. Based on LangChain/LangGraph official documentation and agent development best practices.

When to Use

Use this skill when:

  • Building stateful agents with LangGraph
  • Implementing graph-based architectures with StateGraph
  • Managing state persistence and checkpoints
  • Creating human-in-the-loop workflows with interrupts
  • Building multi-agent systems with handoffs
  • Implementing durable execution and memory
  • Using checkpointer strategies (InMemory, SQLite, PostgreSQL)
  • Implementing thread management and session persistence
  • Building agent swarms with LangGraph Swarm
  • Creating conditional edges and routing logic
  • Implementing agent communication patterns
  • Setting up LangGraph Studio for debugging
  • Using LangSmith for tracing and monitoring
  • Building agents with tool calling capabilities
  • Implementing retry and error handling patterns
  • Creating agents with streaming output
  • Building agents with context window management
  • Implementing agent memory with vector stores
  • Creating agents with external knowledge sources
  • Building agents with multi-step reasoning

Do NOT use this skill when:

  • Building basic LLM applications without state (use llm-integrations skill)
  • Designing database schema (use database-design skill)
  • Creating UI components (use frontend-design skill)
  • Writing simple prompt templates (use langchain skill for basic LLM operations)
  • Implementing non-agent workflows (use standard application development skill)
  • Building simple chat applications without complex state (use qwen-agent skill for Qwen-specific apps)
  • Managing agent teams across multiple agents (use agent-task-coordinator skill)

Why avoid: LangGraph adds complexity with state management and checkpoints. For simple LLM apps, use lighter-weight solutions.

Core Concepts

State Management

python
# Python
from typing import Annotated
from langgraph.graph import StateGraph
from langgraph.checkpoint.memory import InMemorySaver

class State(TypedDict):
    messages: Annotated[list, add_messages]
    current_agent: str

workflow = StateGraph(State)
checkpointer = InMemorySaver()
app = workflow.compile(checkpointer=checkpointer)
typescript
// JavaScript
import { MemorySaver } from '@langchain/langgraph';
import { StateGraph } from '@langchain/langgraph';

const checkpointer = new MemorySaver();
const workflow = new StateGraph(State);
const app = workflow.compile({ checkpointer });

Graph Patterns

python
# Sequential Pattern
workflow = (
    StateGraph(State)
    .add_node("researcher", research_node)
    .add_node("writer", write_node)
    .add_edge("researcher", "writer")
    .set_entry_point("researcher")
    .set_finish_point("writer")
)

# Conditional Pattern
def route_message(state: State) -> str:
    if state["current_agent"] == "Alice":
        return "Bob"
    return "Alice"

workflow = (
    StateGraph(State)
    .add_node("Alice", alice_node)
    .add_node("Bob", bob_node)
    .add_conditional_edges("Alice", route_message, ["Bob"])
    .add_conditional_edges("Bob", route_message, ["Alice"])
)

Multi-Agent Systems

Basic Swarm

python
from langgraph.checkpoint.memory import InMemorySaver
from langchain.agents import create_agent
from langgraph_swarm import create_swarm

def add(a: int, b: int) -> int:
    '''Add two numbers'''
    return a + b

alice = create_agent(
    "openai:gpt-4o",
    tools=[add],
    system_prompt="You are Alice, an addition expert.",
    name="Alice",
)

bob = create_agent(
    "openai:gpt-4o",
    system_prompt="You are Bob, you speak like a pirate.",
    name="Bob",
)

checkpointer = InMemorySaver()
workflow = create_swarm([alice, bob], default_active_agent="Alice")
app = workflow.compile(checkpointer=checkpointer)

config = {"configurable": {"thread_id": "1"}}
result = app.invoke({"messages": [{"role": "user", "content": "Hello"}]}, config)

Agent Handoffs

python
from langgraph_swarm import create_handoff_tool

alice = create_agent(
    "openai:gpt-4o",
    tools=[
        add,
        create_handoff_tool(
            agent_name="Bob",
            description="Transfer to Bob for pirate-related questions",
        ),
    ],
    system_prompt="You are Alice, an addition expert.",
    name="Alice",
)

bob = create_agent(
    "openai:gpt-4o",
    tools=[
        create_handoff_tool(
            agent_name="Alice",
            description="Transfer to Alice for math questions",
        ),
    ],
    system_prompt="You are Bob, you speak like a pirate.",
    name="Bob",
)

Active Agent Router

python
from langgraph_swarm import add_active_agent_router

workflow = (
    StateGraph(SwarmState)
    .add_node(alice, destinations=("Bob",))
    .add_node(bob, destinations=("Alice",))
)

workflow = add_active_agent_router(
    builder=workflow,
    route_to=["Alice", "Bob"],
    default_active_agent="Alice",
)

app = workflow.compile(checkpointer=checkpointer)

State Persistence

Checkpointers

python
from langgraph.checkpoint.memory import InMemorySaver
from langgraph.checkpoint.sqlite import SqliteSaver
from langgraph.checkpoint.postgres import PostgresSaver

# In-memory (development)
checkpointer = InMemorySaver()

# SQLite (production)
checkpointer = SqliteSaver.from_conn_string(":memory:")

# PostgreSQL (production)
checkpointer = PostgresSaver.from_conn_string("postgresql://user:pass@localhost/db")

Thread Management

python
config = {"configurable": {"thread_id": "user-123"}}

# First invocation
result = app.invoke({"messages": [{"role": "user", "content": "Hello"}]}, config)

# Subsequent invocation (state preserved)
result = app.invoke({"messages": [{"role": "user", "content": "Continue"}]}, config)

# Stream results
for chunk in app.stream({"messages": [{"role": "user", "content": "Stream"}]}, config):
    print(chunk)

Human-in-the-Loop

Interrupts

python
from langgraph.func import entrypoint, task
from langgraph.types import interrupt

@task
def compose_essay(topic: str) -> str:
    return f"An essay about {topic}"

@entrypoint(checkpointer=InMemorySaver())
def review_workflow(topic: str) -> dict:
    essay_future = compose_essay(topic)
    essay = essay_future.result()

    # Human review
    human_review = interrupt({
        "question": "Please provide a review",
        "essay": essay
    })

    return {
        "essay": essay,
        "review": human_review,
    }

# Resume with human input
config = {"configurable": {"thread_id": "review-1"}}
human_review = "This essay is great."
result = app.invoke(Command(resume=human_review), config)

Checkpointing

python
# Get checkpoint history
config = {"configurable": {"thread_id": "user-123"}}
history = list(app.get_state_history(config))

# Resume from specific checkpoint
for state in history:
    if state.next == ["review_node"]:
        # Resume from this checkpoint
        app.update_state(state.config, {"review": "approved"})

Best Practices

1. Use Checkpointers for State Persistence

python
# ✅ GOOD: With checkpointing
checkpointer = InMemorySaver()
app = workflow.compile(checkpointer=checkpointer)

# ❌ BAD: Without checkpointing
app = workflow.compile()  # No state persistence

2. Design Graphs with Clear Boundaries

python
# ✅ GOOD: Clear node boundaries
workflow = (
    StateGraph(State)
    .add_node("input_validation", validate_input)
    .add_node("llm_processing", process_with_llm)
    .add_node("output_formatting", format_output)
    .add_edge("input_validation", "llm_processing")
    .add_edge("llm_processing", "output_formatting")
)

# ❌ BAD: Unclear boundaries
workflow = StateGraph(State)
# All logic in one node - hard to test and maintain

3. Use Type Hints for State

python
# ✅ GOOD: Typed state
from typing import TypedDict

class State(TypedDict):
    messages: list
    current_agent: str
    user_context: dict

# ❌ BAD: Untyped state
class State:
    messages = []
    current_agent = ""
    user_context = {}

4. Implement Error Handling

python
# ✅ GOOD: Error handling in nodes
def process_with_llm(state: State) -> State:
    try:
        result = llm.invoke(state["messages"])
        return {**state, "response": result}
    except Exception as e:
        return {**state, "error": str(e)}

# ❌ BAD: No error handling
def process_with_llm(state: State) -> State:
    result = llm.invoke(state["messages"])  # Can crash
    return {**state, "response": result}

Common Anti-Patterns

❌ Bad: No State Management

python
# ❌ BAD: No state management
def process(state: State) -> State:
    # No persistence, no checkpointing
    result = llm.invoke(state["messages"])
    return {"response": result}

Problems:

  • No state persistence
  • Cannot resume workflows
  • No human-in-the-loop support

✅ Good: With State Management

python
# ✅ GOOD: With state management
class State(TypedDict):
    messages: list
    response: Optional[str]

def process(state: State) -> State:
    result = llm.invoke(state["messages"])
    return {**state, "response": result}

checkpointer = InMemorySaver()
app = workflow.compile(checkpointer=checkpointer)

❌ Bad: Complex Graphs

python
# ❌ BAD: Complex graph with many edges
workflow = (
    StateGraph(State)
    .add_node("a", node_a)
    .add_node("b", node_b)
    .add_node("c", node_c)
    .add_node("d", node_d)
    # Many conditional edges - hard to understand
)

Problems:

  • Hard to understand
  • Difficult to debug
  • Maintenance challenges

✅ Good: Simple Graphs

python
# ✅ GOOD: Simple graph
workflow = (
    StateGraph(State)
    .add_node("input", validate_input)
    .add_node("process", process_with_llm)
    .add_node("output", format_output)
    .add_edge("input", "process")
    .add_edge("process", "output")
)

Real-World Impact

Before this skill:

  • No state persistence
  • Difficult multi-agent systems
  • No human-in-the-loop
  • Complex state management

After this skill:

  • State persistence with checkpoints
  • Easy multi-agent systems
  • Human-in-the-loop support
  • Clean state management

Cross-References

  • langchain - For LLM integration
  • qwen-agent - For Qwen-specific agents
  • llm-integrations - For LLM provider configuration

References

Foire aux questions

À quoi sert la compétence IA Langgraph ?

Use when building stateful agents and workflows with LangGraph, implementing graph-based architectures, managing state persistence, human-in-the-loop capabilities, and multi-agent systems. Includes Python and JavaScript implementations. Based on LangChain/LangGraph official documentation and agent development best practices.

Pourquoi utiliser Langgraph sur TypingMind ?

Parce que vous l’installez une seule fois pour l’utiliser avec n’importe quel modèle. Langgraph se compose de simples instructions en Markdown plutôt que de code propre à un fournisseur. La même compétence fonctionne donc avec GPT-5, Claude, Gemini, Grok ou un modèle local, et vous pouvez changer de modèle en cours de discussion sans perturber son fonctionnement. TypingMind utilise vos propres clés API : vous payez donc directement les fournisseurs plutôt qu’un abonnement par siège, et vos compétences et discussions restent dans votre propre espace de stockage.

Comment installer Langgraph dans TypingMind ?

Dans TypingMind, ouvrez Plugins → Compétences → Installer depuis GitHub et collez https://github.com/Omar-Obando/qwen-orchestrator/tree/main/skills/langgraph. TypingMind lit le fichier SKILL.md et l’installe sous forme de compétence que vous pouvez activer pour chaque discussion.

Quels modèles d’IA peuvent utiliser Langgraph ?

N’importe quel modèle que vous connectez dans TypingMind. Les compétences IA sont de simples instructions en Markdown, et non du code propre à un fournisseur. GPT, Claude, Gemini, Grok et les modèles locaux peuvent donc tous charger cette compétence lorsqu’une demande lui correspond.

Combien de modèles d’IA puis-je utiliser avec Langgraph ?

Autant que vous le souhaitez. Tant qu’un modèle prend en charge les compétences, vous pouvez utiliser Langgraph avec lui : GPT, Claude, Gemini, Grok, DeepSeek, Mistral, Llama et bien d’autres, le tout dans TypingMind avec vos propres clés API.

La compétence IA Langgraph est-elle gratuite ?

Oui. Cette compétence est publiée sur GitHub par Omar-Obando sous licence MIT. Vous ne payez que votre propre fournisseur d’IA pour les tokens utilisés.

Que sont les compétences IA ?

Une compétence IA est un ensemble d’instructions réutilisables qui apprend à un modèle d’IA à accomplir une tâche précise. Elle suit le format ouvert Agent Skills : un fichier SKILL.md contenant un nom et une description, ainsi que les éventuels scripts, modèles de documents ou fichiers de référence dont le modèle peut avoir besoin. Le modèle ne lit les instructions que lorsque votre demande correspond à la compétence. Une compétence installée ne coûte donc rien tant qu’elle n’est pas utilisée.

En quoi les compétences IA diffèrent-elles des plugins ou des serveurs MCP ?

Un plugin ou un serveur MCP fournit au modèle de nouveaux outils à appeler : du code qui s’exécute quelque part et renvoie un résultat. Une compétence IA lui apporte plutôt des connaissances et une méthode : comment aborder une tâche, quelles étapes suivre et à quoi ressemble un bon résultat. Les compétences sont de simples instructions en Markdown. Elles ne nécessitent donc ni serveur, ni clé API, ni environnement d’exécution, et fonctionnent avec n’importe quel modèle.

Tout voir

Créez votre propre espace IA dès maintenant

Abonnez-vous à notre newsletter pour être informé des nouvelles fonctionnalités et des prochains cadeaux à gagner 👇