Commit Graph

92 Commits

Author SHA1 Message Date
cthomas
1be2f61f05 feat: add new letta error message stream response type (#6192) 2025-11-24 19:10:11 -08:00
Kian Jones
abb13ef352 fix: Remove nltk blocking download and make azure model listing non-blocking (#6214)
* Fix event loop blocking in NLTK downloads and Azure model listing

Found via watchdog detecting 61.6s hang during file upload.

**Root causes:**
1. NLTK punkt_tab downloads blocking during file processing
2. Azure model listing using sync requests.get() in async context

**Fixes:**
1. Pre-download NLTK data at Docker build time
2. Async fallback download at startup if build failed
3. Move Azure model fetch to thread pool with asyncio.to_thread()

**Impact:**
- Eliminates 60+ second event loop hangs
- Startup: instant if data baked in, ~60s async if needs download
- Requests: never block, all I/O offloaded to threads

* Fix Docker build: ensure /root/nltk_data exists even if download fails

- Create directory before download attempt
- Add verification step to confirm download success
- Directory always exists so COPY won't fail in runtime stage

* Fix: use venv python for NLTK download in Docker build

The builder stage installs NLTK in /app/.venv but we were using
system python which doesn't have NLTK. Now using venv python so
download actually works.

* Use uv run for NLTK download (more idiomatic)

uv run automatically uses the synced venv, cleaner than hardcoding
the venv path.
2025-11-24 19:09:33 -08:00
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
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
077d0e2f9a feat: dump stack trace on segfault (#6121)
* dump stack trace on segfault

* log tokenizer
2025-11-13 15:36:56 -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
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
Sarah Wooders
d109bab587 feat: handle overloaded errors [LET-5969] (#5856)
feat: handle overloaded errors
2025-11-13 15:36:14 -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
Sarah Wooders
e7fff12da0 feat: patch model listing to actually match handle [LET-5888] (#5754) 2025-11-13 15:35:34 -08:00
Kian Jones
1577a261d8 feat: add profiling and structured logging (#5690)
* test dd build

* dd agent in cluster

* quick poc

* refactor and add logging

* remove tracing etc.

* add changes to otel logging config

* refactor to accept my feedback

* finishing touches
2025-10-24 15:14:20 -07:00
Kian Jones
4bbd760204 feat: add validation to fastapi routes for agent IDs (#5454)
* change my PR to match Caren's

* add path parameter validation for agent id first

* remove old import

* remove old agent_id_pattern pattern

* add example and fix max/min calculation to include hyphen

* fix regex string interpolation

* example deprecated in favour of examples

* openapi autogen

* change template test to expect 422

* fix 422 swallow

* expect 422 or 400

* rewrite  error codes

* fix hallucinated uuid

* tweaked error message test

* print docker logs on failure
2025-10-24 15:12:11 -07:00
Matthew Zhou
2dae4d33c3 feat: Implement streaming chat completions endpoint [LET-5485] (#5446)
* wip

* Add chat completions router and fix streaming service

* Finish chat completions

* Finish chat completions

* Remove extra print statement

* Run just api

* Don't explicitly throw http exceptions but surface Letta errors

* Remap errors

* Trigger CI

* Add missing Optional import
2025-10-24 15:12:11 -07:00
Ari Webb
967cc3decf move exceptions out of folders and sources [LET-4631] (#5444) 2025-10-24 15:12:11 -07:00
Ari Webb
4431b06881 runs and jobs [LET-4634] (#5427)
runs and jobs

Co-authored-by: Ari Webb <ari@letta.com>
2025-10-24 15:12:11 -07:00
Ari Webb
9e94c344b8 using uuid and datetime [LET-5508] (#5430)
* using uuid and datetime

* add run_id

---------

Co-authored-by: Ari Webb <ari@letta.com>
2025-10-24 15:12:11 -07:00
Charles Packer
681f4903fd fix: patch regression from #5359 (#5363) 2025-10-24 15:11:31 -07:00
Sarah Wooders
3d887c7a13 chore: remove sentry for non-500 errors (#5359)
* chore: remove sentry for non-500 errors

* remove more filtering logic

---------

Co-authored-by: Kian Jones <kian@letta.com>
2025-10-24 15:11:31 -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
Sarah Wooders
324933edd3 feat: exception handling middleware for sandbox_configs + identities + tools (#5143) 2025-10-07 17:50:50 -07:00
cthomas
eb2a6f6890 feat: add value error to middlware for 400 (#5173)
* feat: prevent summarization mid approval request

* feat: add value error to middlware for 400
2025-10-07 17:50:49 -07:00
Sarah Wooders
7aff9aa659 feat: error handling for rest api for agents + blocks [LET-4625] (#5142) 2025-10-07 17:50:49 -07:00
Sarah Wooders
d0d36a4b07 fix: remove json schema generation from tool validation [LET-4509] (#4964)
* patch integration test

* create default user and org

* rm

* patch

* add testing

* remove validation for schemas from pydantic object

* add file

* patch tests

* fix more tests

* fix managers

* fix sdk test

* patch schema tests

* Comment out name in update

* patch test

* patch

* add another test
2025-10-07 17:50:46 -07:00
Kian Jones
4bdf85b883 feat: pull letta env for sentry init (#4966)
set env on sentry init
2025-10-07 17:50:46 -07:00
Sarah Wooders
8fee5b4b93 fix: remove db locks (#4879) 2025-10-07 17:50:45 -07:00
Sarah Wooders
4df0a27eb0 chore: remove sync db (#4873) 2025-10-07 17:50:45 -07:00
Kian Jones
b8e9a80d93 merge this (#4759)
* wait I forgot to comit locally

* cp the entire core directory and then rm the .git subdir
2025-09-17 15:47:40 -07:00
Kian Jones
22f70ca07c chore: officially migrate to submodule (#4502)
* remove apps/core and apps/fern

* fix precommit

* add submodule updates in workflows

* submodule

* remove core tests

* update core revision

* Add submodules: true to all GitHub workflows

- Ensure all workflows can access git submodules
- Add submodules support to deployment, test, and CI workflows
- Fix YAML syntax issues in workflow files

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>

* remove core-lint

* upgrade core with latest main of oss

---------

Co-authored-by: Claude <noreply@anthropic.com>
2025-09-09 12:45:53 -07:00
cthomas
bfd6030f72 feat: make new message create type field optional [LET-4116] (#4319)
feat: make new message create type field optional
2025-08-29 15:22:34 -07:00
cthomas
bb87cc68c7 feat: add approval create input to messages endpoints [LET-4110] (#4309)
* feat: add approval create input to messages endpoints

* rename discriminator tag

* add base class with default

* add field validator

* exclude new type field from agent file schema
2025-08-29 13:16:03 -07:00
Kian Jones
fecf6decfb 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
cthomas
b65ad237b6 feat: add LettaPing to streaming response (#3647) 2025-07-29 22:34:32 -07:00
Andy Li
f1ea0bb904 fix: catch import error 2025-07-25 14:46:19 -07:00
Andy Li
fe2e525ac9 feat: profiling middleware 2025-07-25 13:12:59 -07:00
Andy Li
58081e3cea feat: support for providers 2025-07-22 16:09:50 -07:00
Andy Li
c08425b4fe chore: default to uvloop 2025-07-18 12:48:36 -07:00
Andy Li
60c4e23904 feat: stop reasons and error messages and sentry fixes 2025-07-18 11:56:20 -07:00
Andy Li
04e9f43220 chore: strings lint cleanup (#3374) 2025-07-18 09:20:45 -07:00
cthomas
fd835492d8 feat: LET-3090 add sqlalchemy debug info to traces (#3401) 2025-07-17 22:17:48 -07:00
Shubham Naik
49641ca7bb chore: fix generation (#3262)
Co-authored-by: Shubham Naik <shub@memgpt.ai>
2025-07-09 20:17:02 -07:00
Andy Li
9a7a8071a6 chore: proper logging for sentry (#3195) 2025-07-07 12:37:39 -07:00
Kian Jones
ad67ed761d filter out noisy sentry (#3191) 2025-07-07 11:38:07 -07:00
Kian Jones
0ff12fdb44 fix(sentry): Add sentry filtering stop gap (#3185) 2025-07-07 09:39:59 -07:00
Matthew Zhou
954675396f feat: Add pinecone for cloud embedding (#3160) 2025-07-03 22:37:55 -07:00
Andy Li
d9ebed06ef fix: batch jobs not being polled (#3034) 2025-06-25 17:07:21 -07:00
Andy Li
19077a47f8 fix: duplicate messages in message context (#2998) 2025-06-24 16:15:45 -07:00
cthomas
1405464a1c feat: send stop reason in letta APIs (#2789) 2025-06-13 16:04:48 -07:00
cthomas
a43be2b377 feat: add stop reason object (#2783) 2025-06-12 16:54:29 -07:00
Andy Li
eaf5682422 feat: plugin system and backend runtime flags (#2543) 2025-06-05 18:12:44 -07:00