Summary
_builtins_deserialization_plugin.convert_to_wayflow checks isinstance(component, AgentSpecAgentNode) before isinstance(component, AgentSpecExtendedAgentNode). Because AgentSpecExtendedAgentNode inherits from AgentSpecAgentNode, the first branch always fires for any extended node type, passing caller_input_mode=None to AgentExecutionStep.__init__.
AgentExecutionStep.__init__ then raises a ValueError because None is not a valid CallerInputMode, which pyagentspec wraps into a TypeError via model_validator_with_error_accumulation.
Reproduction
- Create an
agent.json with an AgentNode that contains an A2AAgent component.
- Call
AgentSpecLoader.load_json(spec_str).
- The deserialization raises:
TypeError: ValueError: 'error' required in context
The root cause: the elif chain in the deserialization plugin should check isinstance(component, AgentSpecExtendedAgentNode) before isinstance(component, AgentSpecAgentNode) so that the more-specific subclass branch is reached first.
Expected behaviour
A2AAgent nodes (which produce AgentSpecExtendedAgentNode instances) should be handled by the extended-node branch of the deserialization plugin, receiving the correct caller_input_mode value instead of None.
Workaround
We monkey-patch AgentExecutionStep.__init__ at container startup to default caller_input_mode=None to CallerInputMode.ALWAYS:
_orig = AgentExecutionStep.__init__
_sig = inspect.signature(_orig)
def _patched(self, *args, **kwargs):
bound = _sig.bind(self, *args, **kwargs)
bound.apply_defaults()
if bound.arguments.get("caller_input_mode") is None:
bound.arguments["caller_input_mode"] = CallerInputMode.ALWAYS
_orig(*bound.args, **bound.kwargs)
AgentExecutionStep.__init__ = _patched
Environment
wayflowcore[a2a]==26.1.1
- Python 3.11
Summary
_builtins_deserialization_plugin.convert_to_wayflowchecksisinstance(component, AgentSpecAgentNode)beforeisinstance(component, AgentSpecExtendedAgentNode). BecauseAgentSpecExtendedAgentNodeinherits fromAgentSpecAgentNode, the first branch always fires for any extended node type, passingcaller_input_mode=NonetoAgentExecutionStep.__init__.AgentExecutionStep.__init__then raises aValueErrorbecauseNoneis not a validCallerInputMode, which pyagentspec wraps into aTypeErrorviamodel_validator_with_error_accumulation.Reproduction
agent.jsonwith anAgentNodethat contains anA2AAgentcomponent.AgentSpecLoader.load_json(spec_str).The root cause: the elif chain in the deserialization plugin should check
isinstance(component, AgentSpecExtendedAgentNode)beforeisinstance(component, AgentSpecAgentNode)so that the more-specific subclass branch is reached first.Expected behaviour
A2AAgentnodes (which produceAgentSpecExtendedAgentNodeinstances) should be handled by the extended-node branch of the deserialization plugin, receiving the correctcaller_input_modevalue instead ofNone.Workaround
We monkey-patch
AgentExecutionStep.__init__at container startup to defaultcaller_input_mode=NonetoCallerInputMode.ALWAYS:Environment
wayflowcore[a2a]==26.1.1