Skip to content

Commit

Permalink
Merge pull request #373 from teocns/main
Browse files Browse the repository at this point in the history
fix(orchestrator): OrchestratorError to serialize `Exception` as `str`
  • Loading branch information
jlowin authored Nov 5, 2024
2 parents 573a58d + 92f6e24 commit 33a40cd
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 3 deletions.
2 changes: 1 addition & 1 deletion src/controlflow/agents/agent.py
Original file line number Diff line number Diff line change
Expand Up @@ -238,7 +238,7 @@ async def run_async(
objective: str,
*,
turn_strategy: Optional["TurnStrategy"] = None,
handlers: Optional[list["Handler"]] = None,
handlers: Optional[list[Union["Handler", "AsyncHandler"]]] = None,
**task_kwargs,
):
return await controlflow.run_async(
Expand Down
7 changes: 5 additions & 2 deletions src/controlflow/events/orchestrator_events.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,7 @@
from typing import Literal
from dataclasses import Field
from typing import Annotated, Literal

from pydantic.functional_serializers import PlainSerializer

from controlflow.agents.agent import Agent
from controlflow.events.base import UnpersistedEvent
Expand All @@ -21,7 +24,7 @@ class OrchestratorError(UnpersistedEvent):
event: Literal["orchestrator-error"] = "orchestrator-error"
persist: bool = False
orchestrator: Orchestrator
error: Exception
error: Annotated[Exception, PlainSerializer(lambda x: str(x), return_type=str)]


class AgentTurnStart(UnpersistedEvent):
Expand Down

0 comments on commit 33a40cd

Please sign in to comment.