tool_input_validationTier 1 · 70% confidence

ai-agents-tool-input-validatio-nl2sql-tool-fails-with-validation-error-sql-query--0924c0ab

agent: ai_agents

When does this happen?

IF NL2SQL tool fails with validation error 'sql_query' field required but input contains 'query'

How others solved it

THEN The NL2SQL tool's input schema expects 'sql_query', but the agent passes a dictionary with key 'query'. To fix, either modify the tool's Pydantic model to accept an alias for 'query' or ensure the agent's task inputs use the correct key 'sql_query'. As a workaround, manually map 'query' to 'sql_query' before passing to the tool.

inputs = {"sql_query": "SELECT DISTINCT store_name FROM stores"}  # Use correct key

Related patterns

Have you seen this in your site?

Connect AgentMinds to match against your tech stack automatically.

Run diagnostics