Skip to content

fix: preserve all tool calls in streamed chunks in hf - #11526

Merged
kausmeows merged 4 commits into
agno-agi:mainfrom
princejain756:fix/huggingface-stream-tool-calls
Nov 9, 2026
Merged

kausmeows merged 4 commits into
agno-agi:mainfrom
princejain756:fix/huggingface-stream-tool-calls

Conversation

@princejain756

@princejain756 princejain756 commented Nov 8, 2026 •

Copy link
Copy Markdown
Contributor

Summary

Fixes #11518

_parse_provider_response_delta was wrapping response_delta_message.tool_calls in an extra list ([response_delta_message.tool_calls]), and parse_tool_calls then only read tool_call[0] from each item. Whenever a single stream chunk carried more than one tool call, everything after index 0 got dropped.

Unwrapped model_response.tool_calls in _parse_provider_response_delta so it matches OpenAIChat and Groq, and updated parse_tool_calls to iterate all tool call deltas in a chunk (still accepting nested lists in case anything calls parse_tool_calls directly with the old shape). Added unit tests in test_huggingface_request_params.py.

Type of change

  • Bug fix
  • New feature
  • Breaking change
  • Improvement
  • Model update
  • Other:

Checklist

  • Code complies with style guidelines
  • Ran format/validation scripts (./scripts/format.sh and ./scripts/validate.sh)
  • Self-review completed
  • Documentation updated (comments, docstrings)
  • Examples and guides: Relevant cookbook examples have been included or updated (if applicable)
  • Tested in clean environment
  • Tests added/updated (if applicable)

Duplicate and AI-Generated PR Check

  • I have searched existing open pull requests and confirmed that no other PR already addresses this issue
  • If a similar PR exists, I have explained below why this PR is a better approach
  • Check if this PR was entirely AI-generated (by Copilot, Claude Code, Cursor, etc.)

Additional Notes

Ran pytest libs/agno/tests/unit/models/test_huggingface_request_params.py (15 passed).

@princejain756
princejain756 requested a review from a team as a code owner November 8, 2026 16:28
@kausmeows kausmeows changed the title fix(huggingface): preserve all tool calls in streamed chunks fix: preserve all tool calls in streamed chunks in hf Nov 9, 2026

@kausmeows kausmeows left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the fix!

@kausmeows
kausmeows merged commit 7dc4f73 into agno-agi:main Nov 9, 2026
13 checks passed
@kausmeows kausmeows mentioned this pull request Nov 11, 2026
kausmeows added a commit that referenced this pull request Nov 12, 2026
## Summary

Agno v3.2 makes Super Agent faster and more capable with direct tools,
expands Company task governance and coordination, introduces
database-backed AgentOS homepage metrics, upgrades A2A to the v1.0
protocol, and makes external agents first-class stored components.

## Changelog

### Breaking changes

- **OS Manager defaults and validation:** `OSManager.tool_call_limit`
now defaults to 24 (was 8), and `num_history_runs` defaults to 5 (was
7). AgentOS refuses startup when `OSManager(root=...)` is combined with
custom tools named `read_file`, `list_files`, or `search_content`.
- **A2A v1.0:** AgentOS and `A2AClient` now run on the official
`a2a-sdk` 1.x, so upgrade the Agno server and client together.
([#10956](#10956))
- The `/v1/message:*` and `/v1/tasks:*` routes are removed; use each
entity's A2A endpoint instead.
  - Stream events and response artifacts follow the v1.0 shape.
  - The `a2a` extra now requires `a2a-sdk[http-server]>=1.2.2,<2`.
  - Direct imports of removed A2A helpers need updating.
- Standard v0.3 clients still work through the compatibility wire by
default.
 
### New features

- **Super Agent:** Super Agent now does the work itself instead of
routing requests through manager members. Platform Builder is its only
member. ([#11572](#11572))
- Lists and runs agents, teams, and workflows, and reads platform
activity and schedules.
- Uses Company, docs, source-file, and custom OS Manager tools, and
reads the current chat history.
- Its context includes accessible components, and every tool keeps its
own permission check.
- **Company OS:** Routines get a dedicated runner, Tasks carry richer
state, and published Studio components can execute work.
- **Mini Agent for Routines:** Routines run on a restricted, non-chat
Mini Agent with Company tools and packaged Routine skills, but no
platform or general run tools. It is hidden from agent discovery, MCP,
and A2A, and refuses non-Routine runs.
([#11572](#11572))
- **Task coordination:** Tasks expose `last_run` and API-computed
`allowed_transitions`, support direct start, and record durable attempt
state. Super Agent can start an accepted Task on the durable queue
without blocking the conversation; human acceptance and review are
unchanged. ([#11430](#11430),
[#11562](#11562))
- **Company details:** set a Company name and description in config,
through `/company/details`, or from chat, with confirmation before
replacing existing details. Super Agent gets fresh Company context on
every run plus concise coordination guidance.
([#11502](#11502),
[#11569](#11569),
[#11563](#11563))
- **Studio components as executors:** published Studio agents, teams,
and workflows can execute Company Tasks and Routines. Drafts cannot, and
normal executor safety checks still apply.
([#11443](#11443))
- **AgentOS homepage metrics:** new component, aggregate, and refresh
tables back daily sessions, runs, tokens, users, models, cost, duration,
time-to-first-token, and model latency through `/os/metrics/*`.
Refreshes run in the background on all supported databases, rebuild only
changed days, support ETags, and aggregate across multiple local or
remote databases.
([#10874](#10874))
- **Stored external-agent components:** `ClaudeAgent` and `CodexAgent`
can be saved, loaded, versioned, listed, and run through the components
API. Sandbox and output-schema references resolve through the registry,
and unsupported or non-serializable settings fail explicitly instead of
being silently dropped.
([#11268](#11268))
- **A2A stored tasks and lifecycle:** A2A tasks are stored in the
database and support send, stream, get, cancel, list, and subscribe.
External agents are served, HITL and external tools can pause and
continue, and Agent Cards advertise both v1.0 and v0.3 interfaces.
([#10956](#10956))
- **Session-run pagination:** `GET /sessions/{session_id}/runs` supports
opt-in cursor pagination via `limit`, `before_run_index`, and
`after_run_index`. Pages keep top-level runs together with their nested
member and step runs, and calls without `limit` still return a bare
list. ([#8456](#8456))

### Improvements

- **Studio component ID recovery:** Studio tools normalize surrounding
whitespace and invisible format characters in component IDs. Read-only
`get_component` can resolve a visible leading ID followed by stray text
and warns with the exact ID; mutating tools remain strict.
([#11572](#11572))
- **Sandbox operation and deployment:** Redis is optional for sandboxed
agents on the durable queue; Postgres plus a shared checkpoint store now
handles cross-replica cancellation, resume, and recovery. Checkpoint
restore/capture also run outside long-lived database transactions,
avoiding blocked writers, exhausted connections, and lease expiry during
large transfers. ([#11217](#11217),
[#11192](#11192))
- **Metrics accuracy and compatibility:** run/session token totals now
avoid double counting, include failed/cancelled external runs and all
model/tool-loop calls, and report corrected timing and provider usage.
MongoDB, Valkey, and DynamoDB legacy-run refreshes are corrected and
optimized; no-op refresh messages move to debug; fresh installs no
longer create the deprecated `agno_metrics` table.
([#11426](#11426),
[#11574](#11574),
[#11570](#11570),
[#11579](#11579))
- **Manager and MCP discovery:** manifest descriptions are included in
manager discovery, and MCP Server Cards honor `X-Forwarded-Proto` even
without `X-Forwarded-Host`.
([#11394](#11394),
[#11396](#11396))

### Model and provider updates

- **Gemini:** supported Developer API features default to `v1beta`
unless callers explicitly select a version; `generation_config` and
`generative_model_kwargs` values are preserved instead of being
overwritten by unset model fields.
([#11564](#11564),
[#10162](#10162))
- **Mistral:** streaming calls now send Pydantic or dictionary output
schemas, restoring native structured output constraints.
([#11273](#11273))
- **OpenAIResponses:** per-request derived reasoning parameters no
longer mutate shared model state or the caller's reasoning dictionary.
([#10310](#10310))
- **Hugging Face:** streamed chunks retain every tool call instead of
dropping all but the first; deprecated cookbook model IDs are updated.
([#11526](#11526),
[#11541](#11541))
- **SmallestTools:** defaults move to the supported Lightning Pro model
and voice catalog.
([#11479](#11479))
- **SurrealDB:** the dependency is pinned below 3.0 to avoid resolving
an incompatible major release.
([#11484](#11484))

### Bug fixes

- **Run storage and ordering:** new runs never receive an index below a
session's existing maximum after earlier runs are deleted; SingleStore
run upserts work with this ordering; deleted runs are scrubbed
atomically from the legacy session blob; Team and Workflow run
deserialization restores `RunStatus`.
([#9938](#9938),
[#11508](#11508),
[#11496](#11496),
[#11424](#11424))
- **Team list input:** roleful message lists retain their roles and
attached media without leaking few-shot `additional_input` into memory
updates or sending orphaned tool results.
([#11497](#11497))
- **GmailTools:** list operations preserve HTML and nested message
bodies. ([#10359](#10359))
- **DuckDB:** full-text results are ordered by descending relevance.
([#11362](#11362))
- **ApifyTools:** supports `apify-client` 3.x response models; the
job-search cookbook now enforces its item cap.
([#11407](#11407),
[#11400](#11400))
- **YouTube:** `SearchAPI` honors an explicit zero-result limit, and
`YouTubeReader.async_read()` accepts the documented `name` argument.
([#11370](#11370),
[#11417](#11417))
- **CSV readers:** `FieldLabeledCSVReader` handles `None` and non-string
stream names. ([#11397](#11397))

### Documentation and internal maintenance

- Added a Membase memory integration example and corrected the FlexAI
DeepSeek image-input model ID.
([#11552](#11552),
[#11401](#11401))
- Corrected tool docstring argument/return sections and clarified README
capabilities and guide links. Company tool documentation no longer
recommends unsupported direct MCP publication.
([#11523](#11523),
[#11516](#11516),
[#11388](#11388),
[#11444](#11444),
[#11578](#11578))
- Fixed AG-UI typing with `jsonpatch` 1.41. A temporary Validation
test-sharding change was reverted, leaving no release behavior change.
([#11438](#11438),
[#11234](#11234),
[#11490](#11490))

## Type of change

- [x] Bug fix
- [x] New feature
- [x] Breaking change
- [x] Improvement
- [x] Model update
- [x] Other: release

---

## Checklist

- [ ] Code complies with style guidelines
- [ ] Ran format/validation scripts (`./scripts/format.sh` and
`./scripts/validate.sh`)
- [x] Self-review completed
- [x] Documentation updated (comments, docstrings)
- [x] Examples and guides: Relevant cookbook examples have been included
or updated (if applicable)
- [ ] Tested in clean environment
- [x] Tests added/updated (if applicable)

### Duplicate and AI-Generated PR Check

- [x] I have searched existing [open pull
requests](https://github.com/agno-agi/agno/pulls) and confirmed that no
other PR already addresses this issue
- [ ] If a similar PR exists, I have explained below why this PR is a
better approach
- [ ] Check if this PR was entirely AI-generated (by Copilot, Claude
Code, Cursor, etc.)

---

## Additional Notes

- Review the breaking-change section before upgrading integrations that
use manager IDs, A2A, Slack or Company Project/Task automation,

---------

Co-authored-by: Yash Pratap Solanky <[email protected]>
Co-authored-by: Sannya Singal <[email protected]>
Co-authored-by: Harsh <[email protected]>
Co-authored-by: Harsh Sinha <[email protected]>
Co-authored-by: ysolanky <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Bug] HuggingFace streaming keeps only the first tool call when a chunk carries several

2 participants