Skip to content

armgit / letta

Public Imported from GitHub
0

Platform for stateful agents: AI with advanced memory that can learn and self-improve over time.

fix(core): patch bug in the broadcast multi-agent tool where we were not properly awating returns [LET-4484] (#4866)

Charles Packer809956d1aaf4
diff --git a/letta/services/tool_executor/multi_agent_tool_executor.py b/letta/services/tool_executor/multi_agent_tool_executor.py
index 8a5f7fea3..76747c66a 100644
--- a/letta/services/tool_executor/multi_agent_tool_executor.py
+++ b/letta/services/tool_executor/multi_agent_tool_executor.py
@@ -76,13 +76,10 @@ class LettaMultiAgentToolExecutor(ToolExecutor):
f"{message}"
)
- tasks = [
- safe_create_task(
- self._process_agent(agent_state=agent_state, message=augmented_message), label=f"process_agent_{agent_state.id}"
- )
- for agent_state in matching_agents
- ]
- results = await asyncio.gather(*tasks)
+ # Run concurrent requests and collect their return values.
+ # Note: Do not wrap with safe_create_task here — it swallows return values (returns None).
+ coros = [self._process_agent(agent_state=a_state, message=augmented_message) for a_state in matching_agents]
+ results = await asyncio.gather(*coros)
return str(results)
async def _process_agent(self, agent_state: AgentState, message: str) -> Dict[str, Any]: