Commit Graph

82 Commits

Author SHA1 Message Date
Kian Jones
f5c4ab50f4 chore: add ty + pre-commit hook and repeal even more ruff rules (#9504)
* auto fixes

* auto fix pt2 and transitive deps and undefined var checking locals()

* manual fixes (ignored or letta-code fixed)

* fix circular import

* remove all ignores, add FastAPI rules and Ruff rules

* add ty and precommit

* ruff stuff

* ty check fixes

* ty check fixes pt 2

* error on invalid
2026-02-24 10:55:11 -08:00
Kian Jones
25d54dd896 chore: enable F821, F401, W293 (#9503)
* auto fixes

* auto fix pt2 and transitive deps and undefined var checking locals()

* manual fixes (ignored or letta-code fixed)

* fix circular import
2026-02-24 10:55:08 -08:00
Sarah Wooders
21e880907f feat(core): structure memory directory and block labels [LET-7336] (#9309) 2026-02-24 10:52:06 -08:00
cthomas
cc975b5d15 fix: reuse db session when loading pending approval (#8363) 2026-01-12 10:57:48 -08:00
cthomas
9b359418d0 feat: add pending approval field on agent state (#8361)
* feat: add pending approval field on agent state

* test failures
2026-01-12 10:57:48 -08:00
cthomas
f87c607115 fix: add encrypted placeholder constant (#8354) 2026-01-12 10:57:48 -08:00
cthomas
a54513c343 feat: move decryption outside db session (#8323)
* feat: move decryption outside db session

* fix pydantic error
2026-01-12 10:57:48 -08:00
Sarah Wooders
87d920782f feat: add conversation and conversation_messages tables for concurrent messaging (#8182) 2026-01-12 10:57:48 -08:00
cthomas
3aaab90b4c feat: use bounded concurrency for decryption (#8296) 2026-01-12 10:57:48 -08:00
cthomas
b6535b7590 fix: agent-runs relationship load causing timeouts [LET-6694] (#8129)
fix: agent-runs relationship load causing timeouts
2026-01-12 10:57:47 -08:00
Sarah Wooders
acd8dd7bcf feat: make embedding_config optional on agent creation (#7553)
* feat: make embedding_config optional on agent creation

- Remove requirement for embedding_config in agent creation
- Add EmbeddingConfigRequiredError for operations that need embeddings
- Add null checks in sleeptime agent creation, passage insert, archive creation
- Register new error in app.py exception handlers

🐾 Generated with [Letta Code](https://letta.com)

Co-Authored-By: Letta <noreply@letta.com>

* chore: update API schemas for optional embedding_config

🐾 Generated with [Letta Code](https://letta.com)

Co-Authored-By: Letta <noreply@letta.com>

---------

Co-authored-by: Letta <noreply@letta.com>
2026-01-12 10:57:19 -08:00
jnjpng
25d75d6528 fix: update aysnc get plaintext callsites (#7069)
* base

* resolve

* fix

* fix
2025-12-17 17:31:02 -08:00
Kian Jones
bce1749408 fix: run PBKDF2 in thread pool to prevent event loop freeze (#6763)
* fix: run PBKDF2 in thread pool to prevent event loop freeze

Problem: Event loop freezes for 100-500ms during secret decryption, blocking
all HTTP requests and async operations. The diagnostic monitor detected the
main thread stuck in PBKDF2 HMAC SHA256 computation at:
  apps/core/letta/helpers/crypto_utils.py:51 (_derive_key)
  apps/core/letta/schemas/secret.py:161 (get_plaintext)

Root cause: PBKDF2 with 100k iterations is intentionally CPU-intensive for
security, but running it synchronously on the main thread blocks the event loop.

Stack trace showed:
  Thread 1 (Main): PBKDF2HMAC -> SHA256_Final -> sha256_block_data_order_avx2
  Event loop watchdog: Detected freeze at 01:11:44 (request started 01:12:03)

Solution:
1. Run PBKDF2 in ThreadPoolExecutor to avoid blocking event loop
2. Add async versions of encrypt/decrypt methods
3. Add LRU cache for derived keys (deterministic results)
4. Add async get_plaintext_async() method to Secret class

Changes:
- apps/core/letta/helpers/crypto_utils.py:
  - Added ThreadPoolExecutor for crypto operations
  - Added @lru_cache(maxsize=256) to _derive_key_cached()
  - Added _derive_key_async() using loop.run_in_executor()
  - Added encrypt_async() and decrypt_async() methods
  - Added warnings to sync methods about blocking behavior

- apps/core/letta/schemas/secret.py:
  - Added get_plaintext_async() method
  - Added warnings to get_plaintext() about blocking behavior

Benefits:
- Event loop no longer freezes during secret decryption
- HTTP requests continue processing while crypto runs in background
- Derived keys are cached, reducing CPU usage for repeated operations
- Backward compatible - sync methods still work for non-async code

Performance impact:
- Before: 100-500ms event loop block per decryption
- After: 100-500ms in thread pool (non-blocking) + LRU cache hits ~0.1ms

Next steps (follow-up PRs):
- Migrate all async callsites to use get_plaintext_async()
- Add metrics to track sync vs async usage
- Consider reducing PBKDF2 iterations if security allows

* update

* test

---------

Co-authored-by: Letta Bot <jinjpeng@gmail.com>
2025-12-15 12:03:09 -08:00
Sarah Wooders
7ea297231a feat: add compaction_settings to agents (#6625)
* initial commit

* Add database migration for compaction_settings field

This migration adds the compaction_settings column to the agents table
to support customized summarization configuration for each agent.

🐾 Generated with [Letta Code](https://letta.com)

Co-Authored-By: Letta <noreply@letta.com>

* fix

* rename

* update apis

* fix tests

* update web test

---------

Co-authored-by: Letta <noreply@letta.com>
Co-authored-by: Kian Jones <kian@letta.com>
2025-12-15 12:02:34 -08:00
cthomas
6a47bf4946 feat: add fk reference for agent groups [LET-6260] (#6313)
feat: add fk reference for agent groups
2025-11-24 19:10:27 -08:00
Kian Jones
78600fac23 chore: index suggestions from planetscale suggestions (#6111)
suggestions from ps dashboard
2025-11-13 15:36:56 -08:00
Sarah Wooders
6eeb3c90bb feat: bring back model_settings and remove validation again (#6104) 2025-11-13 15:36:56 -08:00
Sarah Wooders
ddc87418f4 feat: revert model_settings (#6089) 2025-11-13 15:36:56 -08:00
Sarah Wooders
0b1fe096ec feat: split up handle and model_settings (#6022) 2025-11-13 15:36:56 -08:00
jnjpng
849d0dc64a feat: provider-specific model configuration (#5873) (#5874) 2025-11-13 15:36:55 -08:00
Christina Tong
ef3df907c5 feat: add last_stop_reason to AgentState [LET-5911] (#5772)
* feat: add last_stop_reason to AgentState [LET-5911]

* undo agent loop changes, use update_run_by_id_async

* add run manager test

* add integration tests

* remove comment

* remove duplicate test
2025-11-13 15:36:55 -08:00
Sarah Wooders
cfeed463a9 Revert "feat: provider-specific model configuration " (#5873)
Revert "feat: provider-specific model configuration  (#5774)"

This reverts commit 34a334949a3ef72cd49ff0ca3da9e85d16daa57c.
2025-11-13 15:36:20 -08:00
Sarah Wooders
aaa12a393c feat: provider-specific model configuration (#5774)
* initial code updates

* add models

* cleanup

* support overriding

* add apis

* cleanup reasoning interfaces to match models

* update schemas

* update apis

* add new field

* remove parallel

* various fixes

* modify schemas

* fix

* fix

* make model optional

* undo model schema change

* update schemas

* update schemas

* format

* fix tests

* attempt to patch web

* fic docs

* change schemas

* update error

* fix tests

* delete tests

* clean up undefined matching conditional

---------

Co-authored-by: jnjpng <jin@letta.com>
Co-authored-by: Letta Bot <noreply@letta.com>
2025-11-13 15:36:14 -08:00
cthomas
5e43291436 feat: remove relationship fields on identities (#5691) 2025-10-24 15:14:09 -07:00
cthomas
afdf0f80e3 feat: add backend support for agent relationship loads (#5693) 2025-10-24 15:14:09 -07:00
cthomas
681f842adb fix: identity greenlet bug (#5678) 2025-10-24 15:13:47 -07:00
cthomas
c3c38f2713 feat: rename multi agent group to managed group [LET-5799] (#5672)
feat: rename multi agent group to managed group
2025-10-24 15:13:47 -07:00
cthomas
14faa27869 feat: replace agent.identity_ids with agent.identities [LET-5803] (#5673)
feat: replace agent.identity_ids with agent.identities
2025-10-24 15:13:47 -07:00
cthomas
beaeddf54d feat: add new blocks field to agent model and deprecate memory field [LET-4424] (#5613)
feat: add new blocks field to agent model and deprecate memory field
2025-10-24 15:13:15 -07:00
Sarah Wooders
65b33ae27f feat: add index for run_id on messages and project_id on agents (#5117) 2025-10-07 17:50:49 -07:00
Sarah Wooders
354205f581 feat: create new runs table [LET-4467] (#4841) 2025-10-07 17:50:47 -07:00
Charles Packer
d748d86059 feat: add more indexes (#4849) 2025-10-07 17:50:45 -07:00
Sarah Wooders
c85bfefa52 feat: add agents_runs table (#4768) 2025-10-07 17:50:44 -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
Matthew Zhou
29502ac3aa feat: Add association for the vector namespace [LET-4148] (#4354)
Add association for the namespace
2025-09-02 13:21:42 -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
Sarah Wooders
250d8b8006 feat: add cloud template fields to blocks/groups/agents [LET-3979]
* commit

* fix tests

* add routes

* remove old fields

* remove entity from group

* generate, migrate

* update

* keep from_template, etc.

* keep block fields

* final

* generate

* pass tests

* generate

* keep defaults

---------

Co-authored-by: jin <jin@letta.com>
2025-08-26 23:17:06 -07:00
Matthew Zhou
10f6f1d247 feat: Implement archival sharing (#3689) 2025-08-01 23:34:49 -07:00
Shubham Naik
ccd36dd755 feat: add not_indexable property to agents (#3653)
Co-authored-by: Shubham Naik <shub@memgpt.ai>
2025-07-30 17:09:36 -07:00
Andy Li
1959109821 feat: support for project_id and backfills 2025-07-25 13:06:12 -07:00
Matthew Zhou
e62ddf8355 feat: Add per-agent file management controls with context-aware defaults (#3467) 2025-07-22 10:43:37 -07:00
cthomas
9c1ec9782c feat: remove groups selectin from agents model (#3429) 2025-07-19 23:45:59 -07:00
cthomas
7a37557bb9 feat: remove organization from agents pydantic schema (#3426) 2025-07-19 22:47:32 -07:00
cthomas
1c3275b3c9 feat: remove batch items selectin from agents model (#3422) 2025-07-19 21:59:40 -07:00
cthomas
eb6f11fc6f fix: sync files loading on event loop (#3327) 2025-07-15 00:44:22 -07:00
Kevin Lin
f2f25d3bac feat: replace file descriptions with per data source description (#3067)
Co-authored-by: Matt Zhou <mattzh1314@gmail.com>
2025-07-01 11:51:52 -07:00
Sarah Wooders
912766141b chore: add back timezone tests (#3011)
Co-authored-by: Andy Li <55300002+cliandy@users.noreply.github.com>
2025-06-25 15:12:21 -07:00
Sarah Wooders
366de63d4d fix: add more timezone fixes (#3025) 2025-06-25 14:51:37 -07:00
Sarah Wooders
2feaac398f fix: fix timezone setting and add client tests (#2997) 2025-06-24 17:49:54 -07:00