Skip to content

[DRAFT] Add RLE Support#47694

Open
novaturient95 wants to merge 1 commit into
mainfrom
ayushmishra/rle-sdk-init
Open

[DRAFT] Add RLE Support#47694
novaturient95 wants to merge 1 commit into
mainfrom
ayushmishra/rle-sdk-init

Conversation

@novaturient95

Copy link
Copy Markdown
Member

Description

Please add an informative description that covers that changes made by the pull request and link all relevant issues.

If an SDK is being regenerated based on a new API spec, a link to the pull request containing these API spec changes should be included above.

All SDK Contribution checklist:

  • The pull request does not introduce [breaking changes]
  • CHANGELOG is updated for new features, bug fixes or other significant changes.
  • I have read the contribution guidelines.

General Guidelines and Best Practices

  • Title of the pull request is clear and informative.
  • There are a small number of commits, each of which have an informative message. This means that previously merged commits do not appear in the history of the PR. For more information on cleaning up the commits in your PR, see this page.

Testing Guidelines

  • Pull request includes test coverage for the included changes.

Copilot AI review requested due to automatic review settings June 26, 2026 19:29
@novaturient95 novaturient95 changed the title Add RLE Support [DRAFT] Add RLE Support Jun 26, 2026

Copilot AI 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.

Pull request overview

This draft PR adds a new "RLE" (Reinforcement Learning Environment) client surface to azure-ai-projects. It introduces gym-style sync (RLEEnvironment) and async (AsyncRLEEnvironment) clients that lease a hosted sandbox from an RLE control plane and then drive it via reset/step/state/health/metadata/schema, plus supporting result/state models (RLEStepResult, RLEEnvState, RLEError). These symbols are exported at the top-level (azure.ai.projects) and async (azure.ai.projects.aio) namespaces via the _patch.py __all__ mechanism, with a sample and unit tests for the pure helpers.

Notably, the implementation uses its own HTTP stack (urllib for sync, aiohttp for async) and a raw bearer token rather than the azure-core transport/credential pipeline used elsewhere in the package. The PR is still draft: the description is the unfilled template, and there is no CHANGELOG entry for this new public feature.

Changes:

  • Add sync/async RLE clients and models (_patch_rle.py, _patch_rle_async.py) with bespoke HTTP transport and bearer-token auth.
  • Export the new RLE symbols from the sync and async public namespaces.
  • Add a sample (sync only) and unit tests covering the pure helper functions.

Reviewed changes

Copilot reviewed 8 out of 8 changed files in this pull request and generated 3 comments.

Show a summary per file
File Description
azure/ai/projects/operations/_patch_rle.py New sync RLE client/models; includes unused is_terminal/_TERMINAL_STATUSES and raw-token auth over a urllib transport.
azure/ai/projects/aio/operations/_patch_rle_async.py New async RLE client built on aiohttp; mirrors sync logic including the same lease-loop gap.
azure/ai/projects/_patch.py Re-exports sync RLE symbols at the top-level namespace.
azure/ai/projects/aio/_patch.py Re-exports async RLE symbols at the top-level async namespace.
azure/ai/projects/operations/_patch.py Adds RLE symbols to operations __all__.
azure/ai/projects/aio/operations/_patch.py Adds async RLE symbols to operations __all__.
samples/reinforcement_learning/sample_rle_code_rl_environment.py New sample driving a Code-RL environment via the sync client.
tests/reinforcement_learning/test_rle_models.py Unit tests for the pure helpers (from_wire, coerce_action) and public exports.

Comment on lines +267 to +269
while not lease.is_ready:
if lease.is_failed:
raise RLEError(f"sandbox {created.id} failed to start: {lease.error or 'unknown error'}")
Comment on lines +231 to +232
if token:
self._headers["Authorization"] = f"Bearer {token}"
Comment on lines +294 to +304
def reset(self, seed: Optional[int] = None, episode_id: Optional[str] = None, **extra: Any) -> RLEStepResult:
"""Start a new episode and return the initial observation."""
body: Dict[str, Any] = {
key: value for key, value in {"seed": seed, "episode_id": episode_id, **extra}.items() if value is not None
}
return RLEStepResult.from_wire(self._request("POST", "/reset", body))

@distributed_trace
def step(self, action: Any = None, **action_kwargs: Any) -> RLEStepResult:
"""Apply an action and return the resulting observation, reward, and done state."""
return RLEStepResult.from_wire(self._request("POST", "/step", {"action": coerce_action(action, action_kwargs)}))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants