add action hydration (#2675)

This commit is contained in:
Shuchang Zheng
2025-06-10 16:07:02 -07:00
committed by GitHub
parent f05170df61
commit 9a42c2ad9f
2 changed files with 110 additions and 0 deletions

View File

@@ -58,6 +58,7 @@ from skyvern.forge.sdk.db.utils import (
convert_to_workflow_run_block,
convert_to_workflow_run_output_parameter,
convert_to_workflow_run_parameter,
hydrate_action,
)
from skyvern.forge.sdk.log_artifacts import save_workflow_run_logs
from skyvern.forge.sdk.models import Step, StepStatus
@@ -417,6 +418,26 @@ class AgentDB:
LOG.error("UnexpectedError", exc_info=True)
raise
async def get_task_actions_hydrated(self, task_id: str, organization_id: str | None = None) -> list[Action]:
try:
async with self.Session() as session:
query = (
select(ActionModel)
.filter(ActionModel.organization_id == organization_id)
.filter(ActionModel.task_id == task_id)
.order_by(ActionModel.created_at)
)
actions = (await session.scalars(query)).all()
return [hydrate_action(action) for action in actions]
except SQLAlchemyError:
LOG.error("SQLAlchemyError", exc_info=True)
raise
except Exception:
LOG.error("UnexpectedError", exc_info=True)
raise
async def get_tasks_actions(self, task_ids: list[str], organization_id: str | None = None) -> list[Action]:
try:
async with self.Session() as session: