Skip to content

Conversation

@snimu
Copy link
Contributor

@snimu snimu commented Jan 2, 2026

Description

Adds trajectory_id to TrajectoryStep, which is useful for training multi-agent systems. In those, there are several mostly independent, multi-turn rollouts. We want to interleave the trajectory steps for each of those rollouts for efficiency, but must keep the rollouts of the different agents separate. This PR adds a trajectory_id to enable the correct grouping and interleaving of rollouts for training.

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


Note

Adds per-step trajectory_id to enable grouping/interleaving of trajectories and wires it through state and environments.

  • Extend TrajectoryStep with trajectory_id: str
  • Initialize state["trajectory_id"] = uuid4().hex in Environment.init_state
  • Attach trajectory_id to steps in MultiTurnEnv.add_model_response and RLM sub-LLM steps (batch_id_request_id); preserve is_truncated
  • Update tests to include trajectory_id in all TrajectoryStep constructions and adjust token fields; update docs to reflect new fields

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

else:
state["oai_tools"] = []
state["trajectory"] = []
state["current_trajectory_id"] = uuid.uuid4().hex
Copy link
Member

Choose a reason for hiding this comment

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

Can this just be "trajectory_id" ?

@willccbb
Copy link
Member

willccbb commented Jan 3, 2026

@cursoragent pls change "current_trajectory_id" to just "trajectory_id"

@cursor
Copy link

cursor bot commented Jan 3, 2026

View PR

Good catch—I'll rename current_trajectory_id to trajectory_id and update all references.


Open in Cursor Open in Web

Learn more about Cursor Agents

@willccbb willccbb marked this pull request as ready for review January 3, 2026 04:58
@willccbb willccbb merged commit 77ccb16 into main Jan 3, 2026
6 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.

3 participants