AgentFlow is a Python library that automates the orchestration of multi-step agent workflows by integrating intelligent planning, routing, and execution of specialized operations.
Project description
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?")
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"
)
Architecture
AgentFlow is built on two main architectural patterns:
-
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
-
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.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
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
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
9b65a48f78fdd97cc323ad9b822a81335f6981893766aa653bbd13cbb5bf1169
|
|
| MD5 |
8e9dec1a957e93e41174128786019d6e
|
|
| BLAKE2b-256 |
b665653a565e4ece52184824407e640d0a9b0cbae68628deab1b7732ba3d3de5
|
Provenance
The following attestation bundles were made for langgraph_agentflow-0.0.1.tar.gz:
Publisher:
python-publish.yml on KameniAlexNea/langgraph-agentflow
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
langgraph_agentflow-0.0.1.tar.gz -
Subject digest:
9b65a48f78fdd97cc323ad9b822a81335f6981893766aa653bbd13cbb5bf1169 - Sigstore transparency entry: 191883588
- Sigstore integration time:
-
Permalink:
KameniAlexNea/langgraph-agentflow@3d8ed0ecddc18b014885da99d0294de34a6f7928 -
Branch / Tag:
refs/tags/langgraph-agentflow-v0.0.1 - Owner: https://github.com/KameniAlexNea
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
python-publish.yml@3d8ed0ecddc18b014885da99d0294de34a6f7928 -
Trigger Event:
release
-
Statement type:
File details
Details for the file langgraph_agentflow-0.0.1-py3-none-any.whl.
File metadata
- Download URL: langgraph_agentflow-0.0.1-py3-none-any.whl
- Upload date:
- Size: 25.7 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.12.9
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
d401e8e53538f519014f5313385b663a9eeb0c27b06828baee41ecf7a53de9d4
|
|
| MD5 |
2333df7f421348646817a549b8b80838
|
|
| BLAKE2b-256 |
4c89286cbffcc75b0d4d45c269cfa43f8ea4fedb0ffe136f5aca4ce180522f82
|
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
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
langgraph_agentflow-0.0.1-py3-none-any.whl -
Subject digest:
d401e8e53538f519014f5313385b663a9eeb0c27b06828baee41ecf7a53de9d4 - Sigstore transparency entry: 191883593
- Sigstore integration time:
-
Permalink:
KameniAlexNea/langgraph-agentflow@3d8ed0ecddc18b014885da99d0294de34a6f7928 -
Branch / Tag:
refs/tags/langgraph-agentflow-v0.0.1 - Owner: https://github.com/KameniAlexNea
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
python-publish.yml@3d8ed0ecddc18b014885da99d0294de34a6f7928 -
Trigger Event:
release
-
Statement type: