Harrison Chase:异步子代理该如何通知主代理?
我们正在反复思考,如何让 deepagents 更好地原生支持异步。具体来说,就是让异步子代理运行得更好,并成为更突出的功能。
一个关键问题是:子代理完成任务后,该如何“通知”父代理?在父代理仍在运行时,我们正在考虑以下几种默认行为:
1/ 中断父代理的运行,应用子代理的更新,然后继续(基本上与“steer”相同)。
2/ 等待父代理运行结束,再将子代理的更新与其他新消息一起处理(基本上与“queue”相同)。
另一个问题是如何处理人工介入?如果主代理没有运行,而是已暂停,正在等待人类对某项操作作出明确回应,该怎么办?
a/ 等待人类回应,再把子代理的更新与该回应一起处理。
b/ 用子代理的更新恢复会话(这会取消等待人工回应的中断),随后会话可以再次请求同一项人工批准。
还有哪些选项是我们遗漏的?
对照原文
we are thinking a lot about how to make deepagents more async native. specifically about making async subagents work better/more prominent one key question is how does a finished subagent "notify" the parent agent? some default behaviors we're considering for when the parent is still running: 1/ interrupt parent run, apply subagent update, continue (basically same as "steer") 2/ wait for parent run to finish, then batch subagent update with any other new messages (basically same as "queue") another question is how to handle human in the loop? what if main agent is not running but paused and waiting explicit human response to an action? a/ wait for human to respond, then batch the subagent update with that b/ resume thread (which would cancel the human interrupt) with the subagent update (thread could then re-ask for the same human approval) any other options we're missing?