[Bug] generate_csv_file drops keys missing from the first row
Author: MohammadHijjawi97Created Sep 17, 2026Updated Sep 17, 2026
Description
FileGenerationTools.generate_csv_file takes CSV headers from the first dict only. Later rows with extra keys silently drop those fields.
Steps to Reproduce
from agno.tools.file import FileGenerationTools
tools = FileGenerationTools()
result = tools.generate_csv_file([
{"name": "Ada"},
{"name": "Ben", "city": "London"},
])
print(result.files[0].content.decode("utf-8"))Expected Behavior
The CSV includes every key that appears in any row. Missing values are empty cells.
Actual Behavior
The city column is omitted. Ben's city is lost.
Environment
- OS: Windows 11
- Agno Version: current main
- Additional Environment Details: Python 3.13
Possible Solutions (optional)
Union keys across all dict rows, preserving first-seen order.
Source: agno-agi/agno