Hi Agno team,
I’m seeing an issue where my agent returns a tool call and a answer together.
Agno version: 2.3.21
Model: grok-4-1-fast-non-reasoning
Example:
Question (user):
what is yesterday’s settlement for THE YOUNG CLINIC.
Agent response:
ai:function_call name="run_sql_query"> <parameter name="query">SELECT s.payment_date, s.transactions_amount, s.transactions_count FROM settlements s WHERE s.customer_id = 8879 ORDER BY s.payment_date DESC LIMIT 5</parameter> </xai:function_call>
For THE YOUNG CLINIC (customer_id 8879):** No settlement batch on Jan 5 (yesterday)—their most recent is today's £718.25 (per daily_reports for Jan 6 report). Looking back, no matching payment_date='2026-01-05' in settlements table. Worth noting they had flagged risk txns today but nothing yesterday.
I expects the agent to only return only the answer and not tool call. How can I fix this?
Agent setup (partial):
self.sql_tools = ReadOnlySQLTools(
db_url=env_config.agent_database_url,
enable_list_tables=True,
enable_describe_table=True,
enable_run_sql_query=True,
)
self.agent = Agent(
name=“DatabaseAnalyst”,
description="",
instructions"",
model=xAI(id=“grok-4-1-fast-non-reasoning”, temperature=0.1),
tools=\[self.sql_tools, self.notes_tools\],
session_id=session_id,
db=self.database,
add_history_to_context=True,
num_history_runs=5,
read_chat_history=True,
stream=True,
markdown=True,
add_datetime_to_context=True
debug_mode=True
)
What I’ve tried
- Set debug_mode=False → same behaviour
- Changed tools → same issue
- Downgraded Agno to 2.3.13 (this version never had the issue before, but now it still happens)
- Issue is inconsistent: sometimes it happens, sometimes it doesn’t
I also tested with GPT-4o-mini (around 10 questions), and it worked correctly, no tool calls shown.
So I’m wondering, Is this related to the xAI? Or is there a setting to force answer-only output?
Thanks!