-
Notifications
You must be signed in to change notification settings - Fork 124
Kaizen lite mode #74
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Kaizen lite mode #74
Changes from all commits
Commits
Show all changes
19 commits
Select commit
Hold shift + click to select a range
7bacd01
Integration of kaizen for lite mode
gjt-prog fe545fa
feat: Add detailed debug logging for Kaizen message conversion, traje…
gjt-prog bdb8dae
Fix ruff check and format
gaodan-fang c893f89
Address some comments
gaodan-fang 01b28bf
Update README
gaodan-fang f45e723
Add readme [skip ci]
gaodan-fang 9773d66
Rename the Kaizen integration surface to Evolve
gaodan-fang 041807a
Make Evolve installation mandatory and surface registry tool failures
gaodan-fang fe466d5
Add evolve dependency[skip cli]
gaodan-fang 1a6ce33
Stop duplicating the Evolve MCP launcher in CUGA
gaodan-fang 6afb81a
Address comments[skip ci]
gaodan-fang f498f07
Preserve kaizen-lite evolve flow while integrating mainline knowledge…
gaodan-fang a56b687
Gate Evolve installs behind an explicit Python 3.12 extra
gaodan-fang 0d13e06
Update using evolve from pypi[skip ci]
gaodan-fang d984f16
Merge branch 'main' of github.com:cuga-project/cuga-agent into kaizen…
sami-marreed 31047bc
Prevent trajectory saves from reading mutated chat history
gaodan-fang 2b09f9e
Rebuild frontend
gaodan-fang d200c2c
Avoid shipping the Evolve MCP demo in the add-tool modal
gaodan-fang fc082d0
Rebuild frontend
gaodan-fang File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Empty file.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
79 changes: 79 additions & 0 deletions
79
src/cuga/backend/cuga_graph/nodes/cuga_lite/tests/test_cuga_lite_node.py
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,79 @@ | ||
| import asyncio | ||
| from unittest.mock import AsyncMock, patch | ||
|
|
||
| import pytest | ||
| from langchain_core.messages import HumanMessage | ||
| from langgraph.types import Command | ||
|
|
||
| from cuga.backend.cuga_graph.nodes.cuga_lite.cuga_lite_node import CugaLiteNode | ||
| from cuga.backend.cuga_graph.state.agent_state import AgentState | ||
|
|
||
|
|
||
| @pytest.mark.asyncio | ||
| async def test_callback_node_does_not_require_agent_state_error_field(): | ||
| state = AgentState( | ||
| input="test request", | ||
| url="https://example.com", | ||
| chat_messages=[HumanMessage(content="hello")], | ||
| final_answer="Task completed successfully.", | ||
| sub_task="task_1", | ||
| ) | ||
| node = CugaLiteNode() | ||
|
|
||
| with ( | ||
| patch("cuga.backend.evolve.integration.EvolveIntegration.is_enabled", return_value=True), | ||
| patch( | ||
| "cuga.backend.evolve.integration.EvolveIntegration.save_trajectory", | ||
| new_callable=AsyncMock, | ||
| ) as mock_save_trajectory, | ||
| patch.object(node, "_process_results", new_callable=AsyncMock) as mock_process_results, | ||
| patch("cuga.backend.cuga_graph.nodes.cuga_lite.cuga_lite_node.settings.evolve.async_save", False), | ||
| ): | ||
| mock_process_results.return_value = Command(update={}, goto="FinalAnswerAgent") | ||
|
|
||
| result = await node.callback_node(state) | ||
|
|
||
| assert result.goto == "FinalAnswerAgent" | ||
| mock_save_trajectory.assert_awaited_once() | ||
| saved_messages, task_id, success = mock_save_trajectory.await_args.args | ||
| assert saved_messages is not state.chat_messages | ||
| assert [message.content for message in saved_messages] == ["hello"] | ||
| assert task_id == "task_1" | ||
| assert success is True | ||
| mock_process_results.assert_awaited_once() | ||
|
|
||
|
|
||
| @pytest.mark.asyncio | ||
| async def test_callback_node_async_save_uses_chat_message_snapshot(): | ||
| state = AgentState( | ||
| input="test request", | ||
| url="https://example.com", | ||
| chat_messages=[HumanMessage(content="hello")], | ||
| final_answer="Task completed successfully.", | ||
| sub_task="task_1", | ||
| ) | ||
| node = CugaLiteNode() | ||
|
|
||
| with ( | ||
| patch("cuga.backend.evolve.integration.EvolveIntegration.is_enabled", return_value=True), | ||
| patch( | ||
| "cuga.backend.evolve.integration.EvolveIntegration.save_trajectory", | ||
| new_callable=AsyncMock, | ||
| ) as mock_save_trajectory, | ||
| patch.object(node, "_process_results", new_callable=AsyncMock) as mock_process_results, | ||
| patch("cuga.backend.cuga_graph.nodes.cuga_lite.cuga_lite_node.settings.evolve.async_save", True), | ||
| ): | ||
| mock_process_results.return_value = Command(update={}, goto="FinalAnswerAgent") | ||
|
|
||
| result = await node.callback_node(state) | ||
| state.chat_messages.append(HumanMessage(content="mutated later")) | ||
| await asyncio.sleep(0) | ||
|
|
||
| assert result.goto == "FinalAnswerAgent" | ||
| mock_save_trajectory.assert_awaited_once() | ||
| saved_messages, task_id, success = mock_save_trajectory.await_args.args | ||
| assert saved_messages is not state.chat_messages | ||
| assert [message.content for message in saved_messages] == ["hello"] | ||
| assert task_id == "task_1" | ||
| assert success is True | ||
| mock_process_results.assert_awaited_once() |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1 @@ | ||
| """Evolve integration support for CUGA.""" |
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.