[BUG] the output_file attribute is not working, if its configured in yaml file -- Interpolation is not working for output_file attribute
Description
If I configured the output_file attribute in tasks.yaml file, the output file is not getting generated. Task.yaml
Task_Name: > description: > ........ expected_output: > .......... Agent: > ........... output_file: > {Out_Dir}/InternalDesignDocument/{TriggerDt}/{ClassName}/{ClassName}_{method_name}InternalDesignDocument{DateAndTime}.md
Steps to Reproduce
sample Tasks.yaml
Task_Name: > description: > ........ expected_output: > .......... Agent: > ........... output_file: > {Out_Dir}/InternalDesignDocument/{TriggerDt}/{ClassName}/{ClassName}_{method_name}InternalDesignDocument{DateAndTime}.md
generate the output file using tasks.yaml
Expected behavior
the output file should generate in specified format in tasks.yaml
Screenshots/Code snippets
I have verified in local, the output file is getting generated but not in specified format.
Operating System
macOS Sonoma
Python Version
3.12
crewAI Version
crewai[tools]>=0.86.0,<1.0.0
crewAI Tools Version
crewai-tools==0.17.0
Virtual Environment
Venv
Evidence
I have verified in local, the output file is not getting generated.
Possible Solution
Enable the interpolation for the attribute "output_file", when we used it in the tasks.yaml
Additional context
please fix it soon. If the interpolation is enable for the output file attribute, then its easy to make the file name flexible at runtime.
It looks like the relevant code is here: https://github.com/crewAIInc/crewAI/blob/main/src/crewai/task.py#L511
Without interpolation based on inputs, output_file is unusable with kickoff_for_each
Crew team, if you don't view interpolation as a requirement, please indicate the recommended workaround. (It looks like perhaps callback functions should be used, however the callback doesn't receive the crew inputs): https://docs.crewai.com/concepts/tasks#callback-mechanism)
Just merged a PR that allows you to use interpolation on output_file, it will be in the new version we will cut between today and Monday :)
Callback and after and before kickoff hook could be useful as well (https://docs.crewai.com/concepts/crews#example-crew-class-with-decorators) -- The before hook do get the input and the after the result.
There is also a new feature we will be launching with programatic guardrails that could help, it will be out in this new version.
But again with this change to the interpolation for output_file you might not need any workarounds
Thank you so much for the update @joaomdmoura .
Hi @joaomdmoura . I have one query. The output file attribute allow us to append the results of each kickoff, if the file is exists ?
Just merged a PR that allows you to use interpolation on output_file, it will be in the new version we will cut between today and Monday :)
Thanks @joaomdmoura! Any updates on release timeline? Looks like the latest release was Dec 5?: https://pypi.org/project/crewai/#history
Confirmed this is working for me in 0.95.0. Looks like you can close out the issue?
This issue is stale because it has been open for 30 days with no activity. Remove stale label or comment or this will be closed in 5 days.
This issue was closed because it has been stalled for 5 days with no activity.