Skip to content

[RLlib] Clarify extra model output docstrings#63524

Merged
ArturNiederfahrenhorst merged 1 commit into
ray-project:masterfrom
GoparapukethaN:clarify-extra-model-outputs-docstring
Jun 3, 2026
Merged

[RLlib] Clarify extra model output docstrings#63524
ArturNiederfahrenhorst merged 1 commit into
ray-project:masterfrom
GoparapukethaN:clarify-extra-model-outputs-docstring

Conversation

@GoparapukethaN

Copy link
Copy Markdown
Contributor

Why

set_extra_model_outputs currently asserts that the provided key already exists before calling InfiniteLookbackBuffer.set. The docstrings for SingleAgentEpisode and MultiAgentEpisode also said the method could insert a new key, which made the behavior ambiguous.

This updates the docstrings to describe the current overwrite-only behavior.

Closes #63217

Tests

Not run. Documentation-only change.

@GoparapukethaN GoparapukethaN requested a review from a team as a code owner May 19, 2026 21:25

@gemini-code-assist gemini-code-assist Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Code Review

This pull request updates the docstrings for the set_extra_model_outputs method in both MultiAgentEpisode and SingleAgentEpisode to clarify that the method is intended for overriding existing keys rather than inserting new ones. The review feedback suggests further refining these docstrings to correctly reflect that extra_model_outputs are stored within individual agents in the multi-agent context and to improve the phrasing for better readability in the single-agent context.

Comment thread rllib/env/multi_agent_episode.py Outdated
Comment on lines +2049 to +2050
key: The existing `key` within `self.extra_model_outputs` to override
data on.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

medium

The docstring refers to self.extra_model_outputs, but MultiAgentEpisode does not have an extra_model_outputs attribute (it is stored within the individual SingleAgentEpisode objects). It is clearer to refer to the extra_model_outputs dictionary of each agent.

Suggested change
key: The existing `key` within `self.extra_model_outputs` to override
data on.
key: The existing `key` within each agent's `extra_model_outputs` dict
to override data on.

Comment thread rllib/env/single_agent_episode.py Outdated
Comment on lines +1363 to +1364
postprocessing steps, the entirety (or a slice) of an existing episode
`extra_model_outputs` entry might have to be rewritten, which is when

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

medium

The phrasing "existing episode extra_model_outputs entry" is slightly awkward. Referring to an "existing entry in the episode's extra_model_outputs" improves readability and clarity.

Suggested change
postprocessing steps, the entirety (or a slice) of an existing episode
`extra_model_outputs` entry might have to be rewritten, which is when
postprocessing steps, the entirety (or a slice) of an existing entry in
the episode's `extra_model_outputs` might have to be rewritten, which is when

Signed-off-by: GoparapukethaN <goparapukethan01@gmail.com>
@GoparapukethaN GoparapukethaN force-pushed the clarify-extra-model-outputs-docstring branch from d050e51 to a708514 Compare May 19, 2026 22:02
@GoparapukethaN

Copy link
Copy Markdown
Contributor Author

Thanks for the review. I updated the wording to make the single-agent overwrite behavior clearer and to avoid implying that MultiAgentEpisode owns the extra model output buffers directly. I also refreshed the commit with a DCO sign-off.

@ray-gardener ray-gardener Bot added rllib RLlib related issues docs An issue or change related to documentation community-contribution Contributed by the community labels May 20, 2026
@pseudo-rnd-thoughts pseudo-rnd-thoughts added the go add ONLY when ready to merge, run all tests label Jun 3, 2026

@pseudo-rnd-thoughts pseudo-rnd-thoughts left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

LGTM, thanks for the PR @GoparapukethaN

@ArturNiederfahrenhorst ArturNiederfahrenhorst enabled auto-merge (squash) June 3, 2026 13:46
@ArturNiederfahrenhorst ArturNiederfahrenhorst merged commit 66f8538 into ray-project:master Jun 3, 2026
12 checks passed
rueian pushed a commit to rueian/ray that referenced this pull request Jun 4, 2026
## Why

`set_extra_model_outputs` currently asserts that the provided key
already exists before calling `InfiniteLookbackBuffer.set`. The
docstrings for `SingleAgentEpisode` and `MultiAgentEpisode` also said
the method could insert a new key, which made the behavior ambiguous.

This updates the docstrings to describe the current overwrite-only
behavior.

Closes ray-project#63217

## Tests

Not run. Documentation-only change.

Signed-off-by: GoparapukethaN <goparapukethan01@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

community-contribution Contributed by the community docs An issue or change related to documentation go add ONLY when ready to merge, run all tests rllib RLlib related issues

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[RLlib] set_extra_model_outputs docstring and code mismatch

3 participants