Skip to content

WIP: Multi-agent support: Agent, Protocol, MultiAgentEnv#871

Draft
nph4rd wants to merge 5 commits intoPrimeIntellect-ai:mainfrom
nph4rd:multiagent-env-compat
Draft

WIP: Multi-agent support: Agent, Protocol, MultiAgentEnv#871
nph4rd wants to merge 5 commits intoPrimeIntellect-ai:mainfrom
nph4rd:multiagent-env-compat

Conversation

@nph4rd
Copy link

@nph4rd nph4rd commented Feb 8, 2026

Description

Adds foundational abstractions for multi-agent turn-based environments:

  • Agent: Dataclass representing a participant (id, system_prompt, is_trainable)
  • Protocol: ABC defining turn order (get_initial_agent, get_next_agent)
  • RoundRobinProtocol: Concrete implementation for sequential turns
  • MultiAgentEnv: Base class extending MultiTurnEnv with multi-agent support

Additional fix: get_prompt_ids() now correctly handles multi-agent tokenization by finding the previous turn for the current agent instead of using the global last trajectory step. This prevents empty message errors when agents interleave turns during training.

Design goals:

  • Protocol is required to encourage reusable turn-order logic
  • Minimal but extensible - can add simultaneous moves, state splitting, harness etc. later

Type of Change

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • Documentation update
  • Test improvement

Testing

  • All existing tests pass when running uv run pytest locally.
  • New tests have been added to cover the changes

Checklist

  • My code follows the style guidelines of this project as outlined in AGENTS.md
  • I have performed a self-review of my own code
  • I have commented my code, particularly in hard-to-understand areas
  • I have made corresponding changes to the documentation
  • My changes generate no new warnings
  • Any dependent changes have been merged and published

Additional Notes

@nph4rd nph4rd force-pushed the multiagent-env-compat branch from 84755e4 to e7bc283 Compare February 9, 2026 23:39
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.

1 participant

Comments