add get_run endpoint (#1944)

This commit is contained in:
Shuchang Zheng
2025-03-16 13:21:40 -07:00
committed by GitHub
parent 46eaa3545d
commit 18d38573d3
5 changed files with 122 additions and 3 deletions

View File

@@ -2905,3 +2905,15 @@ class AgentDB:
query = query.filter_by(cached=True).order_by(TaskRunModel.created_at.desc())
task_run = (await session.scalars(query)).first()
return TaskRun.model_validate(task_run) if task_run else None
async def get_task_run(
self,
run_id: str,
organization_id: str | None = None,
) -> TaskRun | None:
async with self.Session() as session:
query = select(TaskRunModel).filter_by(run_id=run_id)
if organization_id:
query = query.filter_by(organization_id=organization_id)
task_run = (await session.scalars(query)).first()
return TaskRun.model_validate(task_run) if task_run else None

View File

@@ -37,7 +37,7 @@ BITWARDEN_SENSITIVE_INFORMATION_PARAMETER_PREFIX = "bsi"
CREDENTIAL_PARAMETER_PREFIX = "cp"
CREDENTIAL_PREFIX = "cred"
ORGANIZATION_BITWARDEN_COLLECTION_PREFIX = "obc"
TASK_V2_ID = "oc"
TASK_V2_ID = "tsk_v2"
THOUGHT_ID = "ot"
ORGANIZATION_AUTH_TOKEN_PREFIX = "oat"
ORG_PREFIX = "o"