惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

Martin Fowler
Martin Fowler
WordPress大学
WordPress大学
S
SegmentFault 最新的问题
罗磊的独立博客
Apple Machine Learning Research
Apple Machine Learning Research
The Cloudflare Blog
L
LangChain Blog
博客园 - 司徒正美
G
Google Developers Blog
博客园 - 【当耐特】
GbyAI
GbyAI
月光博客
月光博客
人人都是产品经理
人人都是产品经理
D
DataBreaches.Net
大猫的无限游戏
大猫的无限游戏
A
About on SuperTechFans
Microsoft Azure Blog
Microsoft Azure Blog
V
Visual Studio Blog
D
Docker
MongoDB | Blog
MongoDB | Blog
Vercel News
Vercel News
Stack Overflow Blog
Stack Overflow Blog
Jina AI
Jina AI
博客园 - 聂微东

博客园 - 荣锋亮

pg-boss 基于pg 的node 队列job 服务 Omnigres 基于pg的开发平台 zerofs 支持native kernel client multigres pg 版的Vitess drizzle-duckdb duckdb drizzle orm client dumbodb 面向文档db 的版本管理db doltlite sqlite 的版本控制 doltgresql pg 的dolt 服务 TokenHub 基于golang 的llm proxy 服务 duckgres PostHog 开源的通过pg协议暴露duckdb服务能力 jenkins 2.568.1 publish over ssh java.lang.NoSuchMethodError: 'java.lang.Object jenkins.plugins.publish_over_ssh.BapSshHostConfiguration 问题 scriptc vercel 开源的ts 转native 编译器 itty-router 轻量的microrouter drizzle-proxy 格式简单说明 drizzle-proxy 简单说明 duckdb iceberg rest catalog连接的一个问题 supabase wrappers pg 扩展服务 ice 运行简单说明 pgnats pg 的nats 扩展 ice 轻量iceberg rest catalog 服务 zerofs v2.1.0 支持无缝的ha 以及恢复了 liteparse 的可视化引用 VaultS3 与zerofs 集成测试 VaultS3 一个轻量的s3 兼容服务 liteparse-server liteparse rest&grpc服务 smoothdb 兼容postgrest的服务 fluxbase 基于golang 开发的兼容supabase的服务 pg_durable 微软开源的基于pg 的持久运行扩展 liteparse ocr api 规范 基于litserve 以及RapidOCR扩展一个liteparse ocr 服务
llama-agents stream events 处理
荣锋亮 · 2026-05-26 · via 博客园 - 荣锋亮

llama-agents 支持stream events 处理,可以提升用户体验,同时有更好的执行情况显示

参考玩法

  • step 发送stream events
@step
async def step_three(self, ctx: Context, ev: SecondEvent) -> StopEvent:
    ctx.write_event_to_stream(ProgressEvent(msg="Step three is happening"))
    return StopEvent(result="Workflow complete.")           
  • 执行获取stream 信息
async def main():
    workflow = SimpleFlow()
    handler =  workflow.run()
    # 获取stream events 
    async for ev in handler.stream_events():
        print(ev)
    # 获取结果
    final_result = await handler
    print("Final result", final_result)

说明

llama-agents 提供的一些其他stream 事件(workflow 执行异常时候返回的),比如WorkflowTimedOutEvent,WorkflowCancelledEvent,WorkflowFailedEvent,可以更好的进行状态显示

参考资料

https://developers.llamaindex.ai/python/llamaagents/workflows/streaming/