KEMBAR78
Fix: #32 Recursion Issue by atalhens · Pull Request #33 · NVIDIA/NeMo-Agent-Toolkit · GitHub
Skip to content

Conversation

@atalhens
Copy link
Contributor

@atalhens atalhens commented Mar 25, 2025

On observing the way, the agent executes the question received from the user: https://github.com/NVIDIA/AgentIQ/blob/develop/src/aiq/agent/react_agent/agent.py#L108.

Looks like there is no sanity check if the input query received from the user side is valid or not.

Edit added to check is the input is like "", " " [empty or blank spaces].

Output will be shown as No human input provided.
Screenshot 2025-03-25 at 11 48 55 PM

Closes #32

Signed-off-by: atalhens <sneh.lata@nutanix.com>
@atalhens atalhens marked this pull request as ready for review March 25, 2025 18:27
@mdemoret-nv
Copy link
Collaborator

@sean-javiya-nvidia Can you review these changes?

@sean-javiya-nvidia
Copy link

sean-javiya-nvidia commented Mar 26, 2025

Awesome! Thanks for quickly addressing @atalhens!

The last suggestion I have, could we add a unit test for the added improvement?

we could maybe add a unit test here, maybe something like this

async def test_no_input(mock_react_graph):
    response = await mock_react_graph.ainvoke(ReActGraphState(messages=[HumanMessage(',')]))
    response = ReActGraphState(**response)
    response = response.messages[-1]  # pylint: disable=unsubscriptable-object
    assert isinstance(response, AIMessage)
    assert response.content == NO_INPUT_ERROR_MESSAGE

that way, we can ensure any future contributions or changes don't accidentally change the desired behavior

Copy link

@sean-javiya-nvidia sean-javiya-nvidia left a comment

Choose a reason for hiding this comment

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

commented above

Signed-off-by: atalhens <sneh.lata@nutanix.com>
@atalhens
Copy link
Contributor Author

Added unit test, Thanks for your suggestion @sean-javiya-nvidia!
Unit test check for HumanMesaage('')

Let me know if it addresses your concern :)

@mdemoret-nv mdemoret-nv merged commit f81dc2f into NVIDIA:develop Mar 26, 2025
1 check passed
@mdemoret-nv
Copy link
Collaborator

@atalhens Thanks for your contribution!

@atalhens atalhens deleted the fix32 branch March 26, 2025 20:42
ericevans-nv pushed a commit to ericevans-nv/agent-iq that referenced this pull request Apr 14, 2025
* Fix NVIDIA#32 Add a check to ensure empty input is not passed

Signed-off-by: atalhens <sneh.lata@nutanix.com>

* Add str constant for output message

Signed-off-by: atalhens <sneh.lata@nutanix.com>

* Add unit test

Signed-off-by: atalhens <sneh.lata@nutanix.com>

---------

Signed-off-by: atalhens <sneh.lata@nutanix.com>
yczhang-nv pushed a commit to yczhang-nv/NeMo-Agent-Toolkit that referenced this pull request Apr 21, 2025
* Fix NVIDIA#32 Add a check to ensure empty input is not passed

Signed-off-by: atalhens <sneh.lata@nutanix.com>

* Add str constant for output message

Signed-off-by: atalhens <sneh.lata@nutanix.com>

* Add unit test

Signed-off-by: atalhens <sneh.lata@nutanix.com>

---------

Signed-off-by: atalhens <sneh.lata@nutanix.com>
Signed-off-by: Yuchen Zhang <134643420+yczhang-nv@users.noreply.github.com>
yczhang-nv pushed a commit to yczhang-nv/NeMo-Agent-Toolkit that referenced this pull request May 8, 2025
* Fix NVIDIA#32 Add a check to ensure empty input is not passed

Signed-off-by: atalhens <sneh.lata@nutanix.com>

* Add str constant for output message

Signed-off-by: atalhens <sneh.lata@nutanix.com>

* Add unit test

Signed-off-by: atalhens <sneh.lata@nutanix.com>

---------

Signed-off-by: atalhens <sneh.lata@nutanix.com>
Signed-off-by: Yuchen Zhang <134643420+yczhang-nv@users.noreply.github.com>
AnuradhaKaruppiah pushed a commit to AnuradhaKaruppiah/oss-agentiq that referenced this pull request Aug 4, 2025
* Fix NVIDIA#32 Add a check to ensure empty input is not passed

Signed-off-by: atalhens <sneh.lata@nutanix.com>

* Add str constant for output message

Signed-off-by: atalhens <sneh.lata@nutanix.com>

* Add unit test

Signed-off-by: atalhens <sneh.lata@nutanix.com>

---------

Signed-off-by: atalhens <sneh.lata@nutanix.com>
scheckerNV pushed a commit to scheckerNV/aiq-factory-reset that referenced this pull request Aug 22, 2025
* Fix NVIDIA#32 Add a check to ensure empty input is not passed

Signed-off-by: atalhens <sneh.lata@nutanix.com>

* Add str constant for output message

Signed-off-by: atalhens <sneh.lata@nutanix.com>

* Add unit test

Signed-off-by: atalhens <sneh.lata@nutanix.com>

---------

Signed-off-by: atalhens <sneh.lata@nutanix.com>
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.

Simple_calculator example throws "recursion limit" error when no input is given

3 participants