Skip to content
Changelog

HuggingFace models accept every field they document

October 27, 20261 min read

Agno's HuggingFace model raised TypeError in earlier releases the moment it built its InferenceClient if you set default_headers, max_retries or default_query, because the huggingface_hub SDK takes none of those names. Setting store failed every run in the same way, one step later.

This release maps default_headers to the SDK's headers. max_retries and default_query have no SDK counterpart, so the model warns once with a DeprecationWarning and drops them. Use Agno's retries= to retry, and put query parameters in base_url. store now rides in extra_body, and a store you write into request_params["extra_body"] yourself wins.

Agents with no tools also sent tools=[] with tool_choice="auto". HuggingFace backends answered that request with no text, so non-streaming run and arun returned None content while streaming looked fine. The request now leaves both fields out.

# Real output, dummy token, InferenceClient.chat_completion mocked to capture the request
 
# Before
HuggingFace(default_headers={"X-Team": "agno"}).get_client()
TypeError: InferenceClient.__init__() got an unexpected keyword argument 'default_headers'
HuggingFace(store=True), agent.run("Say hello")
InferenceClient.chat_completion() got an unexpected keyword argument 'store'
agent with no tools sent: {'tools': [], 'tool_choice': 'auto'}
 
# Now
client params: {'headers': {'X-Team': 'agno'}}
store=True request params: {'extra_body': {'store': True}}
agent with no tools sent: no tools / tool_choice

See the cookbook, and learn more about the HuggingFace model and its parameters in the documentation.

Frequently asked questions

Set default_headers={...} on HuggingFace. Agno hands the dict to InferenceClient as its headers argument. Anything in client_params still overrides it.

Both raise a DeprecationWarning when the model is created and are then ignored, because InferenceClient has no matching setting. Use Agno's retries= for retrying and put query parameters in base_url.

chat_completion() has no store argument, so Agno puts it in extra_body, the request body that OpenAI-compatible backends read. A store you set yourself in request_params["extra_body"] takes priority.

Shipped around the same time