Skip to content

feat: add __str__ support for MultiAgentResult#1568

Open
a-sekka wants to merge 1 commit intostrands-agents:mainfrom
a-sekka:feat/multiagent-result-str
Open

feat: add __str__ support for MultiAgentResult#1568
a-sekka wants to merge 1 commit intostrands-agents:mainfrom
a-sekka:feat/multiagent-result-str

Conversation

@a-sekka
Copy link

@a-sekka a-sekka commented Jan 27, 2026

Summary

  • Add __str__ method to MultiAgentResult to allow direct string conversion, matching the existing AgentResult.__str__ behavior
  • Enables str(result) to get combined text output from all agent results without manual unwrapping
  • Handles nested MultiAgentResult, exception nodes (skipped), and empty results

Test plan

  • Unit test: single node result
  • Unit test: multiple node results
  • Unit test: empty results
  • Unit test: exception nodes are skipped
  • Unit test: nested MultiAgentResult

Closes #1561

Allow direct string conversion of MultiAgentResult, matching the
existing behavior of AgentResult. This enables users to simply call
str(result) to get the combined text output from all agent results.

Closes strands-agents#1561
Copy link
Contributor

@mkmeral mkmeral left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the review, we have recently organized the priority order of AgentResult.__str__ (added interrupts and structured output), we should match the behavior of multiagent the same way.

)
return multiagent_result

def __str__(self) -> str:
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[FEATURE] __str__ support for MultiAgentResult

2 participants