-
Notifications
You must be signed in to change notification settings - Fork 1.3k
Closed
Labels
bugSomething isn't workingSomething isn't workingpythonworkflowsRelated to Workflows in agent-frameworkRelated to Workflows in agent-framework
Description
Description
HandoffBuilder.participants() accepts SupportsAgentRun by API contract, but build() fails unless each participant is specifically an Agent instance.
Current behavior:
participants()type/docs allowSupportsAgentRun.HandoffAgentExecutor._prepare_agent_with_handoffs()enforcesisinstance(agent, Agent)and raisesTypeError.
Expected behavior:
- Either fully support
SupportsAgentRunparticipants, or - tighten public contract/docs/type hints at
participants()to requireAgentexplicitly.
Code Sample
from agent_framework import AgentResponse, AgentSession, Message, Content, SupportsAgentRun
from agent_framework.orchestrations import HandoffBuilder
class MinimalSupportsAgentRun:
def __init__(self, id, name):
self.id = id
self.name = name
self.description = "d"
async def run(self, messages=None, *, stream=False, session=None, **kwargs):
return AgentResponse(messages=[Message(role="assistant", contents=[Content.from_text("ok")])])
def create_session(self, **kwargs):
return AgentSession()
def get_session(self, *, service_session_id, **kwargs):
return AgentSession(service_session_id=service_session_id)
a = MinimalSupportsAgentRun("a", "A")
b = MinimalSupportsAgentRun("b", "B")
print(isinstance(a, SupportsAgentRun)) # True
wf = (
HandoffBuilder()
.participants([a, b])
.with_start_agent(a)
.with_autonomous_mode()
.build() # raises TypeError today
)Error Messages / Stack Traces
TypeError: Handoff can only be applied to Agent. Please ensure the agent is a Agent instance.
Package Versions
- agent-framework-core:
1.0.0rc2 - agent-framework-orchestrations:
1.0.0b260225 - Source commit tested:
02ba27493(main)
Python Version
Python 3.13.5
Additional Context
Likely locations:
packages/orchestrations/agent_framework_orchestrations/_handoff.pyHandoffBuilder.participants(...)HandoffAgentExecutor._prepare_agent_with_handoffs(...)
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
bugSomething isn't workingSomething isn't workingpythonworkflowsRelated to Workflows in agent-frameworkRelated to Workflows in agent-framework