feat(workflow): add Anthropic Messages API support for RL training#840
Conversation
Summary of ChangesHello @fishcrap, 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 significantly enhances the AReaL framework by integrating support for the Anthropic Messages API. This allows users to train agents compatible with Claude models, broadening the ecosystem of large language models that can be leveraged within the platform. The changes include a new proxy endpoint for seamless format conversion and a comprehensive example demonstrating the training workflow for Anthropic-based agents. Highlights
🧠 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. Using Gemini Code AssistThe 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
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 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
|
There was a problem hiding this comment.
Code Review
This pull request introduces support for the Anthropic Messages API within the proxy rollout server and provides an example for training Claude-compatible agents. The changes involve adding necessary imports, a new FastAPI endpoint to handle Anthropic requests by converting them to OpenAI format and back using LiteLLM's AnthropicAdapter, and new example files for an Anthropic math agent and its training configuration. The implementation appears generally sound, but there are a few areas where robustness and clarity could be improved, particularly around error handling and configuration management.
b5dd7e6 to
714ca73
Compare
04fd5e2 to
99bfd7b
Compare
|
/gemini review |
Enable Anthropic-compatible agents to run through AReaL's proxy server for reinforcement learning workflows. This allows using Claude-style agents with the existing RL infrastructure. Key changes: - Add /v1/messages endpoint to proxy server with LiteLLM-based conversion - Introduce MathAgent workflow using Anthropic Messages API format - Add anthropic and litellm dependencies for API conversion
d8d8828 to
0ab4015
Compare
There was a problem hiding this comment.
Code Review
This pull request adds support for the Anthropic Messages API by introducing a new proxy endpoint and an example agent. The implementation is well-structured. My review focuses on improving error handling and logging for better debuggability, and some minor refactoring for robustness and clarity in the new agent workflow.
…real-project#840) * feat(workflow): add Anthropic Messages API support for RL training Enable Anthropic-compatible agents to run through AReaL's proxy server for reinforcement learning workflows. This allows using Claude-style agents with the existing RL infrastructure. Key changes: - Add /v1/messages endpoint to proxy server with LiteLLM-based conversion - Introduce MathAgent workflow using Anthropic Messages API format - Add anthropic and litellm dependencies for API conversion --------- Co-authored-by: 博惟 <bowei.fw@antgroup.com>
…real-project#840) * feat(workflow): add Anthropic Messages API support for RL training Enable Anthropic-compatible agents to run through AReaL's proxy server for reinforcement learning workflows. This allows using Claude-style agents with the existing RL infrastructure. Key changes: - Add /v1/messages endpoint to proxy server with LiteLLM-based conversion - Introduce MathAgent workflow using Anthropic Messages API format - Add anthropic and litellm dependencies for API conversion --------- Co-authored-by: 博惟 <bowei.fw@antgroup.com>
Description
Add Anthropic Messages API compatibility to AReaL's proxy server, enabling Claude-style agents to participate in reinforcement learning workflows.
What changed:
/v1/messagesendpoint in the proxy rollout server that accepts Anthropic-format requestsMathAgentworkflow class demonstrating single-turn math reasoning with Anthropic Messages APIWhy this change was needed:
Anthropic's Claude models use a different API format than OpenAI. This change allows researchers to use Anthropic-compatible agents (including Claude) in RL training loops without modifying their agent code. The proxy server handles format conversion transparently.
Architecture flow:
Type of Change
work as expected)
Checklist
jb build docs/gemini review)Breaking Change Details (if applicable):
This is a backward-compatible addition. Existing usage remains unchanged. The new
/v1/messagesendpoint is additive and does not affect existing/chat/completionsor/responsesendpoints.Additional Context
Files changed:
areal/experimental/openai/proxy/proxy_rollout_server.py- New/v1/messagesendpoint with request/response conversionareal/experimental/openai/proxy/server.py- AddedANTHROPIC_MESSAGES_PATHNAMEconstantareal/workflow/anthropic/math_agent.py- Example agent using Anthropic Messages APIareal/workflow/anthropic/__init__.py- Module exportspyproject.toml- AddedlitellmandanthropicdependenciesKnown limitations: