Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -278,13 +278,15 @@ dynamic benchmarks.

## Variables
Here's a list of relevant env. variables that are used by AgentLab:
- `OPEAI_API_KEY` which is used by default for OpenAI LLMs.
- `OPENAI_API_KEY` which is used by default for OpenAI LLMs.
- `AZURE_OPENAI_API_KEY`, used by default for AzureOpenAI LLMs.
- `AZURE_OPENAI_ENDPOINT` to specify your Azure endpoint.
- `OPENAI_API_VERSION` for the Azure API.
- `OPENROUTER_API_KEY` for the Openrouter API
- `AGENTLAB_EXP_ROOT`, desired path for your experiments to be stored, defaults to `~/agentlab-results`.
- `AGENTXRAY_SHARE_GRADIO`, which prompts AgentXRay to open a public tunnel on launch.
- `RAY_PUBLIC_DASHBOARD` (true / false), used to specify whether the ray dashboard should be made publicly accessible (`0.0.0.0`) or not (`127.0.0.1`).
- `RAY_DASHBOARD_PORT` (int), used to specify the port on which the ray dashboard should be accessible.

## Misc

Expand Down
5 changes: 4 additions & 1 deletion src/agentlab/experiments/launch_exp.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
from agentlab.experiments.loop import ExpArgs, yield_all_exp_results

RAY_PUBLIC_DASHBOARD = os.environ.get("RAY_PUBLIC_DASHBOARD", "false") == "true"
RAY_DASHBOARD_PORT = os.environ.get("RAY_DASHBOARD_PORT")
Comment on lines 11 to +12
Copy link

Choose a reason for hiding this comment

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

Hard-coded Configuration category Design

Tell me more
What is the issue?

Configuration values are defined at module level and directly dependent on environment variables, making the code less flexible and harder to test.

Why this matters

Hard-coded configuration reduces reusability and makes testing more difficult as it requires environment manipulation.

Suggested change ∙ Feature Preview

Move configuration to a dedicated config class or function:

def get_ray_config(config_dict=None):
    config = config_dict or {}
    return {
        'dashboard_public': config.get('RAY_PUBLIC_DASHBOARD', os.environ.get('RAY_PUBLIC_DASHBOARD', 'false') == 'true'),
        'dashboard_port': config.get('RAY_DASHBOARD_PORT', os.environ.get('RAY_DASHBOARD_PORT'))
    }
Provide feedback to improve future suggestions

Nice Catch Incorrect Not in Scope Not in coding standard Other

💬 Looking for more details? Reply to this comment to chat with Korbit.



def run_experiments(
Expand Down Expand Up @@ -86,7 +87,9 @@ def run_experiments(
from agentlab.experiments.graph_execution_ray import execute_task_graph, ray

ray.init(
num_cpus=n_jobs, dashboard_host="0.0.0.0" if RAY_PUBLIC_DASHBOARD else "127.0.0.1"
num_cpus=n_jobs,
dashboard_host="0.0.0.0" if RAY_PUBLIC_DASHBOARD else "127.0.0.1",
dashboard_port=None if RAY_DASHBOARD_PORT is None else int(RAY_DASHBOARD_PORT),
)
try:
execute_task_graph(exp_args_list, avg_step_timeout=avg_step_timeout)
Expand Down
Loading