Commit Graph

56 Commits

Author SHA1 Message Date
Sarah Wooders
c8fa77a01f feat: cleanup cancellation code and add more logging (#6588) 2025-12-15 12:02:34 -08:00
Kian Jones
09c027692f tests: assistant msg validation error (#6536)
* add regression test for dict content in AssistantMessage

Tests the fix for pydantic validation error when send_message tool
returns dict content like {'tofu': 1, 'mofu': 1, 'bofu': 1}.

The test verifies that dict content is properly serialized to JSON
string before creating AssistantMessage.

* improve type annotation for validate_function_response

Changed return type from Any to str | dict[str, Any] to match actual
behavior. This enables static type checkers (pyright, mypy) to catch
type mismatches like the AssistantMessage bug.

With proper type annotations, pyright would have caught:
  error: Argument of type "str | dict[str, Any]" cannot be assigned
  to parameter "content" of type "str"

This prevents future bugs where dict is passed to string-only fields.

* add regression test for dict content in AssistantMessage

Moved test into existing test_message_manager.py suite alongside other
message conversion tests.

Tests the fix for pydantic validation error when send_message tool
returns dict content like {'tofu': 1, 'mofu': 1, 'bofu': 1}.

The test verifies that dict content is properly serialized to JSON
string before creating AssistantMessage.
2025-12-15 12:02:34 -08:00
Sarah Wooders
91e3dd8b3e feat: fix new summarizer code and add more tests (#6461) 2025-12-15 12:02:19 -08:00
cthomas
e4c58da682 fix: streaming error for stop reason chunks (#6285) 2025-11-24 19:10:26 -08:00
Ari Webb
ec953d27c0 fix: double escape leads to exponential growth in backslash character [LET-6016] (#6087) 2025-11-24 19:09:33 -08:00
Kian Jones
e082ad7dec fix: assorted fixes (#6003)
* duration fix metrics for temporal, encryption_key in lettuce-py, and v1 sdk bugfix

* none user agent = True
2025-11-13 15:36:55 -08:00
Charles Packer
a6077f3927 fix(core): Fix agent loop continuing after cancellation in letta_agent_v3 [LET-6006] (#5905)
* 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>
2025-11-13 15:36:39 -08:00
cthomas
ee7f2b9e84 feat: add helper to verify sdk version [ADD-1] (#5698)
feat: add helper to verify sdk version
2025-10-24 15:14:17 -07:00
jnjpng
e3f794dac5 fix: handle async context task cleanup for mcp client [LET-5746] (#5619)
* base

* update

* update

---------

Co-authored-by: Letta Bot <noreply@letta.com>
2025-10-24 15:13:15 -07:00
Kian Jones
c2e474e03a feat: refactor logs to parse as a single log line each and filter out 404s from sentry (#5242)
* add multiline log auto detect

* implement logger.exception()

* filter out 404

* remove potentially problematic changes
2025-10-24 15:11:31 -07:00
Matthew Zhou
5511a08017 fix: Fix leaky opens (#2924) 2025-09-15 16:25:01 -07:00
cthomas
05c2b4ffd3 feat: add tags to feedback endpoint (#2881) 2025-09-14 17:23:50 -07:00
cthomas
858b8aa5c3 feat: add asyncio shield to async message route (#2825) 2025-09-10 17:38:43 -07:00
cthomas
2d971cdcf0 feat: hold reference to asyncio tasks in memory (#2823) 2025-09-10 17:08:07 -07:00
Matthew Zhou
f305d3bfac feat: Move message embedding to background task [LET-4189] (#4430)
* Test background message embedding

* Change to content
2025-09-04 15:05:35 -07:00
Kian Jones
ca6cfa5914 chore: migrate to ruff (#4305)
* base requirements

* autofix

* Configure ruff for Python linting and formatting

- Set up minimal ruff configuration with basic checks (E, W, F, I)
- Add temporary ignores for common issues during migration
- Configure pre-commit hooks to use ruff with pass_filenames
- This enables gradual migration from black to ruff

* Delete sdj

* autofixed only

* migrate lint action

* more autofixed

* more fixes

* change precommit

* try changing the hook

* try this stuff
2025-08-29 11:11:19 -07:00
Matthew Zhou
9358bec393 fix: Remove possibility of empty strings when updating (#4149) 2025-08-24 17:28:11 -07:00
Matthew Zhou
f918ca0a59 feat: Add better error catching for files upload (#4145) 2025-08-24 16:46:57 -07:00
cthomas
3de757d60e fix: type error for int comparison (#4010) 2025-08-19 13:09:55 -07:00
Andy Li
277c26a58e feat: modal sandbox 2025-07-30 11:25:40 -07:00
Eric Ly
ede781f37f fix: remove unwanted word in name generation (#3592)
Co-authored-by: Eric Ly <lyyeric@letta.com>
2025-07-29 22:55:36 +00:00
Matthew Zhou
b16f5ffc99 feat: Polishing open files tools (#3575)
Co-authored-by: Charles Packer <packercharles@gmail.com>
Co-authored-by: Shubham Naik <shub@letta.com>
Co-authored-by: Shubham Naik <shub@memgpt.ai>
Co-authored-by: cthomas <caren@letta.com>
Co-authored-by: jnjpng <jin@letta.com>
Co-authored-by: Jin Peng <jinjpeng@Jins-MacBook-Pro.local>
Co-authored-by: Cameron Pfiffer <cameron@pfiffer.org>
Co-authored-by: Kian Jones <11655409+kianjones9@users.noreply.github.com>
Co-authored-by: Kian Jones <kian@Kians-MacBook-Pro.local>
2025-07-29 15:46:51 -07:00
Andy Li
94d10589c8 fix: structured outputs for send_message, LettaMessage 2025-07-24 14:50:52 -07:00
Matthew Zhou
77140dcecc feat: Lower file config defaults for larger models (#3543) 2025-07-24 14:15:23 -07:00
Matthew Zhou
29573e4d3f feat: Add per-agent file management controls with context-aware defaults (#3467) 2025-07-22 10:43:37 -07:00
Andy Li
904d9ba5a2 chore: strings lint cleanup (#3374) 2025-07-18 09:20:45 -07:00
Matthew Zhou
31a16dd0d3 feat: Add alembic version to the agent file metadata (#3369)
just failing
2025-07-16 17:11:09 -07:00
Andy Li
f9bb757a98 feat: support for agent loop job cancelation (#2837) 2025-07-02 14:31:16 -07:00
Matthew Zhou
804ec12ee2 feat: Only add suffix on duplication (#3120) 2025-07-01 13:48:38 -07:00
Sarah Wooders
4128bbe6dc fix: fixes to step feedback listing (#3080) 2025-06-27 16:31:23 -07:00
Andy Li
018facd624 fix: bugfixes (and bump) (#3071) 2025-06-27 14:23:42 -07:00
Andy Li
617d208bcc fix: list ollama embeddings models (#2711) 2025-06-10 10:44:26 -07:00
Andy Li
fe317068f6 feat: plugin system and backend runtime flags (#2543) 2025-06-05 18:12:44 -07:00
Kevin Lin
ed4b28f3e4 feat: Add files into agent context window on file upload (#1852)
Co-authored-by: Caren Thomas <carenthomas@gmail.com>
Co-authored-by: Matt Zhou <mattzh1314@gmail.com>
2025-05-29 18:19:23 -07:00
Andy Li
595ef11221 fix: numerous tool execution bugs (#2371) 2025-05-23 18:02:15 -07:00
Andy Li
8e2417aa2f feat: async db client (#2076) 2025-05-12 17:15:14 -07:00
Charles Packer
ee8e095b69 fix: patch gemini 2.5 pro (#1643)
Co-authored-by: Sarah Wooders <sarahwooders@gmail.com>
2025-04-09 18:35:53 -07:00
Matthew Zhou
2fdbcf81b4 feat: Cache model handle (#1568) 2025-04-04 12:11:20 -07:00
Kevin Lin
98f0062416 feat: support deepseek models (#821)
Co-authored-by: Charles Packer <packercharles@gmail.com>
Co-authored-by: Sarah Wooders <sarahwooders@gmail.com>
Co-authored-by: Shubham Naik <shub@memgpt.ai>
Co-authored-by: Shubham Naik <shub@letta.com>
2025-02-18 15:28:01 -08:00
Matthew Zhou
8d765f286e feat: Composio tools execute on-the-fly (#999) 2025-02-13 16:13:29 -08:00
Matthew Zhou
2f9c600d7f feat: Add telemetry logging around agent / multi-agent broadcasting (#971) 2025-02-12 13:27:13 -08:00
Matthew Zhou
71620c1303 feat: Use Async OpenAI client to prevent blocking server thread (#811) 2025-01-28 14:02:33 -08:00
mlong93
18f06cd681 feat: new routes to gather a job's messages and usage statistics (#564)
Co-authored-by: Mindy Long <mindy@letta.com>
2025-01-12 12:36:10 -08:00
Caren Thomas
7144fd2867 run black, add isort config to pyproject.toml 2024-12-26 19:43:11 -08:00
Caren Thomas
905906d416 run isort on apps/core 2024-12-26 19:27:09 -08:00
Shubham Naik
4cf354c033 fix: add tests to cypress 2024-12-23 14:44:08 -08:00
cthomas
a5b1aac1fd fix: propagate error on tool failure (#2281)
Co-authored-by: Caren Thomas <caren@caren-mac.local>
2024-12-20 16:38:16 -08:00
cthomas
6fb2968006 fix: refactor sandbox run logic to add status field (#2248)
Co-authored-by: Caren Thomas <caren@caren-mac.local>
2024-12-17 15:44:41 -08:00
Matthew Zhou
7908b8a15f feat: Rewrite agents (#2232) 2024-12-13 14:43:19 -08:00
Sarah Wooders
d61b2f9545 feat: enable configuration of response_char_limit for tools (#2207) 2024-12-09 18:55:18 -08:00