Skip to content

Feat/python sdk client tool events#43

Open
sebvanleuven wants to merge 3 commits intomainfrom
feat/python-sdk-client-tool-events
Open

Feat/python sdk client tool events#43
sebvanleuven wants to merge 3 commits intomainfrom
feat/python-sdk-client-tool-events

Conversation

@sebvanleuven
Copy link
Contributor

@sebvanleuven sebvanleuven commented Mar 3, 2026

Adding Client Side Tool Events support: - Receive function/tool invocations from the LLM for custom client-side logic (function calling)
Reasoning Stream events support: -Receive LLM chain-of-thought/reasoning as it streams (REASONING_STREAM_EVENT_RECEIVED, REASONING_HISTORY_UPDATED)


Summary by cubic

Adds client-side tool events (function calling) and reasoning stream events to the Python SDK so apps can handle LLM-invoked tools and stream chain-of-thought with history tracking.

  • New Features
    • Events: CLIENT_TOOL_EVENT_RECEIVED, REASONING_STREAM_EVENT_RECEIVED, REASONING_HISTORY_UPDATED; types: ClientToolEvent, ReasoningStreamEvent, ReasoningMessage.
    • Client: handles "clientToolEvent" and "reasoningText" messages, emits events, accumulates reasoning history; adds get_reasoning_history(); clears reasoning on close.
    • Docs/Tests: README examples for new handlers and history access; unit tests for both features; lockfile version bumped to 0.4.0a1.

Written for commit a8dddac. Summary will update on new commits.

- Add ClientToolEvent dataclass and CLIENT_TOOL_EVENT_RECEIVED event
- Handle clientToolEvent data channel messages in _handle_data_message
- Emit event when LLM invokes client-side tools
- Add unit test for client tool event handling
- Document in README with example usage

Made-with: Cursor
- Add ReasoningStreamEvent, ReasoningMessage types
- Add REASONING_STREAM_EVENT_RECEIVED and REASONING_HISTORY_UPDATED events
- Handle reasoningText data channel messages in _handle_data_message
- Track reasoning history and emit REASONING_HISTORY_UPDATED on end_of_thought
- Add get_reasoning_history() method
- Add unit tests for reasoning event handling
- Document in README with examples

Made-with: Cursor
@sebvanleuven sebvanleuven requested review from Smidge and ao-anam March 3, 2026 14:21
Copy link

@cubic-dev-ai cubic-dev-ai bot left a comment

Choose a reason for hiding this comment

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

No issues found across 6 files

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.

1 participant