展示HN:PicoFlow – 一个用于LLM代理工作流的小型DSL风格Python库
嗨,HN,我正在尝试一个名为PicoFlow的小型Python库,用于构建使用轻量级DSL的LLM代理工作流。
我一直在使用像LangChain和CrewAI这样的工具,想探索一种更简单、更面向功能的方式来组合代理逻辑,更接近于普通的Python控制流和异步函数。
PicoFlow的重点在于:
- 使用操作符组合异步函数
- 核心功能最小,学习概念较少
- 通过共享上下文实现明确的数据流
- 易于嵌入现有服务
一个典型的工作流如下所示:
```
flow = plan >> retrieve >> answer
await flow(ctx)
```
像循环和分支/合并这样的模式也被表示为操作符,而不是单独的图形或配置层。
这仍然处于早期阶段,且非常具有学习性质。我非常欢迎对DSL设计、缺失的基本元素,或这种风格是否对实际代理工作负载有用的任何反馈。
仓库链接:https://github.com/the-picoflow/picoflow
查看原文
Hi HN, I’m experimenting with a small Python library called PicoFlow for building
LLM agent workflows using a lightweight DSL.<p>I’ve been using tools like LangChain and CrewAI, and wanted to explore a simpler,
more function-oriented way to compose agent logic, closer to normal Python control
flow and async functions.<p>PicoFlow focuses on:
- composing async functions with operators
- minimal core and few concepts to learn
- explicit data flow through a shared context
- easy embedding into existing services<p>A typical flow looks like:<p><pre><code> flow = plan >> retrieve >> answer
await flow(ctx)
</code></pre>
Patterns like looping and fork/merge are also expressed as operators rather than
separate graph or config layers.<p>This is still early and very much a learning project. I’d really appreciate any
feedback on the DSL design, missing primitives, or whether this style feels useful
for real agent workloads.<p>Repo: https://github.com/the-picoflow/picoflow