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.

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

langgraph_agentflow-0.0.1.tar.gz (17.2 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

langgraph_agentflow-0.0.1-py3-none-any.whl (25.7 kB view details)

Uploaded Python 3

File details

Details for the file langgraph_agentflow-0.0.1.tar.gz.

File metadata

  • Download URL: langgraph_agentflow-0.0.1.tar.gz
  • Upload date:
  • Size: 17.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.12.9

File hashes

Hashes for langgraph_agentflow-0.0.1.tar.gz
Algorithm Hash digest
SHA256 9b65a48f78fdd97cc323ad9b822a81335f6981893766aa653bbd13cbb5bf1169
MD5 8e9dec1a957e93e41174128786019d6e
BLAKE2b-256 b665653a565e4ece52184824407e640d0a9b0cbae68628deab1b7732ba3d3de5

See more details on using hashes here.

Provenance

The following attestation bundles were made for langgraph_agentflow-0.0.1.tar.gz:

Publisher: python-publish.yml on KameniAlexNea/langgraph-agentflow

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file langgraph_agentflow-0.0.1-py3-none-any.whl.

File metadata

File hashes

Hashes for langgraph_agentflow-0.0.1-py3-none-any.whl
Algorithm Hash digest
SHA256 d401e8e53538f519014f5313385b663a9eeb0c27b06828baee41ecf7a53de9d4
MD5 2333df7f421348646817a549b8b80838
BLAKE2b-256 4c89286cbffcc75b0d4d45c269cfa43f8ea4fedb0ffe136f5aca4ce180522f82

See more details on using hashes here.

Provenance

The following attestation bundles were made for langgraph_agentflow-0.0.1-py3-none-any.whl:

Publisher: python-publish.yml on KameniAlexNea/langgraph-agentflow

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Release history Release notifications | RSS feed

This release

0.0.1 This release

2 files

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page