Skip to content

removed simple_agent_stateful, uses fastapi to keep track of session - #44

Merged
bxyu-nvidia merged 4 commits into
mainfrom
python_math_exec_nostateful
Sep 18, 2025
Merged

bxyu-nvidia merged 4 commits into
mainfrom
python_math_exec_nostateful

Conversation

@RahulSChand

@RahulSChand RahulSChand commented Sep 12, 2025 •

Copy link
Copy Markdown
Contributor

Switch python_math_exec to use session cookies and fix tool usage

Changes

  1. Updated python_math_exec server to use built-in session cookies:

    • Removed manual session_id handling from request/response models
    • Now using request.session[SESSION_ID_KEY] for state tracking
  2. Removed simple_agent_stateful/*

To test, follow these steps from the README.md of python_math_exec

  1. Download dataset
ng_download_dataset_from_gitlab \
    +dataset_name=open_math_reasoning_problems_tool \
    +version=0.0.1 \
    +artifact_fpath=open_math_reasoning_problems_tool.jsonl \
    +output_fpath=data/open_math_reasoning_problems_tool.jsonl
  1. Start server
ng_run "+config_paths=[responses_api_agents/simple_agent/configs/simple_agent.yaml,responses_api_models/openai_model/configs/openai_model.yaml,resources_servers/python_math_exec/configs/python_math_exec.yaml]"     +simple_agent.responses_api_agents.simple_agent.resources_server.name=python_math_exec
  1. Collect trajectories
ng_collect_rollouts +agent_name=simple_agent +input_jsonl_fpath=data/open_math_reasoning_problems_tool.jsonl +output_jsonl_fpath=results/open_math_reasoning_problems_tool_output_new.jsonl +limit=1

@copy-pr-bot

copy-pr-bot Bot commented Sep 12, 2025

Copy link
Copy Markdown

This pull request requires additional validation before any workflows can run on NVIDIA's runners.

Pull request vetters can view their responsibilities here.

Contributors can view more details about this message here.

@RahulSChand
RahulSChand force-pushed the python_math_exec_nostateful branch from eab3f9e to afacdab Compare September 12, 2025 19:32
result: Optional[str] = None
# NEW: always echo the session back so the client can reuse it
session_id: str
session_id: str # keep for debugging/visibility

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.

won't this be sent to the model? if so, can we remove this?

Rahul Chand and others added 4 commits September 17, 2025 09:03
@bxyu-nvidia
bxyu-nvidia merged commit 19f86ed into main Sep 18, 2025
@bxyu-nvidia
bxyu-nvidia deleted the python_math_exec_nostateful branch September 18, 2025 21:57
abhibha-nvidia pushed a commit that referenced this pull request Sep 28, 2025
…44)

### Switch python_math_exec to use session cookies and fix tool usage

### Changes
1. Updated `python_math_exec` server to use built-in session cookies:
   - Removed manual `session_id` handling from request/response models
   - Now using `request.session[SESSION_ID_KEY]` for state tracking

2. Removed `simple_agent_stateful/*`

### To test, follow these steps from the README.md of `python_math_exec`

1. Download dataset
```
ng_download_dataset_from_gitlab \
    +dataset_name=open_math_reasoning_problems_tool \
    +version=0.0.1 \
    +artifact_fpath=open_math_reasoning_problems_tool.jsonl \
    +output_fpath=data/open_math_reasoning_problems_tool.jsonl
```

2. Start server
```
ng_run "+config_paths=[responses_api_agents/simple_agent/configs/simple_agent.yaml,responses_api_models/openai_model/configs/openai_model.yaml,resources_servers/python_math_exec/configs/python_math_exec.yaml]"     +simple_agent.responses_api_agents.simple_agent.resources_server.name=python_math_exec
```

3. Collect trajectories
```
ng_collect_rollouts +agent_name=simple_agent +input_jsonl_fpath=data/open_math_reasoning_problems_tool.jsonl +output_jsonl_fpath=results/open_math_reasoning_problems_tool_output_new.jsonl +limit=1
```

---------

Signed-off-by: Rahul Chand <[email protected]>
Co-authored-by: Rahul Chand <[email protected]>
Signed-off-by: Abhibha Gupta <[email protected]>
abhibha-nvidia pushed a commit that referenced this pull request Sep 29, 2025
…44)

### Switch python_math_exec to use session cookies and fix tool usage

### Changes
1. Updated `python_math_exec` server to use built-in session cookies:
   - Removed manual `session_id` handling from request/response models
   - Now using `request.session[SESSION_ID_KEY]` for state tracking

2. Removed `simple_agent_stateful/*`

### To test, follow these steps from the README.md of `python_math_exec`

1. Download dataset
```
ng_download_dataset_from_gitlab \
    +dataset_name=open_math_reasoning_problems_tool \
    +version=0.0.1 \
    +artifact_fpath=open_math_reasoning_problems_tool.jsonl \
    +output_fpath=data/open_math_reasoning_problems_tool.jsonl
```

2. Start server
```
ng_run "+config_paths=[responses_api_agents/simple_agent/configs/simple_agent.yaml,responses_api_models/openai_model/configs/openai_model.yaml,resources_servers/python_math_exec/configs/python_math_exec.yaml]"     +simple_agent.responses_api_agents.simple_agent.resources_server.name=python_math_exec
```

3. Collect trajectories
```
ng_collect_rollouts +agent_name=simple_agent +input_jsonl_fpath=data/open_math_reasoning_problems_tool.jsonl +output_jsonl_fpath=results/open_math_reasoning_problems_tool_output_new.jsonl +limit=1
```

---------

Signed-off-by: Rahul Chand <[email protected]>
Co-authored-by: Rahul Chand <[email protected]>
Signed-off-by: Abhibha Gupta <[email protected]>
abubakaria56 pushed a commit to abubakaria56/Gym that referenced this pull request Mar 2, 2026
…VIDIA-NeMo#44)

### Switch python_math_exec to use session cookies and fix tool usage

### Changes
1. Updated `python_math_exec` server to use built-in session cookies:
   - Removed manual `session_id` handling from request/response models
   - Now using `request.session[SESSION_ID_KEY]` for state tracking
   
2. Removed `simple_agent_stateful/*`

### To test, follow these steps from the README.md of `python_math_exec`

1. Download dataset
```
ng_download_dataset_from_gitlab \
    +dataset_name=open_math_reasoning_problems_tool \
    +version=0.0.1 \
    +artifact_fpath=open_math_reasoning_problems_tool.jsonl \
    +output_fpath=data/open_math_reasoning_problems_tool.jsonl
```


2. Start server 
```
ng_run "+config_paths=[responses_api_agents/simple_agent/configs/simple_agent.yaml,responses_api_models/openai_model/configs/openai_model.yaml,resources_servers/python_math_exec/configs/python_math_exec.yaml]"     +simple_agent.responses_api_agents.simple_agent.resources_server.name=python_math_exec
```


3. Collect trajectories
```
ng_collect_rollouts +agent_name=simple_agent +input_jsonl_fpath=data/open_math_reasoning_problems_tool.jsonl +output_jsonl_fpath=results/open_math_reasoning_problems_tool_output_new.jsonl +limit=1
```

---------

Signed-off-by: Rahul Chand <[email protected]>
Co-authored-by: Rahul Chand <[email protected]>
abubakaria56 pushed a commit to abubakaria56/Gym that referenced this pull request Mar 2, 2026
…VIDIA-NeMo#44)

### Switch python_math_exec to use session cookies and fix tool usage

### Changes
1. Updated `python_math_exec` server to use built-in session cookies:
   - Removed manual `session_id` handling from request/response models
   - Now using `request.session[SESSION_ID_KEY]` for state tracking
   
2. Removed `simple_agent_stateful/*`

### To test, follow these steps from the README.md of `python_math_exec`

1. Download dataset
```
ng_download_dataset_from_gitlab \
    +dataset_name=open_math_reasoning_problems_tool \
    +version=0.0.1 \
    +artifact_fpath=open_math_reasoning_problems_tool.jsonl \
    +output_fpath=data/open_math_reasoning_problems_tool.jsonl
```


2. Start server 
```
ng_run "+config_paths=[responses_api_agents/simple_agent/configs/simple_agent.yaml,responses_api_models/openai_model/configs/openai_model.yaml,resources_servers/python_math_exec/configs/python_math_exec.yaml]"     +simple_agent.responses_api_agents.simple_agent.resources_server.name=python_math_exec
```


3. Collect trajectories
```
ng_collect_rollouts +agent_name=simple_agent +input_jsonl_fpath=data/open_math_reasoning_problems_tool.jsonl +output_jsonl_fpath=results/open_math_reasoning_problems_tool_output_new.jsonl +limit=1
```

---------

Signed-off-by: Rahul Chand <[email protected]>
Co-authored-by: Rahul Chand <[email protected]>
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.

2 participants