Skip to content

Conversation

@HwVanICI
Copy link
Collaborator

Description

This PR fixes bugs of the Camel example training code. In the run_agent() function of CamelMathAgent class is updated to pass the max_tokens and step_timeout parameter properly as follows.

  • Remove the "token_limit" parameter which is not accepted by CamelAgent.
  • Create a new "model_config_dict" dictionary including "max_tokens" elememnt, and pass it to the model parameter when creating ChatAgent instance.
  • Pass the "step_timeout" parameter when creating a ChatAgent instance. The "step_timeout" parameter is set using the "request_timeout" rollout configuration from yaml file to make it consistent with rollout timeout.
  • Added additional rollout configuration in the config.yaml file to set "request_timeout" which can be used to set the "step_timeout".

Related Issue

Fixes #(issue)

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)

Need help? Check the Contributing Guide or ask in
GitHub Discussions!

@gemini-code-assist
Copy link
Contributor

Summary of Changes

Hello @HwVanICI, 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 resolves critical bugs within the Camel example training code by refining how agent configuration parameters, specifically max_tokens and step_timeout, are managed. It ensures that these parameters are correctly passed to the ChatAgent and AReaLOpenAICompatibleModel instances, aligning the step_timeout with a newly introduced request_timeout setting in the configuration file. This change improves the robustness and consistency of the agent's behavior during training.

Highlights

  • Parameter Handling: Corrected the way max_tokens and step_timeout parameters are passed to CamelAgent and ChatAgent instances, ensuring proper configuration.
  • Configuration Update: Introduced a new request_timeout configuration in config.yaml to standardize the step_timeout value across the agent's operations.
  • Bug Fix: Addressed bugs in the Camel example training code related to agent parameterization, improving the stability and correctness of the agent's execution.

🧠 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 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 aims to fix parameter passing for max_tokens and step_timeout in the Camel example. The changes correctly remove the unsupported token_limit parameter and pass max_tokens via the model_config_dict. However, I've found a critical issue where an incorrect attribute name is used to fetch the request timeout, which would cause a runtime error. I've provided a suggestion to fix this. Once that's addressed, the PR should be good to go.

Comment on lines +59 to +67
rollout_engine_request_timeout = client.engine.config.rollout_engine_request_timeout

messages = data["messages"].copy()
agent = ChatAgent(
model=AReaLOpenAICompatibleModel(
openai_client=client, tokenizer=self.tokenizer, model_type="areal"
openai_client=client, tokenizer=self.tokenizer, model_type="areal",
model_config_dict=model_config_dict
),
token_limit=self.max_total_tokens,
step_timeout=rollout_engine_request_timeout
Copy link
Contributor

Choose a reason for hiding this comment

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

critical

It appears there's a typo in the attribute name used to fetch the request timeout. Based on the InferenceEngineConfig dataclass defined in areal/api/cli_args.py, the correct attribute is request_timeout, not rollout_engine_request_timeout. This will cause an AttributeError at runtime.

I've suggested a fix that uses the correct attribute and also renames the local variable for better clarity, as it's passed directly to step_timeout.

Suggested change
rollout_engine_request_timeout = client.engine.config.rollout_engine_request_timeout
messages = data["messages"].copy()
agent = ChatAgent(
model=AReaLOpenAICompatibleModel(
openai_client=client, tokenizer=self.tokenizer, model_type="areal"
openai_client=client, tokenizer=self.tokenizer, model_type="areal",
model_config_dict=model_config_dict
),
token_limit=self.max_total_tokens,
step_timeout=rollout_engine_request_timeout
step_timeout = client.engine.config.request_timeout
messages = data["messages"].copy()
agent = ChatAgent(
model=AReaLOpenAICompatibleModel(
openai_client=client, tokenizer=self.tokenizer, model_type="areal",
model_config_dict=model_config_dict
),
step_timeout=step_timeout

@HwVanICI HwVanICI changed the title 1. debug max_tokens parameter passing to CamelAgent. 2. pass setp_tim… [Bug Fix] Fix Camel example training code parameter passing issue. Dec 19, 2025
@HwVanICI HwVanICI changed the title [Bug Fix] Fix Camel example training code parameter passing issue. [Bug Fix] Fix Camel example training code parameter passing issue Dec 19, 2025
Copy link
Collaborator

@garrett4wade garrett4wade left a comment

Choose a reason for hiding this comment

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

LGTM but the code should be formatted with pre-commit. See CONTRIBUTING.md for instructions.

@garrett4wade
Copy link
Collaborator

Please respect gemini's comment as well.

@dsjang2
Copy link

dsjang2 commented Dec 24, 2025

Thank you for your feedback.
I will fix the issues and submit PR again.

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.

4 participants