Skip to content

Commit eb3082f

Browse files
authored
Merge pull request #56 from AI-Hypercomputer/nina_gpu_code_fix
Separate execution tool and routing tool to different responses
2 parents be747f4 + e9558ab commit eb3082f

8 files changed

Lines changed: 18 additions & 18 deletions

MaxKernel/hitl_agent/subagents/gpu_to_jax_agent/prompts/convert_simplified_to_jax_prompt.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -39,8 +39,8 @@
3939
4. Do NOT proceed to transfer_to_agent if the file write failed
4040
4141
After SUCCESSFULLY writing the file (check the tool response for success):
42-
1. IMMEDIATELY call transfer_to_agent('ValidateSyntaxAgent') in the SAME response
43-
2. Do NOT output any message, confirmation, or status update before calling transfer_to_agent
44-
3. The transfer must be the ONLY action after successful file write
42+
1. Transfer to ValidateSyntaxAgent. Do NOT call transfer_to_agent in the same turn/response as write_file_direct. Wait for the tool response first, and then call:
43+
transfer_to_agent('ValidateSyntaxAgent')
44+
2. Do NOT output any message, confirmation, or status update. The transfer must be the only action after successful file write.
4545
4646
If you cannot write the file after multiple attempts, inform the user about the tool failure and ask them to manually create the file before proceeding."""

MaxKernel/hitl_agent/subagents/gpu_to_jax_agent/prompts/generate_test_prompt.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ def run_validation_test():
5454
- content=<the complete test script>
5555
- Note: The file will be written to the same directory as the user-provided GPU code file automatically
5656
- Example: If the user provided "/home/user/project/kernel.cu", the test will be written to "/home/user/project/test_correctness.py"
57-
4. After writing successfully, IMMEDIATELY transfer to RunCorrectnessTestAgent in the SAME response:
57+
4. After writing successfully, transfer to RunCorrectnessTestAgent. Do NOT call transfer_to_agent in the same turn/response as write_file_direct. Wait for the tool response first, and then call:
5858
transfer_to_agent('RunCorrectnessTestAgent')
5959
60-
CRITICAL: Do NOT output any message, confirmation, or status update before calling transfer_to_agent. The transfer must be the ONLY action after writing the file."""
60+
CRITICAL: Do NOT output any message, confirmation, or status update. The transfer must be the only action after writing the file."""

MaxKernel/hitl_agent/subagents/gpu_to_jax_agent/prompts/identify_framework_prompt.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -23,10 +23,10 @@
2323
2424
Where <FRAMEWORK_NAME> is the exact framework you detected (e.g., "CUDA", "Triton", "PyTorch CUDA")
2525
26-
4. After successfully saving the framework, IMMEDIATELY transfer to the next agent:
26+
4. After successfully saving the framework, transfer to the next agent. Do NOT call transfer_to_agent in the same turn/response as save_framework_detection. Wait for the tool response first, and then call:
2727
transfer_to_agent('AnalyzePlanAndWriteAgent')
28-
29-
Do this in the SAME response - do not wait for user input.
28+
29+
Do not wait for user input.
3030
3131
IMPORTANT:
3232
- ALWAYS call save_framework_detection before transferring to ensure state is populated

MaxKernel/hitl_agent/subagents/gpu_to_jax_agent/prompts/run_test_routing_prompt.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
1. The correctness test code has been loaded into state (in the 'correctness_test_code' key) via before_agent_callback
77
2. Call the run_correctness_test tool to execute the test
88
- The tool will read correctness_test_code from state automatically and save results to correctness_test_results
9-
3. After the tool completes, IMMEDIATELY transfer to GenerateAndWriteSummaryAgent WITHOUT any status messages:
9+
3. After the tool completes, transfer to GenerateAndWriteSummaryAgent. Do NOT call transfer_to_agent in the same turn/response as run_correctness_test. Wait for the tool response first, and then call:
1010
transfer_to_agent('GenerateAndWriteSummaryAgent')
1111
12-
CRITICAL: Do NOT output any message, acknowledgment, or status update to the user. Simply call run_correctness_test and then transfer to the next agent immediately."""
12+
CRITICAL: Do NOT output any message, acknowledgment, or status update. The transfer must be the only action after run_correctness_test completes."""

MaxKernel/hitl_agent/subagents/gpu_to_jax_agent/prompts/validate_compilation_routing_prompt.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
1. The JAX code is already loaded in state (in the 'jax_code' key)
77
2. Call the check_jax_compilation tool to validate compilation
88
- The tool will read jax_code from state automatically and save results to compilation_results
9-
3. After the tool completes, IMMEDIATELY transfer to ValidateShapesAgent WITHOUT any status messages:
9+
3. After the tool completes, transfer to ValidateShapesAgent. Do NOT call transfer_to_agent in the same turn/response as check_jax_compilation. Wait for the tool response first, and then call:
1010
transfer_to_agent('ValidateShapesAgent')
1111
12-
CRITICAL: Do NOT output any message, acknowledgment, or status update to the user. Simply call check_jax_compilation and then transfer to the next agent immediately."""
12+
CRITICAL: Do NOT output any message, acknowledgment, or status update. The transfer must be the only action after check_jax_compilation completes."""

MaxKernel/hitl_agent/subagents/gpu_to_jax_agent/prompts/validate_shapes_routing_prompt.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
1. The JAX code is already loaded in state (in the 'jax_code' key)
77
2. Call the validate_shapes tool to validate tensor shapes
88
- The tool will read jax_code from state automatically and save results to shape_validation_results
9-
3. After the tool completes, IMMEDIATELY transfer to GenerateCorrectnessTestAgent WITHOUT any status messages:
9+
3. After the tool completes, transfer to GenerateCorrectnessTestAgent. Do NOT call transfer_to_agent in the same turn/response as validate_shapes. Wait for the tool response first, and then call:
1010
transfer_to_agent('GenerateCorrectnessTestAgent')
1111
12-
CRITICAL: Do NOT output any message, acknowledgment, or status update to the user. Simply call validate_shapes and then transfer to the next agent immediately."""
12+
CRITICAL: Do NOT output any message, acknowledgment, or status update. The transfer must be the only action after validate_shapes completes."""

MaxKernel/hitl_agent/subagents/gpu_to_jax_agent/prompts/validate_syntax_routing_prompt.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
1. The JAX code has been loaded into state (in the 'jax_code' key) via before_agent_callback
77
2. Call the check_jax_syntax tool to validate the JAX code
88
- The tool will read jax_code from state automatically and save results to syntax_validation_results
9-
3. Based on the validation results returned by the tool, transfer to the appropriate agent
9+
3. After the tool completes, transfer to the appropriate agent. Do NOT call transfer_to_agent in the same turn/response as check_jax_syntax. Wait for the tool response first, and then transfer based on the results.
1010
1111
ROUTING LOGIC:
1212
- If check_jax_syntax returns errors (message contains "JAX Syntax Validation Failed"):
@@ -15,4 +15,4 @@
1515
- If syntax is valid (message contains "JAX Syntax Validation Passed"):
1616
transfer_to_agent('ValidateCompilationAgent')
1717
18-
CRITICAL: Do NOT output any message, acknowledgment, or status update. Simply call check_jax_syntax and then transfer to the appropriate agent immediately based on the results."""
18+
CRITICAL: Do NOT output any message, acknowledgment, or status update. The transfer must be the only action after check_jax_syntax completes."""

MaxKernel/hitl_agent/subagents/gpu_to_jax_agent/prompts/write_readme_prompt.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@
3232
2. Find the original GPU code path and simplified code from conversation history
3333
3. Create the comprehensive README
3434
4. Call write_file_direct with path="SIMPLIFICATION_SUMMARY.md" and your README content
35-
5. After successfully writing, IMMEDIATELY transfer to ConvertToJaxAgent in the SAME response:
35+
5. After successfully writing the file, transfer to ConvertToJaxAgent. Do NOT call transfer_to_agent in the same turn/response as write_file_direct. Wait for the write_file_direct tool response first, and then call:
3636
transfer_to_agent('ConvertToJaxAgent')
3737
38-
CRITICAL: Do NOT output any message, confirmation, or status update before calling transfer_to_agent. The transfer must be the ONLY action after writing the file."""
38+
CRITICAL: Do NOT output any message, confirmation, or status update. The transfer must be the only action after the file has been successfully written."""

0 commit comments

Comments
 (0)