{"id":5290,"library":"langgraph-supervisor","title":"LangGraph Supervisor","description":"LangGraph Supervisor is a Python library that simplifies building hierarchical multi-agent systems using LangGraph. It provides a central supervisor agent responsible for orchestrating specialized worker agents, managing communication flow, and delegating tasks. The library is currently in version 0.0.31 and receives frequent updates, indicating active development.","status":"active","version":"0.0.31","language":"en","source_language":"en","source_url":"https://github.com/langchain-ai/langgraph-supervisor-py","tags":["langgraph","multi-agent","agentic-ai","orchestration","llm","langchain"],"install":[{"cmd":"pip install langgraph-supervisor langchain-openai","lang":"bash","label":"Install with OpenAI integration"}],"dependencies":[{"reason":"Core framework for building agent applications.","package":"langgraph","optional":false},{"reason":"Underlying LangChain utilities.","package":"langchain-core","optional":false},{"reason":"Commonly used for the supervisor's language model in examples.","package":"langchain-openai","optional":true}],"imports":[{"symbol":"create_supervisor","correct":"from langgraph_supervisor import create_supervisor"},{"note":"Required if using OpenAI models for the supervisor or agents.","symbol":"ChatOpenAI","correct":"from langchain_openai import ChatOpenAI"},{"note":"Commonly used to create worker agents managed by the supervisor.","symbol":"create_react_agent","correct":"from langgraph.prebuilt import create_react_agent"}],"quickstart":{"code":"import os\nfrom langchain_openai import ChatOpenAI\nfrom langgraph_supervisor import create_supervisor\nfrom langgraph.prebuilt import create_react_agent\nfrom langgraph.graph import END\n\n# Set your OpenAI API key from environment variable\nos.environ[\"OPENAI_API_KEY\"] = os.environ.get(\"OPENAI_API_KEY\", \"\")\n\n# Initialize the LLM for agents and supervisor\nmodel = ChatOpenAI(model=\"gpt-4o\")\n\n# Define simple tools\ndef add(a: float, b: float) -> float:\n    \"\"\"Add two numbers.\"\"\"\n    return a + b\n\ndef web_search(query: str) -> str:\n    \"\"\"Search the web for information.\"\"\"\n    # Placeholder for actual web search functionality\n    return f\"Found results for '{query}': Example search data.\"\n\n# Create specialized agents\nmath_agent = create_react_agent(\n    model=model,\n    tools=[add],\n    name=\"math_expert\",\n)\n\nresearch_agent = create_react_agent(\n    model=model,\n    tools=[web_search],\n    name=\"research_expert\",\n)\n\n# Create supervisor workflow\n# The prompt parameter defines the supervisor's role and how to delegate.\nworkflow = create_supervisor(\n    [research_agent, math_agent],\n    model=model,\n    prompt=(\n        \"You are a team supervisor managing a research expert and a math expert. \"\n        \"For research tasks, use research_agent. \"\n        \"For math tasks, use math_agent.\"\n    ),\n)\n\n# To add memory and enable longer conversations, you would typically use a StateGraph and add checkpointing.\n# For this quickstart, we'll compile and run a single turn.\napp = workflow.compile()\n\n# Example invocation\nresult = app.invoke({\n    \"messages\": [\n        {\n            \"role\": \"user\",\n            \"content\": \"What is 10 + 5 and what's the capital of France?\"\n        }\n    ]\n})\n\nprint(result[\"messages\"][-1].content)","lang":"python","description":"This quickstart demonstrates how to create two specialized agents (a math expert and a research expert) and then orchestrate them using `create_supervisor`. The supervisor uses an LLM to decide which agent to hand off tasks to based on the user's input."},"warnings":[{"fix":"Refer to the LangChain multi-agent guide and supervisor tutorial for implementing the pattern directly with LangGraph's core features. Consider if this library uniquely solves a problem not easily addressed by the manual pattern.","message":"The LangGraph team now recommends implementing the 'supervisor pattern directly via tools' for most use cases, rather than using this dedicated `langgraph-supervisor` library. This library may be less actively maintained or receive fewer new features compared to the manual approach.","severity":"deprecated","affected_versions":"All versions (strategic recommendation change)"},{"fix":"Explicitly define and pass a `state_schema` to `create_supervisor` if you need a specific schema, or ensure your graph state is compatible with the new default behavior.","message":"In versions 0.0.26 and earlier, the `state_schema` parameter for `create_supervisor` defaulted to `AgentState`. From 0.0.26 onwards, it defaults to `None`. If your application relied on the implicit `AgentState`, you might experience issues.","severity":"breaking","affected_versions":">=0.0.26"},{"fix":"Pin your dependency to a specific patch version (`==0.0.X`) rather than using caret (`^`) or tilde (`~`) ranges in your `pyproject.toml` or `requirements.txt` to avoid unexpected breakage during minor updates.","message":"The library is in `0.0.x` versions, indicating that the API is not yet stable. Breaking changes and significant shifts in functionality can occur without major version bumps.","severity":"gotcha","affected_versions":"All 0.0.x versions"},{"fix":"Upgrade to `langgraph-supervisor==0.0.31` or higher to ensure compatibility with `langgraph`'s `ToolNode`.","message":"Version 0.0.31 includes a fix for `v1 ToolNode compat`, suggesting prior versions might have had compatibility issues with the `ToolNode` structure introduced in `langgraph` v1.x.","severity":"breaking","affected_versions":"<0.0.31"},{"fix":"Ensure your development and deployment environments are running Python 3.10 or a newer compatible version.","message":"LangGraph Supervisor requires Python version 3.10 or higher. Using older Python versions will result in installation or runtime errors.","severity":"gotcha","affected_versions":"All versions"}],"env_vars":null,"last_verified":"2026-04-13T00:00:00.000Z","next_check":"2026-07-12T00:00:00.000Z"}