Loosen Envionment.step signature to accept Message#342
Merged
sidnarayanan merged 2 commits intomainfrom Mar 17, 2026
Merged
Conversation
There was a problem hiding this comment.
Pull request overview
This PR broadens the step() action type across environments/clients to accept a generic Message, then enforces ToolRequestMessage at runtime via a shared Environment.check_action_is_tool_request() helper. It also expands the server-side /step request schema and adds tests around StepRequest deserialization and non-tool actions.
Changes:
- Update
Environment.step()signatures (and multiple concrete envs) to acceptMessageand validate tool requests at runtime. - Widen
TaskDatasetServer’sStepRequest.actionto a union ofToolRequestMessage | ToolResponseMessage | Message. - Add tests for StepRequest deserialization and for
/stepcalls with non-tool messages.
Reviewed changes
Copilot reviewed 10 out of 10 changed files in this pull request and generated 4 comments.
Show a summary per file
| File | Description |
|---|---|
| tests/test_envs.py | Adds coverage for StepRequest parsing and /step behavior with non-tool messages |
| src/aviary/functional.py | Updates functional env wrapper step signature to Message + tool-request validation |
| src/aviary/env.py | Adds check_action_is_tool_request() and changes abstract step() signature |
| src/aviary/env_client.py | Allows client step() to accept Message and adjusts error fallback behavior |
| src/aviary/dataset_server.py | Expands StepRequest schema to accept multiple message types |
| packages/notebook/src/aviary/envs/notebook/env.py | Updates env step signature + tool-request validation |
| packages/lfrqa/src/aviary/envs/lfrqa/env.py | Updates env step signature + passes validated tool request to super |
| packages/labbench/src/aviary/envs/labbench/env.py | Updates env step signature + validates tool request before super call |
| packages/hotpotqa/src/aviary/envs/hotpotqa/env.py | Updates env step signature + enforces tool-request-only at runtime |
| packages/gsm8k/src/aviary/envs/gsm8k/env.py | Updates env step signature + enforces tool-request-only at runtime |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
931cd92 to
a01e404
Compare
mskarlin
approved these changes
Mar 17, 2026
Contributor
mskarlin
left a comment
There was a problem hiding this comment.
We're freeing ourselves from the shackles
This was referenced Mar 17, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Per title, this allows environments to accept non-tool-call Messages. I've added a helper method to cast back to a tool request, so all existing environment behavior is preserved with one extra type check.