* Fix agent loop continuing after cancellation in letta_agent_v3
Bug: When a run is cancelled, _check_run_cancellation() sets
self.should_continue=False and returns early from _step(), but the outer
for loop (line 245) continues to the next iteration, executing subsequent
steps even though cancellation was requested.
Symptom: User hits cancel during step 1, backend marks run as cancelled,
but agent continues executing steps 2, 3, etc.
Root cause: After the 'async for chunk in response' loop completes (line 255),
there was no check of self.should_continue before continuing to the next
iteration of the outer step loop.
Fix: Added 'if not self.should_continue: break' check after the inner loop
to exit the outer step loop when cancellation is detected. This makes v3
consistent with v2 which already had this check (line 306-307).
🐾 Generated with [Letta Code](https://letta.com)
Co-authored-by: Letta <noreply@letta.com>
* add integration tests
* fix: misc fixes required to get cancellations to work on letta code localhost
---------
Co-authored-by: Letta <noreply@letta.com>
Co-authored-by: Sarah Wooders <sarahwooders@gmail.com>
* chore: migrate integration test send message to v1 sdk
* new folder
* set up new workflows for integration test
* remove file
* update stainless workflow
* fix import err
* add letta-client version logging
* fix: SDK cache miss should fall back to PyPI instead of failing
When the Stainless SDK cache is not available, the workflow should
fall back to installing the published SDK from PyPI rather than
failing the CI build. The workflow already has this fallback logic
in the "Install Stainless SDK" step, but the "Check SDK cache"
step was failing before it could reach that point.
This change converts the hard failure (exit 1) to a warning message,
allowing the workflow to continue and use the PyPI fallback.
Co-Authored-By: Claude <noreply@anthropic.com>
* force upgrade
* remove frozen
* install before running
* add no sync
* use upgrade instead of upgrade package
* update
* fix llm config
* fix
* update
* update path
* update workflow
* see installed version
* add fallback
* update
* fix mini
* lettaping
* fix: handle o1 token streaming and LettaPing step_id validation
- Skip LettaPing messages in step_id validation (they don't have step_id)
- Move o1/o3/o4 token streaming check before general assertion in assert_tool_call_response
- o1 reasoning models omit AssistantMessage in token streaming mode (6 messages instead of 7)
---------
Co-authored-by: Kian Jones <kian@letta.com>
Co-authored-by: Claude <noreply@anthropic.com>
* first hack
* clean up
* first implementation working
* revert package-lock
* remove openai test
* error throw
* typo
* Update integration_test_send_message_v2.py
* Update integration_test_send_message_v2.py
* refine test
* Only make changes for openai non streaming
* Add tests
---------
Co-authored-by: Ari Webb <ari@letta.com>
Co-authored-by: Matt Zhou <mattzh1314@gmail.com>
* claude coded first pass
* fix test cases to expect errors instead
* fix this
* let's see how letta-code did
* claude
* fix tests, remove dangling comments, retrofit all managers functions with decorator
* revert to main for these since we are not erroring on invalid tool and block ids
* reorder decorators
* finish refactoring test cases
* reorder agent_manager decorators and fix test tool manager
* add decorator on missing managers
* fix id sources
* remove redundant check
* uses enum now
* move to enum
* feat: add tool_used field to run_metrics [LET-5419]
* change to tool name
* use tool ids over names
* feat: add internal runs route with template_family filtering
* feat: add step count filtering to internal runs [LET-5417]
* remove import
* add auto generated
* feat: add tools used filtering to internal runs [LET-5415]
* add test
* add test
* fix snippets