Compare commits

...

1 Commits

Author SHA1 Message Date
Zamil Majdy
89745ef5ad fix: enrich description with context instead of separate parameter
The external Agent Generator service no longer accepts user_instruction
as a separate parameter. Instead, enrich the description with context
(e.g., clarifying question answers) before sending.
2026-02-02 23:20:50 +04:00
2 changed files with 8 additions and 6 deletions

View File

@@ -139,11 +139,10 @@ async def decompose_goal_external(
""" """
client = _get_client() client = _get_client()
# Build the request payload
payload: dict[str, Any] = {"description": description}
if context: if context:
# The external service uses user_instruction for additional context description = f"{description}\n\nAdditional context from user:\n{context}"
payload["user_instruction"] = context
payload: dict[str, Any] = {"description": description}
if library_agents: if library_agents:
payload["library_agents"] = library_agents payload["library_agents"] = library_agents

View File

@@ -102,7 +102,7 @@ class TestDecomposeGoalExternal:
@pytest.mark.asyncio @pytest.mark.asyncio
async def test_decompose_goal_with_context(self): async def test_decompose_goal_with_context(self):
"""Test decomposition with additional context.""" """Test decomposition with additional context enriched into description."""
mock_response = MagicMock() mock_response = MagicMock()
mock_response.json.return_value = { mock_response.json.return_value = {
"success": True, "success": True,
@@ -119,9 +119,12 @@ class TestDecomposeGoalExternal:
"Build a chatbot", context="Use Python" "Build a chatbot", context="Use Python"
) )
expected_description = (
"Build a chatbot\n\nAdditional context from user:\nUse Python"
)
mock_client.post.assert_called_once_with( mock_client.post.assert_called_once_with(
"/api/decompose-description", "/api/decompose-description",
json={"description": "Build a chatbot", "user_instruction": "Use Python"}, json={"description": expected_description},
) )
@pytest.mark.asyncio @pytest.mark.asyncio