Skip to content

Commit

Permalink
fix: Fix workflows serialization
Browse files Browse the repository at this point in the history
  • Loading branch information
whiterabbit1983 committed Jul 24, 2024
1 parent 5ad3254 commit 72f6782
Show file tree
Hide file tree
Showing 5 changed files with 8 additions and 5 deletions.
2 changes: 1 addition & 1 deletion agents-api/agents_api/activities/task_steps/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,7 @@ async def if_else_step(context: StepContext) -> dict:
else context.definition.else_
)

return {"workflow": next_workflow}
return {"goto_workflow": next_workflow}


@activity.defn
Expand Down
4 changes: 4 additions & 0 deletions agents-api/agents_api/common/utils/json.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
import json
from uuid import UUID
from typing import Any
from pydantic import BaseModel


class CustomJSONEncoder(json.JSONEncoder):
Expand Down Expand Up @@ -37,6 +38,9 @@ def default(self, obj):
if isinstance(obj, UUID):
return str(obj)

if isinstance(obj, BaseModel):
return obj.model_dump()

return obj


Expand Down
1 change: 0 additions & 1 deletion agents-api/agents_api/routers/agents/create_agent.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@
from ...dependencies.developer_id import get_developer_id
from ...models.agent.create_agent import create_agent_query
from ...autogen.openapi_model import CreateAgentRequest, ResourceCreatedResponse
from ...common.utils.datetime import utcnow

from .router import router

Expand Down
4 changes: 2 additions & 2 deletions agents-api/agents_api/worker/__main__.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
yield_step,
# tool_call_step,
# error_step,
# if_else_step,
if_else_step,
transition_step,
)

Expand Down Expand Up @@ -80,7 +80,7 @@ async def main():
yield_step,
# tool_call_step,
# error_step,
# if_else_step,
if_else_step,
transition_step,
]

Expand Down
2 changes: 1 addition & 1 deletion agents-api/agents_api/workflows/task_execution.py
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@ async def run(
context,
schedule_to_close_timeout=timedelta(seconds=600),
)
workflow_step: YieldWorkflowStep = outputs["workflow"]
workflow_step = YieldWorkflowStep(**outputs["goto_workflow"])

outputs = await workflow.execute_child_workflow(
TaskExecutionWorkflow.run,
Expand Down

0 comments on commit 72f6782

Please sign in to comment.