Commit Graph

1489 Commits

Author SHA1 Message Date
Kian Jones
71bce718f7 Add lightweight event loop watchdog monitoring (#6209)
* Add lightweight event loop watchdog monitoring

- Thread-based watchdog detects event loop hangs >15s
- Runs independently, won't interfere with normal operation
- Disabled in test environments
- Minimal overhead, just heartbeat checks every 5s

* actually test it

* Add test script to validate watchdog detects hangs

Run with: uv run python test_watchdog_hang.py

Tests:
- Normal operation (no false positives)
- Short blocks under threshold (no alerts)
- Long blocks over threshold (correctly alerts)
2025-11-24 19:09:33 -08:00
Sarah Wooders
a466e65e6b feat: move sources to folders [LET-6189] (#6199) 2025-11-24 19:09:32 -08:00
Sarah Wooders
cce0f41095 Revert "feat: make attach/detach routes return None if version is 1.0 [LET-5844]" (#6201)
Revert "feat: make attach/detach routes return None if version is 1.0 [LET-58…"

This reverts commit 328c481da6e4e0f7f30a82dcc287c90835f431cc.
2025-11-24 19:09:32 -08:00
Ari Webb
e20feaa3e4 feat: make attach/detach routes return None if version is 1.0 [LET-5844] (#6141)
---------

Co-authored-by: Ari Webb <ari@letta.com>
2025-11-24 19:09:32 -08:00
Kian Jones
a5e435c56f fix: register memory monitor at startup (#6195)
register monitor at startup
2025-11-24 19:09:32 -08:00
Kian Jones
848aa962b6 feat: add memory tracking to core (#6179)
* add memory tracking to core

* move to asyncio from threading.Thread

* remove threading.thread all the way

* delay decorator monitoring initialization until after event loop is registered

* context manager to decorator

* add psutil
2025-11-24 19:09:32 -08:00
Kian Jones
98ab655765 chore: add add limit of 100 (#6143)
* add limit of 100

* revert scheduler logging

* api changes

* remove redundant None type check
2025-11-13 15:36:56 -08:00
cthomas
0c06dbf047 feat: remove ssl allocation from startup (#6127) 2025-11-13 15:36:56 -08:00
Sarah Wooders
ff87673963 feat: deprecate EmbeddingConfig from archives (#6038) 2025-11-13 15:36:56 -08:00
Kian Jones
077d0e2f9a feat: dump stack trace on segfault (#6121)
* dump stack trace on segfault

* log tokenizer
2025-11-13 15:36:56 -08:00
Sarah Wooders
5730f69ecf feat: modal tool execution - NO FEATURE FLAGS USES MODAL [LET-4357] (#5120)
* initial commit

* add delay to deploy

* fix tests

* add tests

* passing tests

* cleanup

* and use modal

* working on modal

* gate on tool metadata

* agent state

* cleanup

---------

Co-authored-by: Letta Bot <noreply@letta.com>
2025-11-13 15:36:56 -08:00
Sarah Wooders
982501f6fa feat: create model table to persist available models (#5835)
---------

Co-authored-by: Ari Webb <arijwebb@gmail.com>
Co-authored-by: Ari Webb <ari@letta.com>
2025-11-13 15:36:56 -08:00
Ari Webb
f36845b485 feat: add create memory for archive [LET-6148] (#6110)
* first hack

* add to stainless

* renaming field

---------

Co-authored-by: Ari Webb <ari@letta.com>
2025-11-13 15:36:56 -08:00
Shubham Naik
eb0e03d7bb chore: move v1health to async [LET-6125] (#6086)
* chore: move v1health to async

* chore: make async

---------

Co-authored-by: Shubham Naik <shub@memgpt.ai>
2025-11-13 15:36:56 -08:00
Kian Jones
814856711e fix: prevent too many runs bug (#6076)
* add limit of 1000 and change FE

* add safety

* const name

* update limit

* add max limit

---------

Co-authored-by: christinatong01 <christina@letta.com>
2025-11-13 15:36:56 -08:00
Charles Packer
2e721ddc62 fix: various hardening to prevent stale state on background mode runs (#6072)
fix: various hardening to prevent stale state on backgroun
d mode runs
2025-11-13 15:36:56 -08:00
jnjpng
edbff34d63 feat: enable streaming flag on send message [LET-6100] (#6040)
* base

* base

* update

* stainless

* final

---------

Co-authored-by: Letta Bot <noreply@letta.com>
2025-11-13 15:36:55 -08:00
Kian Jones
789f6cf9cd feat: log incoming requests too (#6050)
log incoming requests too
2025-11-13 15:36:55 -08:00
Charles Packer
363a5c1f92 fix: fix poison state from bad approval response (#5979)
* fix: detect and fail on malformed approval responses

* fix: guard against None approvals in utils.py

* fix: add extra warning

* fix: stop silent drops in deserialize_approvals

* fix: patch v3 stream error handling to prevent sending end_turn after an error occurs, and ensures stop_reason is always set when an error occurs

* fix: Prevents infinite client hangs by ensuring a terminal event is ALWAYS sent

* fix:  Ensures terminal events are sent even if inner stream generator fails to
  send them
2025-11-13 15:36:55 -08:00
Kian Jones
4acda9c80f feat: global exception middleware (#6017)
* global exception middleware

* redo both logging middlewares as one

* remove extra middleware files
2025-11-13 15:36:55 -08:00
jnjpng
501c325b32 feat: return new Model and EmbeddingModel objects for list model/embedding endpoints [LET-6090] (#6019)
* base

* generate

* test

* test

* update

* generate

* cypress

---------

Co-authored-by: Letta Bot <noreply@letta.com>
2025-11-13 15:36:55 -08:00
Matthew Zhou
8df78e9429 feat: Move file upload to temporal [LET-6089] (#6024)
* Finish writing temporal upload file activity

* Remove prints

* Rewrite content re-use
2025-11-13 15:36:55 -08:00
Christina Tong
c76bc9e216 feat: add filters to count_agents endpoint [LET-5380] [LET-5497] (#6008)
* feat: add filters to count_agents endpoint [LET-5380]

* comment

* update
2025-11-13 15:36:55 -08:00
Charles Packer
4b371dd6fb fix(core): patch bug w/ sleeptime agents and client-side tool executions [LET-6081] (#6001)
* fix(core): patch bug w/ sleeptime agents and client-side tool executions

* fix: add groupid to approvalcreate

* chore: just stage-api && just publish-api
2025-11-13 15:36:55 -08:00
Kian Jones
ea3248593c feat(logs): Enrich logs with context-aware primtive types (#5949)
* enrich logs with context-aware primtive types

* Delete apps/core/docs/LOG_CONTEXT.md
2025-11-13 15:36:55 -08:00
Christina Tong
881831501a feat: filter list agents by stop reason [LET-5928] (#5779)
* feat: add last_stop_reason to AgentState [LET-5911]

* feat: filter list agents by stop reason [LET-5928]

* undo agent loop changes, use update_run_by_id_async

* add run manager test

* add integration tests

* remove comment

* fix duplicate

* fix docs
2025-11-13 15:36:55 -08:00
Matthew Zhou
dbad510a6e fix: Bound async queue during streaming (#5976)
Add maxsize = 1
2025-11-13 15:36:55 -08:00
Ari Webb
ed99d7eb2b feat: add input option to send message route [LET-4540] (#5938)
---------

Co-authored-by: Ari Webb <ari@letta.com>
2025-11-13 15:36:50 -08:00
Kian Jones
6c377cdc81 chore(logs): Add resource usage logging to streaming, file uploads, mcp client, and model caches (#5925)
* adding log messages to track memory consumption

* add logging to sources, folders, agentfiles, and mcp clients

* memory logging for tool creation paths
2025-11-13 15:36:50 -08:00
Charles Packer
468b47bef5 fix(core): patch sse streaming errors (#5906)
* fix: patch sse streaming errors

* fix: don't re-raise, but log explicitly with sentry

* chore: cleanup comments

* fix: revert change from #5907, also make sure to write out a [DONE] to close the stream
2025-11-13 15:36:39 -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
Ari Webb
da11d80bf4 fix: add default model gpt4.1 (#5897)
add default model gpt4.1

Co-authored-by: Ari Webb <ari@letta.com>
2025-11-13 15:36:39 -08:00
Kian Jones
193c4f7c4a chore: continued logging cleanup and bugfixes (#5882)
* gracefully handle mcp error, runs/temporal error, and otel exporter bug fixes

* move error handling to managers

* remove migrated error handling from routers

* move logger.error calls to logger.warnings
2025-11-13 15:36:20 -08:00
Shubham Naik
95816b9b28 Shub/let 5962 add perfomranceduration search to runs [LET-5962] (#5850)
* feat: add perfomrance/search to list internal runs

* chore: add tests

* chore: fix ui

* feat: support UI for this

* chore: update tests

* chore: update types

---------

Co-authored-by: Shubham Naik <shub@memgpt.ai>
2025-11-13 15:36:14 -08:00
Sarah Wooders
d109bab587 feat: handle overloaded errors [LET-5969] (#5856)
feat: handle overloaded errors
2025-11-13 15:36:14 -08:00
jnjpng
a85abe71b7 feat: add streaming response type to messages stream for stainless [LET-5949] (#5807)
* base

* generate

* fix

* update

* done

* yaml

---------

Co-authored-by: Letta Bot <noreply@letta.com>
2025-11-13 15:36:02 -08:00
Sarah Wooders
655c9489d8 fix: re-raise the error and send [DONE] for known LLM errors in stream (#5805) 2025-11-13 15:36:02 -08:00
Ari Webb
5947e209c7 feat: generate json schema in generate-tool [LET-5901] (#5769)
* generate json schema

* delete commented try catch

---------

Co-authored-by: Ari Webb <ari@letta.com>
2025-11-13 15:35:34 -08:00
Sarah Wooders
e7fff12da0 feat: patch model listing to actually match handle [LET-5888] (#5754) 2025-11-13 15:35:34 -08:00
Christina Tong
042a32d371 feat: add project_id to internal runs endpoint [LET-5915] (#5761)
feat: add explicit project_id to internal runs endpoint [LET-5915]
2025-11-13 15:35:34 -08:00
cthomas
cd2fb0cd02 feat: add new internal capture endpoint (#5750) 2025-11-13 15:35:34 -08:00
Ari Webb
787740e3cb feat: deprecate shared_block_ids, and add groups, blocks [LET-4430] (#5746)
* deprecate field

* add detach/attach, verify user can do them

* just stage publish api

---------

Co-authored-by: Ari Webb <ari@letta.com>
2025-11-13 15:35:34 -08:00
Sarah Wooders
85ed29274c feat: clean up block return object [LET-5784] (#5641)
* fix: fix deep research agent

* chore: update blocks response

* add message

* update agents

* update

* use blockresponse

* undo merge conflict

* add internal agents and blocks

* remove unnecessary internal agent route

* fix utils server test

---------

Co-authored-by: christinatong01 <christina@letta.com>
2025-11-13 15:35:32 -08:00
Kian Jones
b05dd30bfc fix: resource cleanup on background tasks (#5738)
copy over Jake's PR from OSS
2025-10-24 15:14:39 -07:00
jnjpng
949320ab25 chore: add order_by param to list archives [LET-5839] (#5734)
* base

* generatE

---------

Co-authored-by: Letta Bot <noreply@letta.com>
2025-10-24 15:14:31 -07:00
Ari Webb
d558084703 feat: make some routes return none for sdk v1 [LET-5831] (#5724)
just the easy ones

Co-authored-by: Ari Webb <ari@letta.com>
2025-10-24 15:14:31 -07:00
cthomas
6b37ef2cb7 fix: special otid handling for approval request (#5726) 2025-10-24 15:14:31 -07:00
Kian Jones
704d3b2d79 chore: refactor not to use warnings.warn (#5730)
* refactor not to use warnings.warn

* temp circular import fix maybe unecessary/bnad

* fix Deprecation warning

* fix deprecation warning and mcp thing?

* revert changes to mcp server test

* fix deprecation warning
2025-10-24 15:14:31 -07:00
jnjpng
6e2c002af3 feat: add stainless pagination for top level arrays with order by [LET-5800] (#5687)
* base

* revert openapi

* union

* simplify

* stainless

* stainless

* fix

* fix test

* generate

---------

Co-authored-by: Letta Bot <noreply@letta.com>
2025-10-24 15:14:31 -07:00
Matthew Zhou
e7e86124f9 feat: Support embedding config on the archive [LET-5832] (#5714)
* Add embedding config field to archives

* Fix alembic script

* Simplify archive manager

* Fern autogen

* Fix failing tests

* Fix alembic
2025-10-24 15:14:21 -07:00