Skip to content

Add modular agentic env gen e2e runner script#796

Merged
qianl-nv merged 4 commits into
mainfrom
xyao/dev/agentic_e2e_runner
Jun 16, 2026
Merged

Add modular agentic env gen e2e runner script#796
qianl-nv merged 4 commits into
mainfrom
xyao/dev/agentic_e2e_runner

Conversation

@xyao-nv

@xyao-nv xyao-nv commented Jun 15, 2026

Copy link
Copy Markdown
Collaborator

Summary

Add modular agentic env gen e2e runner script. Use lazy import in each step to make it usable by others.

Detailed description

  • Use Case 1 (No SimApp): Resolve an environment intent spec into an initial environment graph spec and a linked environment graph spec
  • Use Case 2 (SimApp in the loop): Build a gym env from a linked environment graph spec YAML and run the zero-action policy
  • Use Case 3 (SimApp in the loop): 1 & 2

@xyao-nv xyao-nv marked this pull request as ready for review June 16, 2026 00:01
@greptile-apps

greptile-apps Bot commented Jun 16, 2026

Copy link
Copy Markdown
Contributor

Greptile Summary

This PR adds a modular end-to-end runner script for agentic environment generation, supporting three modes (resolve, build, full), and consolidates the previously duplicated safe_filename_stem utility into agent_utils.py with accompanying tests.

  • environment_generation_runner.py: New script orchestrating the full pipeline — LLM-driven intent resolution → graph spec compilation → YAML serialization → gymnasium env construction → zero-action policy rollout. Every heavy dependency (EnvironmentGenerationAgent, IntentCompiler, ArenaEnvBuilder, torch) is lazily imported inside its owning function, aligning with the stated design goal.
  • agent_utils.py / try_environment_intent_schema.py: safe_filename_stem is extracted into the shared utility module and removed from its previous local definition, resolving the duplication flagged in prior review rounds.
  • Tests: TestSafeFilenameStem covers character replacement, edge trimming, empty input, and all-unsafe-character fallback.

Confidence Score: 5/5

The changes are additive (new runner script + utility extraction) with no modifications to existing business logic; the refactoring of safe_filename_stem is mechanical and covered by tests.

All changed paths are either new files or straightforward deduplication. The runner script is a well-structured orchestration layer with no shared state mutations. Prior review concerns about torch import placement and the duplicate utility function have both been addressed. No existing functionality is altered.

No files require special attention.

Important Files Changed

Filename Overview
isaaclab_arena_examples/agentic_environment_generation/environment_generation_runner.py New e2e runner script for three modes (resolve/build/full); clean lazy-import pattern throughout, torch moved into run_zero_action_policy; assert-based CLI validation for --mode build is intentionally kept per author decision
isaaclab_arena/agentic_environment_generation/agent_utils.py Adds safe_filename_stem as a shared utility extracted from try_environment_intent_schema.py, resolving the previously flagged duplication
isaaclab_arena/tests/test_agent_utils.py Adds TestSafeFilenameStem with two test methods covering character replacement, trimming, empty input, and all-unsafe input; assertions are correct against the implementation
isaaclab_arena_examples/agentic_environment_generation/try_environment_intent_schema.py Removes local _safe_filename_stem definition and switches to the now-shared safe_filename_stem from agent_utils; straightforward deduplication
.gitignore Adds pattern to ignore agent-generated environment YAML files in isaaclab_arena_environments/agent_generated/, consistent with the DEFAULT_OUT_DIR in the runner

Flowchart

%%{init: {'theme': 'neutral'}}%%
flowchart TD
    A[main CLI entry] --> B{--mode}
    B -->|resolve| C[generate_env_intent_spec\nLLM API call]
    B -->|build| D{--linked_env_graph_spec_yaml\nprovided?}
    B -->|full| E[SimulationAppContext]

    C --> C1[compile_env_intent_spec\nIntentCompiler]
    C1 --> C2[link_env_graph_spec\ninitial.link]
    C2 --> C3[write_env_graph_specs\ninitial.yaml + linked.yaml]
    C3 --> Z[return 0]

    D -->|assert: not None & is_file| F[SimulationAppContext]
    D -->|missing| ERR[AssertionError]
    F --> G[build_env_from_linked_env_graph_spec\nArenaEnvGraphSpec.from_yaml]
    G --> H[run_zero_action_policy\ntorch inference loop N steps]
    H --> I[env.close]
    I --> Z

    E --> EL[resolve_env_spec steps 1-4]
    EL --> EG[build_env_from_linked_env_graph_spec]
    EG --> EH[run_zero_action_policy]
    EH --> EI[env.close]
    EI --> Z
Loading
%%{init: {'theme': 'base', 'themeVariables': {"darkMode": true, "background": "#0d1117", "primaryColor": "#21262d", "primaryTextColor": "#e6edf3", "primaryBorderColor": "#8b949e", "lineColor": "#8b949e", "textColor": "#e6edf3", "edgeLabelBackground": "#161b22", "actorBkg": "#21262d", "actorBorder": "#8b949e", "actorTextColor": "#e6edf3", "actorLineColor": "#8b949e", "signalColor": "#8b949e", "signalTextColor": "#e6edf3", "noteBkgColor": "#373320", "noteBorderColor": "#d4a72c", "noteTextColor": "#f0e6c0", "labelBoxBkgColor": "#21262d", "labelBoxBorderColor": "#8b949e", "labelTextColor": "#e6edf3", "loopTextColor": "#e6edf3", "activationBkgColor": "#30363d", "activationBorderColor": "#8b949e"}}}%%
flowchart TD
    A[main CLI entry] --> B{--mode}
    B -->|resolve| C[generate_env_intent_spec\nLLM API call]
    B -->|build| D{--linked_env_graph_spec_yaml\nprovided?}
    B -->|full| E[SimulationAppContext]

    C --> C1[compile_env_intent_spec\nIntentCompiler]
    C1 --> C2[link_env_graph_spec\ninitial.link]
    C2 --> C3[write_env_graph_specs\ninitial.yaml + linked.yaml]
    C3 --> Z[return 0]

    D -->|assert: not None & is_file| F[SimulationAppContext]
    D -->|missing| ERR[AssertionError]
    F --> G[build_env_from_linked_env_graph_spec\nArenaEnvGraphSpec.from_yaml]
    G --> H[run_zero_action_policy\ntorch inference loop N steps]
    H --> I[env.close]
    I --> Z

    E --> EL[resolve_env_spec steps 1-4]
    EL --> EG[build_env_from_linked_env_graph_spec]
    EG --> EH[run_zero_action_policy]
    EH --> EI[env.close]
    EI --> Z
Loading

Reviews (2): Last reviewed commit: "refactor" | Re-trigger Greptile

@qianl-nv qianl-nv left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

LGTM. thanks for the change and refactoring the common util!

@qianl-nv qianl-nv enabled auto-merge (squash) June 16, 2026 14:08
@qianl-nv qianl-nv merged commit 3571005 into main Jun 16, 2026
21 of 24 checks passed
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