Skip to content

feat(multiagent): add __str__ support to MultiAgentResult#2057

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

feat(multiagent): add __str__ support to MultiAgentResult#2057
Zelys-DFKH wants to merge 1 commit intostrands-agents:mainfrom
Zelys-DFKH:feat/multiagent-result-str

Conversation

@Zelys-DFKH
Copy link
Copy Markdown

Description

MultiAgentResult had no __str__ method. AgentResult already supports str(result) directly at agent_result.py:47, but the multi-agent equivalent required manually unwrapping nested results to get string output.

This adds __str__ to MultiAgentResult following the same priority order as AgentResult:

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

Now str(multi_agent_result) works the same as str(agent_result).

Related Issues

Fixes #1561

Documentation PR

N/A

Type of Change

New feature

Testing

  • Python syntax validated
  • Follows the same pattern as AgentResult.str
  • Handles interrupts first, then collects from all node results

Checklist

  • I have read the CONTRIBUTING document
  • My changes follow the coding style and patterns of this project

By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.

MultiAgentResult previously had no __str__ method, requiring users to
manually unwrap nested results to get string output. AgentResult already
supports str(result) directly.

Now str(multi_agent_result) returns:
- Interrupt descriptions if any interrupts are present
- Concatenated text output from all node results otherwise

Matches the priority order and pattern used by AgentResult.__str__.

Fixes strands-agents#1561
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

1 participant