43 lines
1.2 KiB
Python
43 lines
1.2 KiB
Python
"""
|
|
Workflow definitions and execution endpoint.
|
|
"""
|
|
|
|
import logging
|
|
from fastapi import APIRouter
|
|
|
|
from app.workflows import (
|
|
WORKFLOW_REGISTRY, get_workflow_steps,
|
|
AGENT_LABELS, AGENT_MODELS,
|
|
)
|
|
from app.models import WorkflowType
|
|
|
|
log = logging.getLogger("foxy.api.workflows")
|
|
router = APIRouter(prefix="/api/workflows", tags=["workflows"])
|
|
|
|
|
|
@router.get("")
|
|
async def list_workflows():
|
|
"""List all available workflow types with their step sequences."""
|
|
workflows = []
|
|
for wf_type, steps in WORKFLOW_REGISTRY.items():
|
|
step_list = [
|
|
{
|
|
"agent": s.agent_name,
|
|
"label": AGENT_LABELS.get(s.agent_name, s.agent_name),
|
|
"model": AGENT_MODELS.get(s.agent_name, "unknown"),
|
|
"awaiting_status": s.awaiting_status,
|
|
"running_status": s.running_status,
|
|
}
|
|
for s in steps
|
|
]
|
|
# Build visual path string: "Conductor → Architect → Dev → QA → Admin"
|
|
path = " → ".join(s.agent_name for s in steps)
|
|
workflows.append({
|
|
"type": wf_type.value,
|
|
"label": wf_type.value.replace("_", " ").title(),
|
|
"path": path,
|
|
"steps": step_list,
|
|
})
|
|
return workflows
|
|
|