Skip to content

feat(agent-team): add team worker report loop#1841

Open
YingchaoX wants to merge 1 commit into
agentscope-ai:mainfrom
YingchaoX:feat/issue-1797-team-report-loop
Open

feat(agent-team): add team worker report loop#1841
YingchaoX wants to merge 1 commit into
agentscope-ai:mainfrom
YingchaoX:feat/issue-1797-team-report-loop

Conversation

@YingchaoX

Copy link
Copy Markdown
Contributor

AgentScope Version

2.0.1

Description

Closes #1797.

This PR adds a bounded report loop for Agent Team workers so a team member does not silently finish a task without notifying the leader.

Background:
When a worker completes its assigned task, it is expected to call TeamSay to report the result back to the team leader. In practice, the model can sometimes produce a private final answer and exit without calling TeamSay, leaving the leader waiting and the team task stuck.

Changes made:

  • Added TeamReportMiddleware under agentscope.app.middleware.
  • Attached the middleware only to team worker agents created with source == "team".
  • Added structured team_say metadata to successful TeamSay results so middleware can tell whether the leader was actually notified.
  • Treat direct worker-to-leader messages and worker broadcasts as satisfying the report contract.
  • Keep reminders bounded to avoid infinite loops.
  • Added unit coverage for silent worker finishes, successful reports, peer-only messages, state reset between replies, TeamSay metadata, and ChatService middleware assembly.

How to test:

  • Ran local checks:
    • uv run pre-commit run --all-files
    • uv run pytest tests/middleware_test.py tests/service_team_tools_test.py tests/service_chat_middleware_test.py
  • Ran local code e2e testing for the Agent Team report flow.
  • Ran browser/page e2e testing through the local web UI.
  • Verified with screenshots from the page e2e test.
截屏2026-06-09 20 54 44 截屏2026-06-09 20 55 03

Checklist

  • An issue has been created for this PR
  • I have read the CONTRIBUTING.md
  • Docstrings are in Google style
  • Related documentation has been updated (e.g. links, examples, etc.) in documentation repository
  • Code is ready for review

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

feat(agent-team): add ralph loop for team members to ensure task completion

1 participant