AI Agent Workflow 新范式 - TextPy: 编程与提示词协作的智能工作流引擎
🚀 核心设计哲学
- 工作流 = 编程 + 提示词工程
- 编程 ⇄ 提示词
- 函数签名即工作流
🧠 工作流程
- 使用装饰器标记你需要编译的函数(这些函数不需要实现)
- TextPy 将识别他们的功能,并为其生成代码或 prompt
- 运行中,代码由执行代码的虚拟机执行( Python ),prompt 由执行 prompt 的虚拟机执行( LLM
✨ 革命性特性
- 混合执行引擎:无缝对接传统代码与 AI 能力
- 智能编译器:只需定义函数签名,自动生成自然语言指令或代码实现
- 自复制架构:轻松实现递归式工作流
👾 应用场景
** 每日 arXiv 速递 **
自动抓取 arXiv 最新论文 → 智能筛选目标领域 → 摘要中英翻译 → 数据库存储 → 生成 Markdown 报告
笔者实际应用:通过 GitHub Action 定时推送至个人博客
#只需要函数签名,以及 workflow ,AICompiler 在 Runtime 时自动生成 prompt 或 code
@code
def get_the_rss_xml_file_str(*, url: str) -> str: ...
@code(pypi=[get_the_rss_xml_file_str(url=ARXIV_URL)])
def get_all_item_in_the_rss_file(*, xml_file_str: str) -> list[dict]: ...
@text
def check_topic_is_satisfactory(*, abstrct: str, topic: str) -> bool: ...
@text
def translate_the_en_abstract_to_zh(*, abstract: str) -> str: ...
@code
def check_link_in_db(*, db_path: str, link: str) -> bool: ...
@code
def save_article_to_db(*, db_path: str, item: dict): ...
# These functions only need to be defined...
** 深度论文溯源 **
通过 arXiv ID 下载 PDF → 文本提取 → 生成摘要 → 递归处理参考文献 → 可视化知识图谱
技术亮点:所有功能(包括依赖安装)均由 AI 编译器动态生成,全程零编码!
▶️ 视频演示
