Skip to content

refactor(infra): promote OpenAI-compatible client from experimental to infra#921

Draft
garrett4wade wants to merge 10 commits intomainfrom
fw/openai
Draft

refactor(infra): promote OpenAI-compatible client from experimental to infra#921
garrett4wade wants to merge 10 commits intomainfrom
fw/openai

Conversation

@garrett4wade
Copy link
Collaborator

@garrett4wade garrett4wade commented Feb 10, 2026

Description

Promote the OpenAI-compatible client and proxy server from experimental to
production-ready status by moving them to areal/infra/. This includes adding
API key authentication for secure proxy server communication in distributed
deployments.

Related Issue

N/A

Type of Change

  • Bug fix (non-breaking change that fixes an issue)
  • New feature (non-breaking change that adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • Documentation update
  • Code refactoring (no functional changes)
  • Performance improvement
  • Test coverage improvement

Checklist

  • I have read the Contributing Guide
  • I have run formatting tools (pre-commit or manual)
  • I have run relevant unit tests and they pass
  • I have added tests for new functionality
  • I have updated documentation if needed
  • My branch is up to date with main
  • This PR introduces breaking changes (if yes, fill out details below)
  • If this PR changes documentation, I have built and previewed it locally with jb build docs
  • No critical issues raised by AI reviewers (/gemini review)

Breaking Change Details (if applicable):

N/A

Additional Context

Key changes:

  • areal/experimental/openai/areal/infra/openai/
  • areal/experimental/openai/proxy/areal/infra/proxy/
  • areal/experimental/camel/openai_model.pyareal/infra/camel/openai_model.py
  • Added API key authentication (auto-generated via secrets.token_urlsafe)
  • Added OpenAIProxyConfig.api_key to CLI args
  • Updated all imports across workflows, tests, and examples
  • Removed deprecated multi_turn_v2.py

Files changed:

  • areal/infra/openai/ - OpenAI-compatible client, cache, types
  • areal/infra/proxy/ - Proxy server with authentication
  • areal/infra/controller/rollout_controller.py:321-405 - API key generation/distribution
  • areal/api/cli_args.py - New OpenAIProxyConfig.api_key field
  • Tests relocated to areal/tests/openai_client/
  • Documentation updated in docs/

@gemini-code-assist
Copy link
Contributor

Summary of Changes

Hello @garrett4wade, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed!

This pull request refactors the project's structure by promoting the OpenAI-compatible client and related infrastructure from an experimental module to a stable infrastructure module. This change establishes the agentic workflow components as production-ready. Concurrently, it removes outdated MultiTurnWorkflow implementations that have been superseded by the new agent workflow approach, ensuring a cleaner and more maintainable codebase.

Highlights

  • Infrastructure Promotion: Promoted the OpenAI-compatible client and related infrastructure from the areal/experimental/ directory to areal/infra/, signifying its stability for production use.
  • Deprecated Code Removal: Removed deprecated MultiTurnWorkflow implementations, streamlining the codebase and removing superseded agent workflow approaches.
  • Import Path Updates: Updated all relevant import paths across the project, including core code, documentation, and examples, to reflect the new module structure.
  • Test Relocation: Relocated associated test files to align with the new areal/infra/openai/ directory structure.

🧠 New Feature in Public Preview: You can now enable Memory to help Gemini Code Assist learn from your team's feedback. This makes future code reviews more consistent and personalized to your project's style. Click here to enable Memory in your admin console.

Changelog
  • areal/api/scheduler_api.py
    • Updated a comment to reflect the new module path for proxy_rollout_server.
  • areal/api/workflow_api.py
    • Updated the import path for InteractionWithTokenLogpReward.
  • areal/experimental/camel/openai_model.py
    • Renamed to areal/infra/camel/openai_model.py.
  • areal/experimental/openai/init.py
    • Renamed to areal/infra/openai/__init__.py and updated its internal proxy import.
  • areal/experimental/openai/cache.py
    • Renamed to areal/infra/openai/cache.py and updated its internal type import.
  • areal/experimental/openai/client.py
    • Renamed to areal/infra/openai/client.py, reordered an import, and updated internal type imports.
  • areal/experimental/openai/proxy/init.py
    • Renamed to areal/infra/proxy/__init__.py.
  • areal/experimental/openai/proxy/client_session.py
    • Renamed to areal/infra/proxy/client_session.py and updated its internal type import.
  • areal/experimental/openai/proxy/proxy_rollout_server.py
    • Renamed to areal/infra/proxy/proxy_rollout_server.py, reordered imports, and updated an internal client import.
  • areal/experimental/openai/proxy/server.py
    • Renamed to areal/infra/proxy/server.py and updated internal cache and type imports.
  • areal/experimental/openai/proxy/workflow.py
    • Renamed to areal/infra/proxy/workflow.py and updated internal client and type imports.
  • areal/experimental/openai/tool_call_parser.py
    • Renamed to areal/infra/openai/tool_call_parser.py.
  • areal/experimental/openai/types.py
    • Renamed to areal/infra/openai/types.py.
  • areal/experimental/workflow/multi_turn_v2.py
    • Removed the deprecated MultiTurnWorkflow implementation.
  • areal/infra/camel/init.py
    • Added an __init__.py file to define the camel package within infra.
  • areal/infra/controller/rollout_controller.py
    • Updated the import path for proxy_rollout_server.
  • areal/infra/remote_inf_engine.py
    • Updated import statements for InteractionWithTokenLogpReward and OpenAIProxyWorkflow.
  • areal/infra/workflow_executor.py
    • Updated the import statement for InteractionWithTokenLogpReward.
  • areal/tests/experimental/openai/test_cache.py
    • Renamed to areal/tests/openai_client/test_cache.py and updated internal imports.
  • areal/tests/experimental/openai/test_client.py
    • Renamed to areal/tests/openai_client/test_client.py and updated internal imports.
  • areal/tests/experimental/openai/test_client_with_tool.py
    • Renamed to areal/tests/openai_client/test_client_with_tool.py and updated internal imports.
  • areal/tests/experimental/openai/test_concat_prompt.py
    • Renamed to areal/tests/openai_client/test_concat_prompt.py and updated internal imports.
  • areal/tests/experimental/openai/test_proxy_integration.py
    • Renamed to areal/tests/openai_client/test_proxy_integration.py and updated internal imports and a workflow path.
  • areal/tests/experimental/openai/test_tool_call_parser.py
    • Renamed to areal/tests/openai_client/test_tool_call_parser.py and updated internal imports.
  • areal/tests/experimental/openai/utils.py
    • Renamed to areal/tests/openai_client/utils.py.
  • areal/tests/openai_client/init.py
    • Added an __init__.py file to establish the new test package.
  • areal/tests/test_dynamic_import.py
    • Updated a test case to use RLVRWorkflow instead of MultiTurnWorkflow.
  • areal/tests/test_workflow_detection.py
    • Updated a workflow path to reference the new test location.
  • areal/tests/utils.py
    • Updated the import statement for InteractionWithTokenLogpReward.
  • areal/workflow/multi_turn.py
    • Removed the deprecated MultiTurnWorkflow implementation.
  • docs/reference/agent_workflow.md
    • Updated import paths and file references within the documentation.
  • docs/tutorial/agentic_rl.md
    • Updated import paths in the tutorial.
  • examples/camel/train.py
    • Updated import paths in the CAMEL example.
  • examples/multi_turn_math/gsm8k_rl_mt.py
    • Updated import paths in the multi-turn math example.
  • examples/openai_agents/train_agents.py
    • Updated import paths in the OpenAI agents example.
  • examples/search_agent/tongyi_deepresearch/react_agent.py
    • Updated import paths in the React agent example.
  • examples/search_agent/tongyi_deepresearch/train.py
    • Updated import paths in the DeepResearch train example.
Ignored Files
  • Ignored by pattern: .github/workflows/** (1)
    • .github/workflows/test-areal.yml
Activity
  • No specific review comments or activity have been recorded for this pull request yet.
Using Gemini Code Assist

The full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips.

Invoking Gemini

You can request assistance from Gemini at any point by creating a comment using either /gemini <command> or @gemini-code-assist <command>. Below is a summary of the supported commands on the current page.

Feature Command Description
Code Review /gemini review Performs a code review for the current pull request in its current state.
Pull Request Summary /gemini summary Provides a summary of the current pull request in its current state.
Comment @gemini-code-assist Responds in comments when explicitly tagged, both in pull request comments and review comments.
Help /gemini help Displays a list of available commands.

Customization

To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a .gemini/ folder in the base of the repository. Detailed instructions can be found here.

Limitations & Feedback

Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for Github and other Google products, sign up here.

You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension.

Footnotes

  1. Review the Privacy Notices, Generative AI Prohibited Use Policy, Terms of Service, and learn how to configure Gemini Code Assist in GitHub here. Gemini can make mistakes, so double check it and use code with caution.

Copy link
Contributor

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

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 refactors the OpenAI-compatible client, promoting it from the experimental stage to a stable infrastructure component by moving modules from areal/experimental to areal/infra and updating import paths. However, the promoted infrastructure contains critical security vulnerabilities. Specifically, the ProxyRolloutServer and the internal callback server in RolloutController lack authentication and expose endpoints that allow for Remote Code Execution (RCE), environment variable injection, and arbitrary file deletion. Resolve these vulnerabilities before merging. Additionally, there is a medium-severity design issue related to a circular dependency introduced between the new areal.infra.openai and areal.infra.proxy packages that should be addressed.

…o infra

Move OpenAI-compatible client infrastructure from areal/experimental/ to
areal/infra/, establishing it as stable production code. This change
reflects the maturity of the agentic workflow infrastructure.

Key changes:
- Move areal/experimental/openai/ → areal/infra/openai/
- Move areal/experimental/openai/proxy/ → areal/infra/proxy/
- Move areal/experimental/camel/ → areal/infra/camel/
- Relocate tests from areal/tests/experimental/openai/ to areal/tests/openai_client/
- Remove deprecated MultiTurnWorkflow implementations (multi_turn.py, multi_turn_v2.py)
- Update all imports across the codebase
- Add areal/tests/openai_client/ to CI test coverage
…o infra

Move areal/experimental/openai to areal/infra/openai, promoting the
OpenAI-compatible client and proxy server to production-ready status.

Key changes:
- Move openai client, cache, types, and tool_call_parser to areal/infra/openai/
- Move proxy server, client_session, and workflow to areal/infra/proxy/
- Move camel/openai_model.py to areal/infra/camel/
- Add API key authentication for proxy server communication
- Update rollout_controller to generate and distribute API keys to proxy workers
- Add OpenAIProxyConfig with api_key field to CLI args
- Update all imports across workflows, tests, and examples
- Update documentation to reflect new module paths
- Remove deprecated multi_turn_v2.py from experimental

The authentication mechanism uses auto-generated API keys (secrets.token_urlsafe)
distributed to proxy workers via environment variables, protecting the proxy
server from unauthorized access in distributed deployments.
@garrett4wade garrett4wade added the safe-to-test Ready to run unit-tests in a PR. label Feb 11, 2026
@garrett4wade garrett4wade added safe-to-test Ready to run unit-tests in a PR. and removed safe-to-test Ready to run unit-tests in a PR. labels Feb 11, 2026
@garrett4wade garrett4wade added safe-to-test Ready to run unit-tests in a PR. and removed safe-to-test Ready to run unit-tests in a PR. labels Feb 11, 2026
@garrett4wade garrett4wade added safe-to-test Ready to run unit-tests in a PR. and removed safe-to-test Ready to run unit-tests in a PR. labels Feb 11, 2026
@garrett4wade garrett4wade added safe-to-test Ready to run unit-tests in a PR. and removed safe-to-test Ready to run unit-tests in a PR. labels Feb 11, 2026
@garrett4wade garrett4wade removed the safe-to-test Ready to run unit-tests in a PR. label Feb 12, 2026
@garrett4wade garrett4wade marked this pull request as draft February 12, 2026 00:40
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.

1 participant