refactor(backend): register ontology and orchestrator routers

- router.py: import and register ontology_router and orchestrator_router
- openapi.py: add ontology and orchestrator tags to OpenAPI documentation
- agent_runs.py: extend agent runs service with additional functionality
- test_openapi_schema.py: update OpenAPI schema tests
This commit is contained in:
caoxiaozhu
2026-05-12 01:26:13 +00:00
parent 22d47cbf2b
commit 441e27145d
4 changed files with 65 additions and 2 deletions

View File

@@ -76,6 +76,45 @@ class AgentRunService:
logger.info("Created agent run id=%s run_id=%s", created.id, created.run_id)
return self._serialize_run(created)
def update_run(
self,
run_id: str,
*,
agent: str | None = None,
ontology_json: dict[str, Any] | None = None,
route_json: dict[str, Any] | None = None,
permission_level: str | None = None,
status: str | None = None,
result_summary: str | None = None,
error_message: str | None = None,
finished_at: datetime | None = None,
) -> AgentRunRead:
self._ensure_ready()
run = self.repository.get_by_run_id(run_id)
if run is None:
raise LookupError("Run not found")
if agent is not None:
run.agent = agent
if ontology_json is not None:
run.ontology_json = ontology_json
if route_json is not None:
run.route_json = route_json
if permission_level is not None:
run.permission_level = permission_level
if status is not None:
run.status = status
if result_summary is not None:
run.result_summary = result_summary
if error_message is not None:
run.error_message = error_message
if finished_at is not None:
run.finished_at = finished_at
updated = self.repository.save_run(run)
logger.info("Updated agent run run_id=%s status=%s", updated.run_id, updated.status)
return self._serialize_run(updated)
def record_tool_call(
self,
*,