Skip to content

Commit 763181d

Browse files
committed
Merge branch 'macae-v3-dev-v2-vip' of https://github.com/microsoft/Multi-Agent-Custom-Automation-Engine-Solution-Accelerator into macae-v3-dev-marktayl
2 parents 0ec621e + 6e8fce5 commit 763181d

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

46 files changed

+2742
-436
lines changed

data/agent_teams/default_team.json

Lines changed: 25 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,11 @@
1414
"system_message": "You are an AI Agent. You have knowledge about HR (e.g., human resources), policies, procedures, and onboarding guidelines.",
1515
"description": "Handles employee onboarding, HR policies, and human resources management tasks.",
1616
"icon": "Person",
17-
"index_name": ""
17+
"index_name": "",
18+
"use_rag": false,
19+
"use_mcp": false,
20+
"coding_tools": false,
21+
"use_bing": false
1822
},
1923
{
2024
"input_key": "tech-support-001",
@@ -24,7 +28,11 @@
2428
"system_message": "You are a Product agent. You have knowledge about product management, development, and compliance guidelines. When asked to call a function, you should summarize back what was done.",
2529
"description": "Provides technical support for mobile plans, telecommunications, and IT services.",
2630
"icon": "Phone",
27-
"index_name": ""
31+
"index_name": "",
32+
"use_rag": false,
33+
"use_mcp": false,
34+
"coding_tools": false,
35+
"use_bing": false
2836
},
2937
{
3038
"input_key": "procurement-001",
@@ -34,7 +42,11 @@
3442
"system_message": "You are a Procurement agent. You specialize in purchasing, vendor management, supply chain operations, and inventory control. You help with creating purchase orders, managing vendors, tracking orders, and ensuring efficient procurement processes.",
3543
"description": "Manages purchasing decisions, add-ons, and procurement processes.",
3644
"icon": "ShoppingBag",
37-
"index_name": ""
45+
"index_name": "",
46+
"use_rag": false,
47+
"use_mcp": false,
48+
"coding_tools": false,
49+
"use_bing": false
3850
},
3951
{
4052
"input_key": "marketing-001",
@@ -44,7 +56,11 @@
4456
"system_message": "You are a Marketing agent. You specialize in marketing strategy, campaign development, content creation, and market analysis. You help create effective marketing campaigns, analyze market data, and develop promotional content for products and services.",
4557
"description": "Creates marketing content, press releases, and promotional materials.",
4658
"icon": "DocumentEdit",
47-
"index_name": ""
59+
"index_name": "",
60+
"use_rag": false,
61+
"use_mcp": false,
62+
"coding_tools": false,
63+
"use_bing": false
4864
},
4965
{
5066
"input_key": "generic-001",
@@ -54,7 +70,11 @@
5470
"system_message": "You are a Generic agent that can help with general questions and provide basic information. You can search for information and perform simple calculations.",
5571
"description": "Provides general assistance and handles miscellaneous tasks that don't require specialized expertise.",
5672
"icon": "Bot",
57-
"index_name": ""
73+
"index_name": "",
74+
"use_rag": false,
75+
"use_mcp": false,
76+
"coding_tools": false,
77+
"use_bing": false
5878
}
5979
],
6080
"description": "Business Operations team handles employee onboarding, telecommunications support, procurement, and marketing tasks for comprehensive business operations management.",

src/backend/app_kernel.py

Lines changed: 89 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,8 +20,10 @@
2020
from common.utils.utils_date import format_dates_in_messages
2121
# Updated import for KernelArguments
2222
from common.utils.utils_kernel import rai_success
23+
from common.utils.websocket_streaming import (websocket_streaming_endpoint,
24+
ws_manager)
2325
# FastAPI imports
24-
from fastapi import FastAPI, HTTPException, Query, Request
26+
from fastapi import FastAPI, HTTPException, Query, Request, WebSocket
2527
from fastapi.middleware.cors import CORSMiddleware
2628
from kernel_agents.agent_factory import AgentFactory
2729
# Local imports
@@ -81,6 +83,13 @@
8183
logging.info("Added health check middleware")
8284

8385

86+
# WebSocket streaming endpoint
87+
@app.websocket("/ws/streaming")
88+
async def websocket_endpoint(websocket: WebSocket):
89+
"""WebSocket endpoint for real-time plan execution streaming"""
90+
await websocket_streaming_endpoint(websocket)
91+
92+
8493
@app.post("/api/user_browser_language")
8594
async def user_browser_language_endpoint(user_language: UserLanguage, request: Request):
8695
"""
@@ -587,12 +596,14 @@ async def approve_step_endpoint(
587596

588597
return {"status": "All steps approved"}
589598

599+
590600
# Get plans is called in the initial side rendering of the frontend
591601
@app.get("/api/plans")
592602
async def get_plans(
593603
request: Request,
594604
session_id: Optional[str] = Query(None),
595605
plan_id: Optional[str] = Query(None),
606+
team_id: Optional[str] = Query(None),
596607
):
597608
"""
598609
Retrieve plans for the current user.
@@ -659,7 +670,7 @@ async def get_plans(
659670
"UserIdNotFound", {"status_code": 400, "detail": "no user"}
660671
)
661672
raise HTTPException(status_code=400, detail="no user")
662-
673+
663674
# Initialize agent team for this user session
664675
await OrchestrationManager.get_current_orchestration(user_id=user_id)
665676

@@ -884,6 +895,82 @@ async def get_agent_tools():
884895
return []
885896

886897

898+
@app.post("/api/test/streaming/{plan_id}")
899+
async def test_streaming_updates(plan_id: str):
900+
"""
901+
Test endpoint to simulate streaming updates for a plan.
902+
This is for testing the WebSocket streaming functionality.
903+
"""
904+
from common.utils.websocket_streaming import (send_agent_message,
905+
send_plan_update,
906+
send_step_update)
907+
908+
try:
909+
# Simulate a series of streaming updates
910+
await send_agent_message(
911+
plan_id=plan_id,
912+
agent_name="Data Analyst",
913+
content="Starting analysis of the data...",
914+
message_type="thinking",
915+
)
916+
917+
await asyncio.sleep(1)
918+
919+
await send_plan_update(
920+
plan_id=plan_id,
921+
step_id="step_1",
922+
agent_name="Data Analyst",
923+
content="Analyzing customer data patterns...",
924+
status="in_progress",
925+
message_type="action",
926+
)
927+
928+
await asyncio.sleep(2)
929+
930+
await send_agent_message(
931+
plan_id=plan_id,
932+
agent_name="Data Analyst",
933+
content="Found 3 key insights in the customer data. Processing recommendations...",
934+
message_type="result",
935+
)
936+
937+
await asyncio.sleep(1)
938+
939+
await send_step_update(
940+
plan_id=plan_id,
941+
step_id="step_1",
942+
status="completed",
943+
content="Data analysis completed successfully!",
944+
)
945+
946+
await send_agent_message(
947+
plan_id=plan_id,
948+
agent_name="Business Advisor",
949+
content="Reviewing the analysis results and preparing strategic recommendations...",
950+
message_type="thinking",
951+
)
952+
953+
await asyncio.sleep(2)
954+
955+
await send_plan_update(
956+
plan_id=plan_id,
957+
step_id="step_2",
958+
agent_name="Business Advisor",
959+
content="Based on the data analysis, I recommend focusing on customer retention strategies for the identified high-value segments.",
960+
status="completed",
961+
message_type="result",
962+
)
963+
964+
return {
965+
"status": "success",
966+
"message": f"Test streaming updates sent for plan {plan_id}",
967+
}
968+
969+
except Exception as e:
970+
logging.error(f"Error sending test streaming updates: {e}")
971+
raise HTTPException(status_code=500, detail=str(e))
972+
973+
887974
# Run the app
888975
if __name__ == "__main__":
889976
import uvicorn

src/backend/common/config/app_config.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,10 @@ def __init__(self):
3939
"AZURE_COGNITIVE_SERVICES", "https://cognitiveservices.azure.com/.default"
4040
)
4141

42+
self.AZURE_MANAGEMENT_SCOPE = self._get_optional(
43+
"AZURE_MANAGEMENT_SCOPE", "https://management.azure.com/.default"
44+
)
45+
4246
# Azure OpenAI settings
4347
self.AZURE_OPENAI_DEPLOYMENT_NAME = self._get_required(
4448
"AZURE_OPENAI_DEPLOYMENT_NAME", "gpt-4o"

0 commit comments

Comments
 (0)