Skip to content

Conversation

@greysonlalonde
Copy link
Contributor

@greysonlalonde greysonlalonde commented Dec 11, 2025

Supports #3982


Note

Introduces provider-agnostic streaming tool-call events and instrumentation.

  • Adds call_type and tool_call data to _emit_stream_chunk_event in BaseLLM to distinguish text vs tool chunks
  • Emits LLMCallType.TOOL_CALL stream events with {id, function{name, arguments}, type, index} across providers:
    • Anthropic: tracks tool-use blocks by content index; streams partial input_json_delta arguments
    • Azure/OpenAI: accumulates tool-call args keyed by sequential index; emits incremental chunks with consistent ids
    • Bedrock: tracks toolUse start/delta/stop, accumulates input, emits tool-call chunks; minor typing/message formatting cleanups
    • Gemini: streams function_call parts, assigns unique call ids, emits args as JSON
  • Updates structured-output handling where needed (e.g., Gemini tool param passing)
  • Adds comprehensive tests and VCR cassettes validating event shape, argument accumulation, id consistency, and text vs tool differentiation

Written by Cursor Bugbot for commit 9f7c853. This will update automatically on new commits. Configure here.

Copy link
Contributor

@lucasgomide lucasgomide left a comment

Choose a reason for hiding this comment

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

Can you add some tests?

Copy link

@cursor cursor bot left a comment

Choose a reason for hiding this comment

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

This PR is being reviewed by Cursor Bugbot

Details

Your team is on the Bugbot Free tier. On this plan, Bugbot will review limited PRs each billing cycle for each member of your team.

To receive Bugbot reviews on all of your PRs, visit the Cursor dashboard to activate Pro and start your 14-day free trial.

@greysonlalonde greysonlalonde requested review from a team and lucasgomide January 5, 2026 15:36
@greysonlalonde greysonlalonde merged commit f8deb0f into main Jan 5, 2026
43 checks passed
@greysonlalonde greysonlalonde deleted the gl/feat/tool-call-stream-events branch January 5, 2026 19:33
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] Streaming Output Missing Tool Call Events in Provider-Specific LLM Classes

4 participants