Skip to content
langgraph-agents logo

Langgraph Agents

langgraph-agents

Multi-agent systems with LangGraph - supervisor/swarm patterns, state coordination, multi-provider routing. Use when building multi-agent workflows, coordinating agents, or need cost-optimized orchestration. Uses Claude, DeepSeek, Gemini (no OpenAI).

SKILL.md

Full skill instructions

<objective> Build production-grade multi-agent systems with LangGraph using supervisor, swarm, or master patterns. Enables cost-optimized orchestration with multi-provider routing (Claude, DeepSeek, Gemini - NO OpenAI), proper state management, and scalable agent coordination. </​objective>

<quick_start> State schema (foundation):

from typing import TypedDict, Annotated
from langgraph.graph import add_messages

class AgentState(TypedDict, total=False):
    messages: Annotated[list, add_messages]  # Auto-merge
    next_agent: str  # For handoffs

Pattern selection:

PatternWhenAgents
SupervisorClear hierarchy3-10
SwarmPeer collaboration5-15
MasterLearning systems10-30+

Multi-provider: Use lang-core for auto-selection by cost/​quality/​speed </​quick_start>

<success_criteria> Multi-agent system is successful when:

  • State uses Annotated[..., add_messages] for proper message merging
  • Termination conditions prevent infinite loops
  • Routing uses conditional edges (not hardcoded paths)
  • Cost optimization: simple tasks → cheaper models (DeepSeek)
  • Complex reasoning → quality models (Claude)
  • NO OpenAI used anywhere
  • Checkpointers enabled for context preservation </​success_criteria>

<core_content> Production-tested patterns for building scalable, cost-optimized multi-agent systems with LangGraph and LangChain.

When to Use This Skill

Symptoms:

  • "State not updating correctly between agents"
  • "Agents not coordinating properly"
  • "LLM costs spiraling out of control"
  • "Need to choose between supervisor vs swarm patterns"
  • "Unclear how to structure agent state schemas"
  • "Agents losing context or repeating work"

Use Cases:

  • Multi-agent systems with 3+ specialized agents
  • Complex workflows requiring orchestration
  • Cost-sensitive production deployments
  • Self-learning or adaptive agent systems
  • Enterprise applications with multiple LLM providers

Quick Reference: Orchestration Pattern Selection

PatternUse WhenAgent CountComplexityReference
SupervisorClear hierarchy, centralized routing3-10Low-Mediumreference/​orchestration-patterns.md
SwarmPeer collaboration, dynamic handoffs5-15Mediumreference/​orchestration-patterns.md
MasterLearning systems, complex workflows10-30+Highreference/​orchestration-patterns.md

Core Patterns

1. State Schema (Foundation)

from typing import TypedDict, Annotated, Dict, Any
from langchain_core.messages import BaseMessage
from langgraph.graph import add_messages

class AgentState(TypedDict, total=False):
    messages: Annotated[list[BaseMessage], add_messages]  # Auto-merge
    agent_type: str
    metadata: Dict[str, Any]
    next_agent: str  # For handoffs

Deep dive: reference/​state-schemas.md (reducers, annotations, multi-level state)

2. Multi-Provider Configuration (via lang-core)

# Use lang-core for unified provider access (NO OPENAI)
from lang_core.providers import get_llm_for_task, LLMPriority

# Auto-select by priority
llm_cheap = get_llm_for_task(priority=LLMPriority.COST)   # DeepSeek
llm_smart = get_llm_for_task(priority=LLMPriority.QUALITY)  # Claude
llm_fast = get_llm_for_task(priority=LLMPriority.SPEED)   # Cerebras
llm_local = get_llm_for_task(priority=LLMPriority.LOCAL)  # Ollama

Deep dive: reference/​base-agent-architecture.md, reference/​cost-optimization.md Infrastructure: See lang-core package for middleware, tracing, caching

3. Tool Organization

# Modular, testable tools
def create_agent_with_tools(llm, tools: list):
    return create_react_agent(llm, tools, state_modifier=state_modifier)

# Group by domain
research_tools = [tavily_search, wikipedia]
data_tools = [sql_query, csv_reader]

Deep dive: reference/​tools-organization.md

4. Supervisor Pattern (Centralized)

members = ["researcher", "writer", "reviewer"]
system_prompt = f"Route to: {members}. Return 'FINISH' when done."
supervisor_chain = prompt | llm.bind_functions([route_function])

5. Swarm Pattern (Distributed)

# Agents hand off directly
def agent_node(state):
    result = agent.invoke(state)
    return {"messages": [result], "next_agent": determine_next(result)}

workflow.add_conditional_edges("agent_a", route_to_next, {
    "agent_b": "agent_b", "agent_c": "agent_c", "end": END
})

Reference Files (Deep Dives)

  • reference/​state-schemas.md - TypedDict, Annotated reducers, multi-level state
  • reference/​base-agent-architecture.md - Multi-provider setup, agent templates
  • reference/​tools-organization.md - Modular tool design, testing patterns
  • reference/​orchestration-patterns.md - Supervisor vs swarm vs master (decision matrix)
  • reference/​context-engineering.md - Memory compaction, just-in-time loading
  • reference/​cost-optimization.md - Provider routing, caching, token budgets

Common Pitfalls

IssueSolution
State not updatingAdd Annotated[..., add_messages] reducer
Infinite loopsAdd termination condition in conditional edges
High costsRoute simple tasks to cheaper models
Context lossUse checkpointers or memory systems

lang-core Integration

For production deployments, use lang-core for:

  • Middleware: Cost tracking, budget enforcement, retry, caching, PII safety
  • LangSmith: Unified tracing with @traced_agent decorators
  • Providers: Auto-selection via get_llm_for_task(priority=...)
  • Celery: Background agent execution with progress tracking
  • Redis: Distributed locks, rate limiting, event pub/​sub
# Example: Agent with full lang-core stack
from lang_core import traced_agent, get_llm_for_task, LLMPriority
from lang_core.middleware import budget_enforcement_middleware, cost_tracking_middleware

@traced_agent("QualificationAgent", tags=["sales"])
async def run_qualification(data):
    llm = get_llm_for_task(priority=LLMPriority.SPEED)
    # ... agent logic

More DevOps & CI/CD skills

Project scaffolding, deployment configuration, and CI/CD setup for Google ADK agents.

6K 472.6K
View

Set up tracing, logging, and monitoring for deployed ADK agents across Cloud Trace, BigQuery, and third-party platforms.

6K 472.6K
View

Enterprise Azure infrastructure architect generating Bicep or Terraform from workload descriptions.

1.5K 454.3K
View
azure-kubernetes logo
DevOps & CI/CD

azure-kubernetes

Plan and configure production-ready Azure Kubernetes Service clusters with Day-0 and Day-1 best practices.

1.5K 447.1K
View

Raw mechanical interfaces fusing Swiss typographic print with military terminal aesthetics. Rigid grids, extreme type scale contrast, utilitarian color, analog degradation effects. For data-heavy dashboards, portfolios, or editorial sites that need to feel like declassified blueprints.

92.7K 354.9K
View
just-scrape logo
DevOps & CI/CD

just-scrape

Web search, scraping, extraction, crawling, and monitoring via ScrapeGraph AI CLI.

69 245K
View

Skill for working with Firebase Hosting (Classic). Use this when you want to deploy static web apps, Single Page Apps (SPAs), or simple microservices. Do NOT use for Firebase App Hosting.

462 159.7K
View

Deploy and manage web apps with Firebase App Hosting. Use this skill when deploying Next.js/Angular apps with backends.

462 159.1K
View
deploy-to-vercel logo
DevOps & CI/CD

deploy-to-vercel

Deploy applications and websites to Vercel. Use when the user requests deployment actions like "deploy my app", "deploy and give me the link", "push this live", or "create a preview deployment".

31.9K 146.6K
View
programmatic-seo logo
DevOps & CI/CD

programmatic-seo

Build SEO-optimized pages at scale using templates, data, and proven playbook patterns.

53.3K 140.1K
View

Design and build isolated, reusable Convex backend components with clear boundaries and app-facing wrappers.

63 123.5K
View

Deploy and manage projects on Vercel using token-based authentication. Use when working with Vercel CLI using access tokens rather than interactive login — e.g. "deploy to vercel", "set up vercel", "add environment variables to vercel".

31.9K 116.1K
View

Coding & apps AI tools

Opus Clip logo
Coding & apps

Opus Clip

Opus.ai: Revolutionize Your Web Experience

Free
View
I
Coding & apps

Imagica

Build a no-code AI app in minutes.

Freemium
View
E
Coding & apps

Emergent.sh

An IDE for code migration from legacy to modern frameworks through coding agents.

Freemium
View
Wonder Dynamics logo
Coding & apps

Wonder Dynamics

Automate CGI animation in live-action scenes

Paid
View
M
Coding & apps

Mixo

Launch a website in seconds with AI.

Paid
View
AI Code Convert logo
Coding & apps

AI Code Convert

Streamline Your Coding Experience with AI Code Helper

Free
View