Skip to main content

LangGraph AgentFlow

AgentFlow is a Python library that automates the orchestration of multi-step agent workflows by integrating intelligent planning, routing, and execution of specialized operations.

Features

  • Single-Step Agents: Create hierarchical agent systems with a router that delegates to specialized agents
  • Multi-Step Workflows: Dynamically decompose complex tasks into sequences of steps executed by specialized agents
  • Tool Integration: Seamlessly integrate external tools with agents
  • Planning & Synthesis: Automatically plan task execution and synthesize results
  • Built on LangGraph: Leverages LangGraph for efficient agent orchestration

Installation

pip install langgraph-agentflow

Quick Start

Single-Step Agent

Create a hierarchical agent system with a router that delegates to specialized agents:

from langchain_core.tools import Tool
from langchain_ollama import ChatOllama
from langgraph_agentflow import create_hierarchical_agent

# Initialize LLM
llm = ChatOllama(model="llama3")

# Define agent configurations
agent_config = [
    {
        "name": "news",
        "tools": news_tools,
        "description": NEWS_TOOL_DESCRIPTION,
    },
    {
        "name": "sector",
        "tools": sector_tools,
        "description": SECTOR_TOOL_DESCRIPTION,
    },
    {
        "name": "ticker",
        "tools": ticker_tools,
        "description": TICKER_TOOL_DESCRIPTION,
    },
    {
        "name": "general",
        "description": "Handles general information and queries not specific to other domains",
    },
]

# Create the agent
graph, config, stream_fn, interactive_loop = create_hierarchical_agent(llm, agent_config)

# Use the agent
stream_fn("What's the latest news about Tesla?")

Single Step Agent Architecture

Multi-Step Agent

Create a multi-step agent that breaks complex tasks into simpler subtasks:

from langchain_core.tools import Tool
from langchain_ollama import ChatOllama
from langgraph_agentflow import create_multi_step_agent, invoke_multi_step_agent

# Initialize LLM
llm = ChatOllama(model="llama3.3")

# Create the multi-step agent
agent = create_multi_step_agent(
    llm=llm,
    agent_tools=[
        {
            "name": "news",
            "tools": news_tools,
            "description": NEWS_TOOL_DESCRIPTION,
        },
        {
            "name": "sector",
            "tools": sector_tools,
            "description": SECTOR_TOOL_DESCRIPTION,
        },
        {
            "name": "ticker",
            "tools": ticker_tools,
            "description": TICKER_TOOL_DESCRIPTION,
        },
        {
            "name": "general",
            "description": "Handles general information and queries not specific to other domains",
        },
    ]
)

# Use the agent
response = invoke_multi_step_agent(
    agent, 
    "Compare the recent performance of Tesla and the overall EV market based on news"
)

Single Step Agent Architecture

Architecture

AgentFlow is built on two main architectural patterns:

  1. Single-Step Agents: Router-based delegation to specialized agents

    • Router analyzes user requests and delegates to the most appropriate specialized agent
    • Each agent can access tools relevant to its domain
    • Useful for clear-cut, domain-specific tasks
  2. Multi-Step Workflows: Sequential execution of agent-based subtasks

    • Planner breaks complex tasks into subtasks
    • Each subtask is routed to the appropriate specialized agent
    • Results are synthesized into a comprehensive response
    • Useful for complex tasks requiring multiple capabilities

Examples

See the examples directory for full working examples.

License

This project is licensed under the MIT License - see the LICENSE file for details.

Metadata

Release files for langgraph-agentflow 0.0.1

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for langgraph-agentflow 0.0.1
File Size Uploaded
langgraph_agentflow-0.0.1.tar.gz 17.2 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for langgraph-agentflow 0.0.1
File Interpreter ABI Platform
langgraph_agentflow-0.0.1-py3-none-any.whl Python 3 none any Details

Total release size: 42.9 kB

Release files / langgraph_agentflow-0.0.1.tar.gz

Download URL langgraph_agentflow-0.0.1.tar.gz
Size 17.2 kB
Tags Source
SHA-256 checksum
How to use checksums
9b65a48f78fdd97cc323ad9b822a81335f6981893766aa653bbd13cbb5bf1169
BLAKE2b-256 checksum
How to use checksums
b665653a565e4ece52184824407e640d0a9b0cbae68628deab1b7732ba3d3de5
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.12.9

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Apr 3, 2025.

Transparency log

Release files / langgraph_agentflow-0.0.1-py3-none-any.whl

Download URL langgraph_agentflow-0.0.1-py3-none-any.whl
Size 25.7 kB
Tags Python 3
SHA-256 checksum
How to use checksums
d401e8e53538f519014f5313385b663a9eeb0c27b06828baee41ecf7a53de9d4
BLAKE2b-256 checksum
How to use checksums
4c89286cbffcc75b0d4d45c269cfa43f8ea4fedb0ffe136f5aca4ce180522f82
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.12.9

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Apr 3, 2025.

Transparency log

Release history Release notifications | RSS feed

This release

0.0.1 This release

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page