Skip to content
Snippets Groups Projects
Unverified Commit cb8d535d authored by Huu Le's avatar Huu Le Committed by GitHub
Browse files

fix: don't write the StopEvent from sub task to the stream (#319)

parent 811cb13c
No related branches found
No related tags found
No related merge requests found
---
"create-llama": patch
---
Fix only produces one agent event
......@@ -129,7 +129,9 @@ class StructuredPlannerAgent(Workflow):
)
# bubble all events while running the executor to the planner
async for event in handler.stream_events():
ctx.write_event_to_stream(event)
# Don't write the StopEvent from sub task to the stream
if type(event) is not StopEvent:
ctx.write_event_to_stream(event)
result: AgentRunResult = await handler
if self._verbose:
print("=== Done executing sub task ===\n")
......
......@@ -133,5 +133,7 @@ Review:
handler = agent.run(input=input, streaming=streaming)
# bubble all events while running the executor to the planner
async for event in handler.stream_events():
ctx.write_event_to_stream(event)
# Don't write the StopEvent from sub task to the stream
if type(event) is not StopEvent:
ctx.write_event_to_stream(event)
return await handler
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment