Skip to content

Conversation

@Bekaboo
Copy link
Contributor

@Bekaboo Bekaboo commented Sep 3, 2025

Closes #

📑 Description

Added private message (DM) support for multi-agent interaction.

Unlike private actions, which are only visible to the author and recipients, but not to others.
Agents can set the to field in AgentAction class to specify the recipients.

It is called private actions instead of "private messages" as the to field is not limited to the "speak" action.

Any action, e.g. "non-verbal communication", "action", or even "leave" can have such property.

This PR is based on #329.

Co-author @ruiyiw

✅ Checks

  • My pull request adheres to the code style of this project
  • My code requires changes to the documentation
  • I have updated the documentation as required
  • All the tests have passed
  • Branch name follows type/descript (e.g. feature/add-llm-agents)
  • Ready for code review

ℹ Additional Information


Note

Introduce private actions via AgentAction.to with validation and per-recipient observations; switch action space to string literals; update server, docs, examples, and tests.

  • Core changes:
    • Messages: Add AgentAction.to for private recipients with validation; to_natural_language prefixes [private to ...].
    • Env (ParallelSotopiaEnv):
      • Per-agent observation filtering for private actions via _actions_to_natural_language_for_viewer.
      • Validate actions with context (agent_names, sender) in step/astep.
      • Replace Discrete with LiteralSpace for action_type (string literals).
    • Server: Validate agent actions’ recipients; on error, notify agent and retry once.
  • Docs:
    • Describe private messages, visibility rules, and to validation in messages, envs/parallel, concepts/agents, and examples index.
    • Note action_type is now a string literal in action space.
  • Examples:
    • Add examples/experimental/multi_agents_private_dm/ (README, scripts, JSON configs) demonstrating multi-agent DMs and JSON logging.
  • Tests:
    • Add tests for private visibility and invalid recipients; adjust evaluator test names; minor benchmark test refactors.
  • Misc:
    • Minor signature cleanup in LLMAgent.act.

Written by Cursor Bugbot for commit beffe0d. This will update automatically on new commits. Configure here.

Keyu-He and others added 30 commits July 7, 2025 02:33
Refactored negotiation arena example scripts to use more explicit typing, improved agent profile retrieval logic, and removed unused OpenAI API key loading. Updated .gitignore to exclude negotiation_arena redis-data directory.
Remove separation between 2-agent and multi-agent cases by consolidating duplicate classes and logic paths into unified implementations
@Bekaboo Bekaboo force-pushed the feat-support-private-messages branch from a685992 to e4a0957 Compare November 6, 2025 05:22
@Bekaboo Bekaboo force-pushed the feat-support-private-messages branch from c64cab5 to f98e719 Compare December 6, 2025 18:34
Copy link

@cursor cursor bot left a comment

Choose a reason for hiding this comment

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

This PR is being reviewed by Cursor Bugbot

Details

You are on the Bugbot Free tier. On this plan, Bugbot will review limited PRs each billing cycle.

To receive Bugbot reviews on all of your PRs, visit the Cursor dashboard to activate Pro and start your 14-day free trial.

"agent_names": env.agents,
"sender": agent_name,
},
)
Copy link

Choose a reason for hiding this comment

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

Bug: Retry validation failure crashes without error handling

When an agent generates an invalid action with bad recipients, the code retries once by asking the agent to regenerate. However, the second AgentAction.model_validate() call at line 196-202 is not wrapped in a try-except block. If the agent still produces invalid recipients after the retry, the validation error will propagate as an uncaught exception and crash the episode. This makes the system fragile when LLM agents occasionally fail to follow the messaging protocol correctly.

Fix in Cursor Fix in Web

@Bekaboo Bekaboo force-pushed the feat-support-private-messages branch from ecc88e2 to 6a8395c Compare December 11, 2025 18:52
return "left the conversation"
action_str = "left the conversation"

return f"{recipients_prefix} {action_str}"
Copy link

Choose a reason for hiding this comment

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

Bug: Extra space in to_natural_language output formatting

The to_natural_language method in AgentAction has an extra space in the return statement. The recipients_prefix on line 140 already includes a trailing space when to is set (f"[private to {self.to}] "), but line 155 adds another space (f"{recipients_prefix} {action_str}"). This results in double spaces for private messages (e.g., "[private to ...] said:"), and a leading space for public messages (e.g., " said:"). This formatting issue will cause the test assertions in test_parallel_sotopia_env_multi_agents_private_messages to fail since they expect strings like 'agent1 said: "..."' without extra spaces.

Fix in Cursor Fix in Web

@XuhuiZhou XuhuiZhou self-requested a review December 13, 2025 22:32
@XuhuiZhou XuhuiZhou merged commit 0def793 into sotopia-lab:main Dec 13, 2025
8 checks passed
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.

4 participants