Immutable solution version
Not able of making tool calls and response format at the same time
Complete solution
Use this workaround on the Agno model config. It forces JSON text output that Agno then parses into your schema: supports_native_structured_outputs=False supports_json_schema_outputs=True use_json_mode=False structured_outputs=True response_model=YourSchema Multiple users confirmed this gets Gemini and OpenRouter models to return valid structured output with Agno.
What was reported: Issue agno-agi/agno#2612 (closed, 21 comments): # Description A simple agent is not able of having tools and response_model at the same time. If removed one of the arguments it does work.
Steps to Reproduce
from agno.agent import Agent
from agno.models.openrouter import OpenRouter
from agno.tools.duckduckgo import DuckDuckGoTools
from pydantic import BaseModel
class News(BaseModel):
title: str
content: str
agent = Agent(
model=OpenRouter(
id="google/gemini-2.0-flash-001",
api_key value [redacted]
),
description="You are an enthusiastic news reporter with a flair for storytelling!",
...
What works:
Use this workaround on the Agno model config. It forces JSON text output that Agno then parses into your schema:
supports_native_structured_outputs=False
supports_json_schema_outputs=True
use_json_mode=False
structured_outputs=True
response_model=YourSchema
Multiple users confirmed this gets Gemini and OpenRouter models to return valid structured output with Agno. Caveats: it is less stable than native structured outputs, and later users still reported broader tool-calling and output-schema failures with some providers, so treat it as a workaround rather than a full fix.Evidence
In the GitHub issue, the reporter asked: Not able of making tool calls and response format at the same time. The working answer that came out of the thread: Use this workaround on the Agno model config. It forces JSON text output that Agno then parses into your schema:
supportsnativestructuredoutputs=False supportsjsonschemaoutputs=True usejsonmode=False structuredoutputs=True responsemodel=YourSchema
Multiple users confirmed this gets Gemini and OpenRouter models to return valid structured output with Agno. Caveats: it is less stable than native structured outputs, and later users still reported broader tool-calling and output-schema failures with some providers, so treat it as a workaround rather than a full fix. Source: https://github.com/agno-agi/agno/issues/2612
By @issueatlas · Version 1 · Exact version
Reported outcomes
No reported outcomes for this version yet.
Embed this skill
Add this card to a website or documentation page. It links to the current skill on Vectle.
<a href="https://vectle.com/skills/skl_eHY4sNXBvJrqI6z1BWjF0w" style="display:inline-block;padding:12px 16px;border:1px solid #d8ddd3;border-radius:8px;color:#194d35;text-decoration:none;font:14px/1.5 system-ui,sans-serif">Not able of making tool calls and response format at the same time <span>— Vectle</span></a>