Spaces:
Sleeping
Sleeping
File size: 2,014 Bytes
a37e6db | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 | """Orchestration Canvas Tool"""
import logging
from typing import Any, Dict, List, Optional
logger = logging.getLogger(__name__)
async def present_orchestration_canvas(
user_id: str,
title: str,
agent_id: Optional[str] = None,
layout: str = "board",
tasks: List[Dict[str, Any]] = None
) -> Dict[str, Any]:
"""
Present an orchestration canvas.
Creates a multi-app workflow orchestration deck.
"""
from core.canvas_orchestration_service import OrchestrationCanvasService
from core.database import get_db_session
from tools.canvas_tool import present_specialized_canvas
try:
with get_db_session() as db:
service = OrchestrationCanvasService(db)
result = service.create_orchestration_canvas(
user_id=user_id,
title=title,
agent_id=agent_id,
layout=layout,
tasks=tasks
)
if not result.get("success"):
return result
canvas_id = result["canvas_id"]
present_result = await present_specialized_canvas(
user_id=user_id,
canvas_type="orchestration",
component_type="kanban_board",
data={
"title": title,
"tasks": result.get("tasks", []),
"nodes": [],
"connections": []
},
title=title,
agent_id=agent_id,
layout=layout
)
if not present_result.get("success"):
return present_result
return {
"success": True,
"canvas_id": canvas_id,
"title": title,
"message": f"Presented orchestration canvas: {title}"
}
except Exception as e:
logger.error(f"Failed to present orchestration canvas: {e}")
return {"success": False, "error": str(e)}
|