CrewAI NL2SQL Tool Truncates SQL Queries

I am using this crewai’s Nl2SQL tool for a SQL query generation task, sometimes the tool’s behaves like the NL2SQLTool receives the full SQL query as seen in the Tool Input, but the debug log prints only a truncated portion, often stopping at ...AND date =, leading to execution failure. Behaviour Differs Between Standalone and FastAPI: The same agent, prompt, and code work perfectly when executed as a standalone script but fail when used within a FastAPI-based environment using .kickoff(). Why is it happening?

  • You can see in the screenshot clearly that the tool input has the full SQL query, but the output shows that only half of the query is used during execution
  • I opened the tools code and used a print statement there, and that also clearly shows that only half query is going to the tool while execution.