Bug Description
Summary
When a FunctionAgent is executed directly using agent.run(), its structured_output_fn is invoked as expected.
However, when the same agent is executed through an AgentWorkflow using workflow.run(), the agent's structured_output_fn is never called. Instead, only AgentWorkflow.structured_output_fn is consulted.
This behaviour is inconsistent because FunctionAgent exposes a structured_output_fn parameter that appears to be supported, but it is silently ignored when the agent is used inside an AgentWorkflow.
Version
0.14.22
Steps to Reproduce
Minimal Reproduction
async def structured_output_fn(messages):
print("Structured output callback invoked")
return None
agent = FunctionAgent(
name="ProfileCollector",
tools=[tool],
llm=llm,
structured_output_fn=structured_output_fn,
)
workflow = AgentWorkflow(
agents=[agent],
root_agent="ProfileCollector",
)
await workflow.run(user_msg="My name is Charlie")
Expected Behaviour
The callback assigned to the FunctionAgent should be executed after the agent completes, just as it is when calling await agent.run(...)
Actual Behaviour
The callback is never executed.
If the exact same callback is instead attached to the workflow:
workflow = AgentWorkflow(
agents=[agent],
root_agent="ProfileCollector",
structured_output_fn=structured_output_fn,
)
then it executes correctly.
Questions
Is this intentional?
Relevant Logs/Tracebacks
Bug Description
Summary
When a
FunctionAgentis executed directly usingagent.run(), itsstructured_output_fnis invoked as expected.However, when the same agent is executed through an
AgentWorkflowusingworkflow.run(), the agent'sstructured_output_fnis never called. Instead, onlyAgentWorkflow.structured_output_fnis consulted.This behaviour is inconsistent because
FunctionAgentexposes astructured_output_fnparameter that appears to be supported, but it is silently ignored when the agent is used inside anAgentWorkflow.Version
0.14.22
Steps to Reproduce
Minimal Reproduction
Expected Behaviour
The callback assigned to the
FunctionAgentshould be executed after the agent completes, just as it is when callingawait agent.run(...)Actual Behaviour
The callback is never executed.
If the exact same callback is instead attached to the workflow:
then it executes correctly.
Questions
Is this intentional?
Relevant Logs/Tracebacks