Skip to content

Commit 76d2751

Browse files
authored
Fix style and wording issues in handoffs.py
Removed extra parentheses from a boolean field and replaced the incorrect term non-null with callable in an assertion message to improve readability and accuracy.
1 parent 818344c commit 76d2751

File tree

1 file changed

+2
-4
lines changed

1 file changed

+2
-4
lines changed

src/agents/handoffs.py

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -119,9 +119,7 @@ class Handoff(Generic[TContext, TAgent]):
119119
True, as it increases the likelihood of correct JSON input.
120120
"""
121121

122-
is_enabled: bool | Callable[[RunContextWrapper[Any], AgentBase[Any]], MaybeAwaitable[bool]] = (
123-
True
124-
)
122+
is_enabled: bool | Callable[[RunContextWrapper[Any], AgentBase[Any]], MaybeAwaitable[bool]] = True
125123
"""Whether the handoff is enabled. Either a bool or a Callable that takes the run context and
126124
agent and returns whether the handoff is enabled. You can use this to dynamically enable/disable
127125
a handoff based on your context/state."""
@@ -264,7 +262,7 @@ async def _invoke_handoff(
264262
async def _is_enabled(ctx: RunContextWrapper[Any], agent_base: AgentBase[Any]) -> bool:
265263
from .agent import Agent
266264

267-
assert callable(is_enabled), "is_enabled must be non-null here"
265+
assert callable(is_enabled), "is_enabled must be callable here"
268266
assert isinstance(agent_base, Agent), "Can't handoff to a non-Agent"
269267
result = is_enabled(ctx, agent_base)
270268

0 commit comments

Comments
 (0)