Skip to content

Commit 9f2dae3

Browse files
authored
Merge pull request #431 from microsoft/macae-v3-dev-marktayl
Macae v3 dev marktayl
2 parents ca44b03 + dfcc1e7 commit 9f2dae3

File tree

6 files changed

+33
-37
lines changed

6 files changed

+33
-37
lines changed

data/agent_teams/new 29.txt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ BE: Create a teams container in Cosmos and move all loaded team definitions ther
1818
Implement saving of plan to cosmos -> history in...
1919

2020
================ Request submit flow ======================
21-
on request submission call "/create_plan" (process_request)
21+
on request submission call "/process_request" (process_request)
2222
This will return immediately - move to other page and display spinner -> "creating plan"
2323
Socket will start receiving messages ->
2424
Stream plan output into main window
@@ -30,7 +30,7 @@ Send PlanApprovalResponse message when user answers
3030
If not approved
3131
BE: plan will cancel on backend
3232
FE: - enable input again for fresh request
33-
Call input_request API on backend again (just like inputing any request)
33+
Call input_request API on backend again (just like inputting any request)
3434

3535
If approved:
3636
Display plan steps in right pane if approved

src/backend/tests/test_app.py

Lines changed: 13 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
import os
22
import sys
33
from unittest.mock import MagicMock, patch
4+
45
import pytest
56
from fastapi.testclient import TestClient
67

@@ -48,8 +49,8 @@ def test_input_task_invalid_json():
4849
response = client.post("/input_task", data=invalid_json, headers=headers)
4950

5051

51-
def test_create_plan_endpoint_success():
52-
"""Test the /api/create_plan endpoint with valid input."""
52+
def test_process_request_endpoint_success():
53+
"""Test the /api/process_request endpoint with valid input."""
5354
headers = {"Authorization": "Bearer mock-token"}
5455

5556
# Mock the RAI success function
@@ -66,7 +67,7 @@ def test_create_plan_endpoint_success():
6667
"description": "Create a marketing plan for our new product"
6768
}
6869

69-
response = client.post("/api/create_plan", json=test_input, headers=headers)
70+
response = client.post("/api/process_request", json=test_input, headers=headers)
7071

7172
# Print response details for debugging
7273
print(f"Response status: {response.status_code}")
@@ -85,8 +86,8 @@ def test_create_plan_endpoint_success():
8586
mock_memory_store.add_plan.assert_called_once()
8687

8788

88-
def test_create_plan_endpoint_rai_failure():
89-
"""Test the /api/create_plan endpoint when RAI check fails."""
89+
def test_process_request_endpoint_rai_failure():
90+
"""Test the /api/process_request endpoint when RAI check fails."""
9091
headers = {"Authorization": "Bearer mock-token"}
9192

9293
# Mock the RAI failure
@@ -98,7 +99,7 @@ def test_create_plan_endpoint_rai_failure():
9899
"description": "This is an unsafe description"
99100
}
100101

101-
response = client.post("/api/create_plan", json=test_input, headers=headers)
102+
response = client.post("/api/process_request", json=test_input, headers=headers)
102103

103104
# Check response
104105
assert response.status_code == 400
@@ -107,8 +108,8 @@ def test_create_plan_endpoint_rai_failure():
107108
assert "safety validation" in data["detail"]
108109

109110

110-
def test_create_plan_endpoint_harmful_content():
111-
"""Test the /api/create_plan endpoint with harmful content that should fail RAI."""
111+
def test_process_request_endpoint_harmful_content():
112+
"""Test the /api/process_request endpoint with harmful content that should fail RAI."""
112113
headers = {"Authorization": "Bearer mock-token"}
113114

114115
# Mock the RAI failure for harmful content
@@ -120,7 +121,7 @@ def test_create_plan_endpoint_harmful_content():
120121
"description": "I want to kill my neighbors cat"
121122
}
122123

123-
response = client.post("/api/create_plan", json=test_input, headers=headers)
124+
response = client.post("/api/process_request", json=test_input, headers=headers)
124125

125126
# Print response details for debugging
126127
print(f"Response status: {response.status_code}")
@@ -133,8 +134,8 @@ def test_create_plan_endpoint_harmful_content():
133134
assert "safety validation" in data["detail"]
134135

135136

136-
def test_create_plan_endpoint_real_rai_check():
137-
"""Test the /api/create_plan endpoint with real RAI check (no mocking)."""
137+
def test_process_request_endpoint_real_rai_check():
138+
"""Test the /api/process_request endpoint with real RAI check (no mocking)."""
138139
headers = {"Authorization": "Bearer mock-token"}
139140

140141
# Don't mock RAI - let it run the real check
@@ -150,7 +151,7 @@ def test_create_plan_endpoint_real_rai_check():
150151
"description": "I want to kill my neighbors cat"
151152
}
152153

153-
response = client.post("/api/create_plan", json=test_input, headers=headers)
154+
response = client.post("/api/process_request", json=test_input, headers=headers)
154155

155156
# Print response details for debugging
156157
print(f"Real RAI Response status: {response.status_code}")

src/backend/v3/api/router.py

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,9 @@
88
import v3.models.messages as messages
99
from auth.auth_utils import get_authenticated_user_details
1010
from common.database.database_factory import DatabaseFactory
11-
from common.models.messages_kernel import (GeneratePlanRequest, InputTask, PlanStatus,
12-
TeamSelectionRequest, Plan)
11+
from common.models.messages_kernel import (GeneratePlanRequest, InputTask,
12+
Plan, PlanStatus,
13+
TeamSelectionRequest)
1314
from common.utils.event_utils import track_event_if_configured
1415
from common.utils.utils_kernel import rai_success, rai_validate_team_config
1516
from fastapi import (APIRouter, BackgroundTasks, Depends, FastAPI, File,
@@ -130,7 +131,7 @@ async def init_team(
130131
)
131132
raise HTTPException(status_code=400, detail=f"Error starting request: {e}") from e
132133

133-
@app_v3.post("/create_plan")
134+
@app_v3.post("/process_request")
134135
async def process_request(background_tasks: BackgroundTasks, input_task: InputTask, request: Request):
135136
"""
136137
Create a new plan without full processing.

src/backend/v3/models/messages.py

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -83,6 +83,7 @@ class FinalResultMessage:
8383
summary: str | None = None
8484
context: dict | None = None
8585

86+
@dataclass(slots=True)
8687
class HumanFeedback(KernelBaseModel):
8788
"""Message containing human feedback on a step."""
8889

@@ -93,14 +94,15 @@ class HumanFeedback(KernelBaseModel):
9394
human_feedback: Optional[str] = None
9495
updated_action: Optional[str] = None
9596

96-
97+
@dataclass(slots=True)
9798
class HumanClarification(KernelBaseModel):
9899
"""Message containing human clarification on a plan."""
99100

100101
plan_id: str
101102
session_id: str
102103
human_clarification: str
103104

105+
@dataclass(slots=True)
104106
class ApprovalRequest(KernelBaseModel):
105107
"""Message sent to HumanAgent to request approval for a step."""
106108

@@ -110,3 +112,11 @@ class ApprovalRequest(KernelBaseModel):
110112
user_id: str
111113
action: str
112114
agent_name: str
115+
116+
@dataclass(slots=True)
117+
class HumanClarification(KernelBaseModel):
118+
"""Message containing human clarification on a plan."""
119+
120+
plan_id: str
121+
session_id: str
122+
human_clarification: str

src/frontend/src/api/apiService.tsx

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ import {
1515
// Constants for endpoints
1616
const API_ENDPOINTS = {
1717
INPUT_TASK: '/input_task',
18-
CREATE_PLAN: '/v3/create_plan',
18+
PROCESS_REQUEST: '/v3/process_request',
1919
PLANS: '/plans',
2020
STEPS: '/steps',
2121
HUMAN_FEEDBACK: '/human_feedback',
@@ -115,11 +115,11 @@ export class APIService {
115115
* @returns Promise with the response containing plan ID and status
116116
*/
117117
// async createPlan(inputTask: InputTask): Promise<{ plan_id: string; status: string; session_id: string }> {
118-
// return apiClient.post(API_ENDPOINTS.CREATE_PLAN, inputTask);
118+
// return apiClient.post(API_ENDPOINTS.PROCESS_REQUEST, inputTask);
119119
// }
120120

121121
async createPlan(inputTask: InputTask): Promise<{ status: string; session_id: string }> {
122-
return apiClient.post(API_ENDPOINTS.CREATE_PLAN, inputTask);
122+
return apiClient.post(API_ENDPOINTS.PROCESS_REQUEST, inputTask);
123123
}
124124

125125
/**

src/mcp_server/,env

Lines changed: 0 additions & 16 deletions
This file was deleted.

0 commit comments

Comments
 (0)