Добавить FastAPI endpoint запуска сценария через AgentOS base_app.
Подключен верхний HTTP-слой с POST /api/runs и обновлены схемы/README, чтобы запуск сценариев шел через единый API-контракт поверх Agno workflow.
This commit is contained in:
@@ -0,0 +1,17 @@
|
||||
from fastapi import APIRouter
|
||||
from pydantic import TypeAdapter
|
||||
|
||||
from src.schemas import ScenarioRunRequest, ScenarioRunResponse
|
||||
from src.workflow_runner import run_scenario_workflow
|
||||
|
||||
router = APIRouter(prefix="/api", tags=["workflow"])
|
||||
_run_response_adapter = TypeAdapter(ScenarioRunResponse)
|
||||
|
||||
|
||||
@router.post("/runs", response_model=ScenarioRunResponse)
|
||||
async def run_scenario(request: ScenarioRunRequest) -> ScenarioRunResponse:
|
||||
result = await run_scenario_workflow(
|
||||
input_data=request.input,
|
||||
scenario_id=request.scenario_id,
|
||||
)
|
||||
return _run_response_adapter.validate_python(result)
|
||||
Reference in New Issue
Block a user