Skip to content

Loosen Envionment.step signature to accept Message#342

Merged
sidnarayanan merged 2 commits intomainfrom
non-tool-messages
Mar 17, 2026
Merged

Loosen Envionment.step signature to accept Message#342
sidnarayanan merged 2 commits intomainfrom
non-tool-messages

Conversation

@sidnarayanan
Copy link
Copy Markdown
Collaborator

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.

@dosubot dosubot Bot added the size:L This PR changes 100-499 lines, ignoring generated files. label Mar 16, 2026
@dosubot dosubot Bot added the enhancement New feature or request label Mar 16, 2026
Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

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

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 accept Message and validate tool requests at runtime.
  • Widen TaskDatasetServer’s StepRequest.action to a union of ToolRequestMessage | ToolResponseMessage | Message.
  • Add tests for StepRequest deserialization and for /step calls 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.

Comment thread src/aviary/dataset_server.py
Comment thread src/aviary/env.py
Comment thread packages/hotpotqa/src/aviary/envs/hotpotqa/env.py
Comment thread tests/test_envs.py
Copy link
Copy Markdown
Contributor

@mskarlin mskarlin left a comment

Choose a reason for hiding this comment

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

We're freeing ourselves from the shackles

@sidnarayanan sidnarayanan enabled auto-merge (squash) March 17, 2026 16:36
@sidnarayanan sidnarayanan merged commit 8cc0391 into main Mar 17, 2026
5 checks passed
@sidnarayanan sidnarayanan deleted the non-tool-messages branch March 17, 2026 16:39
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request size:L This PR changes 100-499 lines, ignoring generated files.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants