Skip to content
This repository was archived by the owner on Mar 19, 2026. It is now read-only.

Commit 33a40cd

Browse files
authored
Merge pull request #373 from teocns/main
fix(orchestrator): OrchestratorError to serialize `Exception` as `str`
2 parents 573a58d + 92f6e24 commit 33a40cd

File tree

2 files changed

+6
-3
lines changed

2 files changed

+6
-3
lines changed

src/controlflow/agents/agent.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -238,7 +238,7 @@ async def run_async(
238238
objective: str,
239239
*,
240240
turn_strategy: Optional["TurnStrategy"] = None,
241-
handlers: Optional[list["Handler"]] = None,
241+
handlers: Optional[list[Union["Handler", "AsyncHandler"]]] = None,
242242
**task_kwargs,
243243
):
244244
return await controlflow.run_async(

src/controlflow/events/orchestrator_events.py

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,7 @@
1-
from typing import Literal
1+
from dataclasses import Field
2+
from typing import Annotated, Literal
3+
4+
from pydantic.functional_serializers import PlainSerializer
25

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

2629

2730
class AgentTurnStart(UnpersistedEvent):

0 commit comments

Comments
 (0)