workflow DAG execution (#4222)

This commit is contained in:
Shuchang Zheng
2025-12-07 12:37:00 -08:00
committed by GitHub
parent 45307cc2ba
commit 753a36ac2e
10 changed files with 332 additions and 21 deletions

View File

@@ -3911,6 +3911,11 @@ class AgentDB:
instructions: str | None = None,
positive_descriptor: str | None = None,
negative_descriptor: str | None = None,
# conditional block
executed_branch_id: str | None = None,
executed_branch_expression: str | None = None,
executed_branch_result: bool | None = None,
executed_branch_next_block: str | None = None,
) -> WorkflowRunBlock:
async with self.Session() as session:
workflow_run_block = (
@@ -3977,6 +3982,15 @@ class AgentDB:
workflow_run_block.positive_descriptor = positive_descriptor
if negative_descriptor:
workflow_run_block.negative_descriptor = negative_descriptor
# conditional block fields
if executed_branch_id:
workflow_run_block.executed_branch_id = executed_branch_id
if executed_branch_expression is not None:
workflow_run_block.executed_branch_expression = executed_branch_expression
if executed_branch_result is not None:
workflow_run_block.executed_branch_result = executed_branch_result
if executed_branch_next_block is not None:
workflow_run_block.executed_branch_next_block = executed_branch_next_block
await session.commit()
await session.refresh(workflow_run_block)
else:

View File

@@ -714,6 +714,12 @@ class WorkflowRunBlockModel(Base):
positive_descriptor = Column(String, nullable=True)
negative_descriptor = Column(String, nullable=True)
# conditional block
executed_branch_id = Column(String, nullable=True)
executed_branch_expression = Column(String, nullable=True)
executed_branch_result = Column(Boolean, nullable=True)
executed_branch_next_block = Column(String, nullable=True)
created_at = Column(DateTime, default=datetime.datetime.utcnow, nullable=False)
modified_at = Column(DateTime, default=datetime.datetime.utcnow, onupdate=datetime.datetime.utcnow, nullable=False)

View File

@@ -579,6 +579,10 @@ def convert_to_workflow_run_block(
instructions=workflow_run_block_model.instructions,
positive_descriptor=workflow_run_block_model.positive_descriptor,
negative_descriptor=workflow_run_block_model.negative_descriptor,
executed_branch_id=workflow_run_block_model.executed_branch_id,
executed_branch_expression=workflow_run_block_model.executed_branch_expression,
executed_branch_result=workflow_run_block_model.executed_branch_result,
executed_branch_next_block=workflow_run_block_model.executed_branch_next_block,
)
if task:
if task.finished_at and task.started_at: