Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 21 additions & 0 deletions src/strands/multiagent/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -136,6 +136,27 @@ class MultiAgentResult:
execution_time: int = 0
interrupts: list[Interrupt] = field(default_factory=list)

def __str__(self) -> str:
"""Return a string representation of the multi-agent result.

Priority order:
1. Interrupts (if present) -> stringified list of interrupt dicts
2. Text output from all node results -> concatenated strings

Returns:
String representation based on the priority order above.
"""
if self.interrupts:
return str([interrupt.to_dict() for interrupt in self.interrupts])

parts = []
for node_result in self.results.values():
for agent_result in node_result.get_agent_results():
text = str(agent_result).strip()
if text:
parts.append(text)
return chr(10).join(parts)

@classmethod
def from_dict(cls, data: dict[str, Any]) -> "MultiAgentResult":
"""Rehydrate a MultiAgentResult from persisted JSON."""
Expand Down