Deprecated: Function get_magic_quotes_gpc() is deprecated in /hermes/walnacweb04/walnacweb04ab/b2791/pow.jasaeld/htdocs/De1337/nothing/index.php on line 99

Deprecated: The each() function is deprecated. This message will be suppressed on further calls in /hermes/walnacweb04/walnacweb04ab/b2791/pow.jasaeld/htdocs/De1337/nothing/index.php on line 619

Warning: Cannot modify header information - headers already sent by (output started at /hermes/walnacweb04/walnacweb04ab/b2791/pow.jasaeld/htdocs/De1337/nothing/index.php:99) in /hermes/walnacweb04/walnacweb04ab/b2791/pow.jasaeld/htdocs/De1337/nothing/index.php on line 1169

Warning: Cannot modify header information - headers already sent by (output started at /hermes/walnacweb04/walnacweb04ab/b2791/pow.jasaeld/htdocs/De1337/nothing/index.php:99) in /hermes/walnacweb04/walnacweb04ab/b2791/pow.jasaeld/htdocs/De1337/nothing/index.php on line 1176

Warning: Cannot modify header information - headers already sent by (output started at /hermes/walnacweb04/walnacweb04ab/b2791/pow.jasaeld/htdocs/De1337/nothing/index.php:99) in /hermes/walnacweb04/walnacweb04ab/b2791/pow.jasaeld/htdocs/De1337/nothing/index.php on line 1176

Warning: Cannot modify header information - headers already sent by (output started at /hermes/walnacweb04/walnacweb04ab/b2791/pow.jasaeld/htdocs/De1337/nothing/index.php:99) in /hermes/walnacweb04/walnacweb04ab/b2791/pow.jasaeld/htdocs/De1337/nothing/index.php on line 1176

Warning: Cannot modify header information - headers already sent by (output started at /hermes/walnacweb04/walnacweb04ab/b2791/pow.jasaeld/htdocs/De1337/nothing/index.php:99) in /hermes/walnacweb04/walnacweb04ab/b2791/pow.jasaeld/htdocs/De1337/nothing/index.php on line 1176

Warning: Cannot modify header information - headers already sent by (output started at /hermes/walnacweb04/walnacweb04ab/b2791/pow.jasaeld/htdocs/De1337/nothing/index.php:99) in /hermes/walnacweb04/walnacweb04ab/b2791/pow.jasaeld/htdocs/De1337/nothing/index.php on line 1176

Warning: Cannot modify header information - headers already sent by (output started at /hermes/walnacweb04/walnacweb04ab/b2791/pow.jasaeld/htdocs/De1337/nothing/index.php:99) in /hermes/walnacweb04/walnacweb04ab/b2791/pow.jasaeld/htdocs/De1337/nothing/index.php on line 1176

Warning: Cannot modify header information - headers already sent by (output started at /hermes/walnacweb04/walnacweb04ab/b2791/pow.jasaeld/htdocs/De1337/nothing/index.php:99) in /hermes/walnacweb04/walnacweb04ab/b2791/pow.jasaeld/htdocs/De1337/nothing/index.php on line 1176

Warning: Cannot modify header information - headers already sent by (output started at /hermes/walnacweb04/walnacweb04ab/b2791/pow.jasaeld/htdocs/De1337/nothing/index.php:99) in /hermes/walnacweb04/walnacweb04ab/b2791/pow.jasaeld/htdocs/De1337/nothing/index.php on line 1176

Warning: Cannot modify header information - headers already sent by (output started at /hermes/walnacweb04/walnacweb04ab/b2791/pow.jasaeld/htdocs/De1337/nothing/index.php:99) in /hermes/walnacweb04/walnacweb04ab/b2791/pow.jasaeld/htdocs/De1337/nothing/index.php on line 1176

Warning: Cannot modify header information - headers already sent by (output started at /hermes/walnacweb04/walnacweb04ab/b2791/pow.jasaeld/htdocs/De1337/nothing/index.php:99) in /hermes/walnacweb04/walnacweb04ab/b2791/pow.jasaeld/htdocs/De1337/nothing/index.php on line 1176

Warning: Cannot modify header information - headers already sent by (output started at /hermes/walnacweb04/walnacweb04ab/b2791/pow.jasaeld/htdocs/De1337/nothing/index.php:99) in /hermes/walnacweb04/walnacweb04ab/b2791/pow.jasaeld/htdocs/De1337/nothing/index.php on line 1176

Warning: Cannot modify header information - headers already sent by (output started at /hermes/walnacweb04/walnacweb04ab/b2791/pow.jasaeld/htdocs/De1337/nothing/index.php:99) in /hermes/walnacweb04/walnacweb04ab/b2791/pow.jasaeld/htdocs/De1337/nothing/index.php on line 1176

Warning: Cannot modify header information - headers already sent by (output started at /hermes/walnacweb04/walnacweb04ab/b2791/pow.jasaeld/htdocs/De1337/nothing/index.php:99) in /hermes/walnacweb04/walnacweb04ab/b2791/pow.jasaeld/htdocs/De1337/nothing/index.php on line 1176

Warning: Cannot modify header information - headers already sent by (output started at /hermes/walnacweb04/walnacweb04ab/b2791/pow.jasaeld/htdocs/De1337/nothing/index.php:99) in /hermes/walnacweb04/walnacweb04ab/b2791/pow.jasaeld/htdocs/De1337/nothing/index.php on line 1176

Warning: Cannot modify header information - headers already sent by (output started at /hermes/walnacweb04/walnacweb04ab/b2791/pow.jasaeld/htdocs/De1337/nothing/index.php:99) in /hermes/walnacweb04/walnacweb04ab/b2791/pow.jasaeld/htdocs/De1337/nothing/index.php on line 1176

Warning: Cannot modify header information - headers already sent by (output started at /hermes/walnacweb04/walnacweb04ab/b2791/pow.jasaeld/htdocs/De1337/nothing/index.php:99) in /hermes/walnacweb04/walnacweb04ab/b2791/pow.jasaeld/htdocs/De1337/nothing/index.php on line 1176

Warning: Cannot modify header information - headers already sent by (output started at /hermes/walnacweb04/walnacweb04ab/b2791/pow.jasaeld/htdocs/De1337/nothing/index.php:99) in /hermes/walnacweb04/walnacweb04ab/b2791/pow.jasaeld/htdocs/De1337/nothing/index.php on line 1176

Warning: Cannot modify header information - headers already sent by (output started at /hermes/walnacweb04/walnacweb04ab/b2791/pow.jasaeld/htdocs/De1337/nothing/index.php:99) in /hermes/walnacweb04/walnacweb04ab/b2791/pow.jasaeld/htdocs/De1337/nothing/index.php on line 1176

Warning: Cannot modify header information - headers already sent by (output started at /hermes/walnacweb04/walnacweb04ab/b2791/pow.jasaeld/htdocs/De1337/nothing/index.php:99) in /hermes/walnacweb04/walnacweb04ab/b2791/pow.jasaeld/htdocs/De1337/nothing/index.php on line 1176

Warning: Cannot modify header information - headers already sent by (output started at /hermes/walnacweb04/walnacweb04ab/b2791/pow.jasaeld/htdocs/De1337/nothing/index.php:99) in /hermes/walnacweb04/walnacweb04ab/b2791/pow.jasaeld/htdocs/De1337/nothing/index.php on line 1176
8000 GitHub - jianduo1/agnflow: 🔥 AgnFlow: AI-Oriented Python Workflow Framework | Flexible Loops (Auto-Exit), No-Code Visual DAG for Rapid Agent Development
Nothing Special   »   [go: up one dir, main page]

Skip to content

🔥 AgnFlow: AI-Oriented Python Workflow Framework | Flexible Loops (Auto-Exit), No-Code Visual DAG for Rapid Agent Development

Notifications You must be signed in to change notification settings

jianduo1/agnflow

Repository files navigation

🚀 AgnFlow

Efficient lightweight Python Agent Workflow Engine
高效轻é‡çš„ Python æ™ºèƒ½ä½“å·¥ä½ 8000 œæµå¼•擎

Support Sync/Async Nodes, Branching Loops, Visual Flowcharts | Build Agent Task Flows Fast
支æŒåŒæ­¥/异步节点ã€åˆ†æ”¯å¾ªçޝã€å¯è§†åŒ–æµç¨‹å›¾ | 快速æ­å»º Agent 任务æµ

Star MIT License Docs PyPI Downloads Python 3.11+ Discord Frontend-AgnChat


agnflow Code Example agnflow Log Output agnflow Mermaid Flowchart

💻 Code → 📊 Log → 🎨 Flowchart - Complete development agent workflow visualization in minutes
💻 ä»£ç  â†’ 📊 日志 → 🎨 æµç¨‹å›¾ - 快速开å‘夿‚的智能体工作æµå¯è§†åŒ–


English Documentation

âš¡ Quick Start - Minimalist Syntax

from typing import TypedDict
from agnflow import Node, Flow

# Define state
class State(TypedDict):
  message: str

# Define nodes
start = Node(
  name="start",
  exec=lambda s: ("process", {"message": "Hello"}) # Instantiate Node, specify exec
)
class ProcessNode(Node): # Inherit Node, override exec
  def exec(state: State):
    # Route to end node and update message state
    return "end", {"message": s["message"] + " World"}
process = ProcessNode() # No name specified, automatically gets variable name "process"
end = Node(exec=print) # Print state

# Create workflow
flow = Flow(start >> process >> end)

# Run workflow
state: State = {"message": ""}
flow.run(state)  # Output: {'message': 'Hello World'}

🤖 Static Web Chat Room Experience - Visit Backend Interface http://127.0.0.1:8000/en

from agnflow.chatbot.server import Server

server = Server()
server.run()
Deep Thinking Process Code Generation

🧠 Structured reasoning with step-by-step thinking process | 💻 Intelligent code generation with detailed explanations

🎨 Automatic Flow Visualization

flow.render_mermaid(saved_file="flow.png")  # Directly generate image
Complex Connection Supervisor Agent Runtime Management
n1 >> [n2 >> n3, n3 >> n4] >> n5 s1[n1, n2, n3] >> n4 flow += new_node
flow -= old_node
Complex Connection Supervisor Agent Runtime Management

🔄 Runtime Node Management

# Add/Remove nodes at runtime
flow += new_node
flow -= old_node

# Symmetric connect/disconnect syntax
a >> b >> c    # Connect nodes
a - b - c      # Symmetrically disconnect

🚀 Advanced Flow Control

  • Sync/Async Mixed: n = Node(exec=sync_func, aexec=async_func)
  • Branch/Loop: n1 >> [n2, n3] >> n1 (n1 points to n2 and n3, n2 and n3 point to n1)
  • Swarm Agent: s = Swarm(); s[n1, n2, n3] >> n4 (n1, n2, n3 are fully connected inside s)
  • Parallel Flow: pf = ParallelFlow(); pf[n1, n2, n3] (Execute child nodes concurrently)
  • Human Review: CLI/API intervention with hitl

📦 Installation

pip install agnflow

中文文档

1. âš¡ 快速开始 - æžç®€è¯­æ³•

from typing import TypedDict
from agnflow import Node, Flow

# 定义状æ€
class State(TypedDict):
  message: str

# 定义节点
start = Node(
  name="start",
  exec=lambda s: ("process", {"message": "Hello"}) # 实例化 Node,指定 exec
)
class ProcessNode(Node): # 继承 Node,é‡å†™ exec
  def exec(state: State):
    # 路由到 end 节点,并且更新 message 状æ€ï¼Œ
    return "end", {"message": s["message"] + " World"}
process = ProcessNode() #  没有指定 name 属性,自动获å–实例化å˜é‡å "process"
end = Node(exec=print) # æ‰“å° state

# 创建工作æµ
flow = Flow(start >> process >> end)

# è¿è¡Œå·¥ä½œæµ
state: State = {"message": ""}
flow.run(state)  # 输出: {'message': 'Hello World'}

2. 🤖 陿€ Web èŠå¤©å®¤ä½“验 - 访问åŽç«¯æŽ¥å£ http://127.0.0.1:8000/zh

from agnflow.chatbot.server import Server

server = Server()
server.run()
深度æ€è€ƒè¿‡ç¨‹ 代ç ç”Ÿæˆ

🧠 结构化推ç†ï¼Œæ¯ä¸€æ­¥éƒ½æœ‰æ¸…æ™°çš„æ€è€ƒè¿‡ç¨‹ | 💻 智能代ç ç”Ÿæˆï¼Œæä¾›è¯¦ç»†è§£é‡Š

3. 🎨 自动å¯è§†åŒ–æµç¨‹å›¾

flow.render_mermaid(saved_file="flow.png")  # 直接生æˆå›¾ç‰‡
夿‚连接 监ç£è€…智能体 è¿è¡ŒæœŸç®¡ç†
n1 >> [n2 >> n3, n3 >> n4] >> n5 s1[n1, n2, n3] >> n4 flow += new_node
flow -= old_node
夿‚连接 蜂群智能体 è¿è¡ŒæœŸç®¡ç†

4. 🔄 è¿è¡ŒæœŸåЍæ€èŠ‚ç‚¹ç®¡ç†

# è¿è¡ŒæœŸå¢žåˆ èŠ‚ç‚¹
flow += new_node
flow -= old_node

# 对称的连接/断开语法
a >> b >> c    # 建立连接
a - b - c      # 对称断开

5. 🚀 高级æµç¨‹æŽ§åˆ¶

  • åŒæ­¥/异步混åˆ: n = Node(exec=sync_func, aexec=async_func)
  • 分支/循环: n1 >> [n2, n3] >> n1(n1 æŒ‡å‘ n2 å’Œ n3,n2 å’Œ n3 æŒ‡å‘ n1)
  • 蜂群智能体: s = Swarm(); s[n1, n2, n3] >> n4(s 内部的 n1,n2,n3 全互连)
  • 并行工作æµ: pf = ParallelFlow(); pf[n1, n2, n3]ï¼ˆå¹¶å‘æ‰§è¡Œå¤šä¸ªå­èŠ‚ç‚¹ï¼‰
  • 人工审核: CLI/API 介入 hitl

6. 📦 安装

pip install agnflow

📚 学习文档 Documentation

访问我们的文档获å–:
Visit our documentation for:

  • 详细教程和示例 Detailed tutorials and examples
  • API å‚考 API reference
  • 最佳实践 Best practices
  • 高级用法 Advanced usage

🤠贡献 Contributing

我们欢迎贡献ï¼è¯·éšæ—¶æäº¤ Pull Request。
We welcome contributions! Please feel free to submit a Pull Request.

📄 许å¯è¯ License

本项目基于 MIT 许å¯è¯ - 查看 LICENSE 文件了解详情。
This project is licensed under the MIT License - see the LICENSE file for details.


📞 è”系方å¼ä¸Žç¤¾åŒº

💬 加入我们的社区,å‚ä¸Žè®¨è®ºã€æé—®å’Œå作ï¼

个人微信二维ç 
个人微信
直接è”系维护者
社群微信群二维ç 
å¼€å‘者社群
加入我们的开å‘者社区

æ¬¢è¿Žéšæ—¶è”系我们,æå‡ºé—®é¢˜ã€å»ºè®®æˆ–åªæ˜¯æ‰“个招呼ï¼ðŸ‘‹


If you find this project helpful, please give it a â­ï¸ Star!
如果这个项目对你有帮助,请给它一个 â­ï¸ Starï¼
Your support is my motivation to keep improving 💪

ä½ çš„æ”¯æŒæ˜¯æˆ‘æŒç»­æ”¹è¿›çš„动力 💪


About

🔥 AgnFlow: AI-Oriented Python Workflow Framework | Flexible Loops (Auto-Exit), No-Code Visual DAG for Rapid Agent Development

Topics

Resources

Stars

Watchers

Forks

Packages

No packages published
0