Commit Graph

71 Commits

Author SHA1 Message Date
jnjpng
e56c5c5b49 fix: global sandbox environment variables not injected on tool execution (#8310)
* base

* test
2026-01-12 10:57:48 -08:00
Cameron
7c44375cce feat: add message_types filter to list messages endpoint (#8280)
* feat: add message_types filter to list messages endpoint

Add the ability to filter messages by type when listing message history
via GET /v1/agents/{agent_id}/messages. This brings parity with the
create message endpoint which already supports include_return_message_types.

Changes:
- Add message_types query parameter to list_messages endpoint in agents.py
- Add message_types parameter to get_agent_recall_async in server.py
- Filter messages by message_type after LettaMessage conversion
- Add test for message_types filtering

Closes #8277

Written by Cameron ◯ Letta Code

> "Simplicity is the ultimate sophistication." - Leonardo da Vinci

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

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

* chore: regenerate OpenAPI spec and SDK for message_types filter

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

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

Written by Cameron ◯ Letta Code

"The only way to do great work is to love what you do." - Steve Jobs

---------

Co-authored-by: Letta <noreply@letta.com>
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
Ari Webb
cc825b4f5c Revert "Revert "feat: enable provider models persistence" (#6590)" (#6595) 2026-01-12 10:57:48 -08:00
Sarah Wooders
d5decc2a27 fix: persist streaming errors in run metadata (#8062) 2026-01-12 10:57:47 -08:00
Cameron
3e15159d83 fix: prevent human block overwrite when skills block missing (#7656)
* fix: prevent human block overwrite when skills block missing

**Bug**: When connecting to agents created before skills blocks were
standard, the human block gets overwritten with skills directory content.

**Root cause**: agent_manager.py:1893-1898 had `block = block` (no-op).
When skills block doesn't exist, loop variable ends as last block in
core_memory (often "human"), then updates that wrong block.

**Fix**: Use `matched_block` variable to properly track found block.
Now correctly raises NoResultFound when block label doesn't exist.

**Impact**: Affects pre-December 2025 agents missing skills blocks.

Written by Cameron ◯ Letta Code

"The best error message is the one that never shows up." - Thomas Fuchs

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

* fix: use correct method name in block update test

Change get_block_by_label_async to get_block_with_label_async in test.

Written by Cameron ◯ Letta Code

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

---------

Co-authored-by: Letta <noreply@letta.com>
2026-01-12 10:57:19 -08:00
cthomas
9a95a8f976 fix: duplicate session commit in step logging (#7512)
* fix: duplicate session commit in step logging

* update all callsites
2026-01-12 10:57:19 -08:00
jnjpng
00ba2d09f3 refactor: migrate mcp_servers and mcp_oauth to encrypted-only columns (#6751)
* refactor: migrate mcp_servers and mcp_oauth to encrypted-only columns

Complete migration to encrypted-only storage for sensitive fields:

- Remove dual-write to plaintext columns (token, custom_headers,
  authorization_code, access_token, refresh_token, client_secret)
- Read only from _enc columns, not from plaintext fallback
- Remove helper methods (get_token_secret, set_token_secret, etc.)
- Remove Secret.from_db() and Secret.to_dict() methods
- Update tests to verify encrypted-only behavior

After this change, plaintext columns can be set to NULL manually
since they are no longer read from or written to.

* fix test

* rename

* update

* union

* fix test
2025-12-17 17:31:02 -08:00
Sarah Wooders
bd9f3aca9b fix: fix prompt_acknowledgement usage and update summarization prompts (#7012) 2025-12-15 12:03:09 -08:00
Sarah Wooders
0c0ba5d03d fix: remove letta-free embeddings from testing (#6870) 2025-12-15 12:03:09 -08:00
Sarah Wooders
a731e01e88 fix: use model instead of model_settings (#6834) 2025-12-15 12:03:09 -08:00
jnjpng
4be813b956 fix: migrate sandbox and agent environment variables to encrypted only (#6623)
* base

* remove unnnecessary db migration

* update

* fix

* update

* update

* comments

* fix

* revert

* anotha

---------

Co-authored-by: Letta Bot <noreply@letta.com>
2025-12-15 12:03:08 -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
jnjpng
b658c70063 test: add coverage for provider encryption without LETTA_ENCRYPTION_KEY (#6629)
Add tests to verify that providers work correctly when no encryption key
is configured. The Secret class stores values as plaintext in _enc columns
and retrieves them successfully, but this code path had no test coverage.

Co-authored-by: Letta Bot <noreply@letta.com>
2025-12-15 12:02:34 -08:00
Kian Jones
fbd89c9360 fix: replace all 'PRODUCTION' references with 'prod' for consistency (#6627)
* fix: replace all 'PRODUCTION' references with 'prod' for consistency

Problem: Codebase had 11 references to 'PRODUCTION' (uppercase) that should
use 'prod' (lowercase) for consistency with the deployment workflows and
environment normalization.

Changes across 8 files:

1. Source files (using settings.environment):
   - letta/functions/function_sets/multi_agent.py
   - letta/services/tool_manager.py
   - letta/services/tool_executor/multi_agent_tool_executor.py
   - letta/services/helpers/agent_manager_helper.py
   All checks changed from: settings.environment == "PRODUCTION"
   To: settings.environment == "prod"

2. OTEL resource configuration:
   - letta/otel/resource.py
     - Updated _normalize_environment_tag() to handle 'prod' directly
     - Removed 'PRODUCTION' -> 'prod' mapping (no longer needed)
     - Updated device.id check from _env != "PRODUCTION" to _env != "prod"

3. Test files:
   - tests/managers/conftest.py
     - Fixture parameter changed from "PRODUCTION" to "prod"
   - tests/managers/test_agent_manager.py (3 occurrences)
   - tests/managers/test_tool_manager.py (2 occurrences)
   All test checks changed to use "prod"

Result: Complete consistency across the codebase:
- All environment checks use "prod" instead of "PRODUCTION"
- Normalization function simplified (no special case for PRODUCTION)
- Tests use correct "prod" value
- Matches deployment workflow configuration from PR #6626

This completes the environment naming standardization effort.

* fix: update settings.py environment description to use 'prod' instead of 'PRODUCTION'

The field description still referenced PRODUCTION as an example value.
Updated to use lowercase 'prod' for consistency with actual usage.

Before: "Application environment (PRODUCTION, DEV, CANARY, etc. - normalized to lowercase for OTEL tags)"
After: "Application environment (prod, dev, canary, etc. - lowercase values used for OTEL tags)"
2025-12-15 12:02:34 -08:00
jnjpng
3221ed8a14 fix: update base provider to only handle _enc fields (#6591)
* base

* update

* another pass

* fix

* generate

* fix test

* don't set on create

* last fixes

---------

Co-authored-by: Letta Bot <noreply@letta.com>
2025-12-15 12:02:34 -08:00
Sarah Wooders
8440e319e2 Revert "feat: enable provider models persistence" (#6590)
Revert "feat: enable provider models persistence (#6193)"

This reverts commit 9682aff32640a6ee8cf71a6f18c9fa7cda25c40e.
2025-12-15 12:02:34 -08:00
Sarah Wooders
fca5774795 feat: store run errors on streaming (#6573) 2025-12-15 12:02:34 -08:00
Ari Webb
848a73125c feat: enable provider models persistence (#6193)
* Revert "fix test"

This reverts commit 5126815f23cefb4edad3e3bf9e7083209dcc7bf1.

* fix server and better test

* test fix, get api key for base and byok?

* set letta default endpoint

* try to fix timeout for test

* fix for letta api key

* Delete apps/core/tests/sdk_v1/conftest.py

* Update utils.py

* clean up a few issues

* fix filterning on list_llm_models

* soft delete models with provider

* add one more test

* fix ci

* add timeout

* band aid for letta embedding provider

* info instead of error logs when creating models
2025-12-15 12:02:34 -08:00
Ari Webb
4092820f3a feat: add project id scoping for tools backend changes (#6529) 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
Ari Webb
eb547bb96e fix: clear message history no longer deletes messages (#6515)
* fix: clear message history no longer deletes messages

* toast and make it stay for 8 secs

* fix test

---------

Co-authored-by: Ari Webb <ari@letta.com>
2025-12-15 12:02:33 -08:00
Sarah Wooders
f417e53638 fix: fix cancellation issues without making too many changes to message_ids persistence (#6442) 2025-12-15 12:02:19 -08:00
Ari Webb
89c7ab5f14 feat: structured outputs for openai [LET-6233] (#6363)
* first hack with test

* remove changes integration test

* Delete apps/core/tests/sdk_v1/integration/integration_test_send_message_v2.py

* add test

* remove comment

* stage and publish api

* deprecate base level response_schema

* add param to llm_config test

---------

Co-authored-by: Ari Webb <ari@letta.com>
2025-11-26 14:39:39 -08:00
Ari Webb
ce2ca8660b feat: add effort dropdown for claude 4.5 opus (backend) (#6351)
* feat: add effort support (backend)

* fix test_agent_state_schema_unchanged

---------

Co-authored-by: Ari Webb <ari@letta.com>
2025-11-24 19:10:27 -08:00
Ari Webb
699820cecd fix: managers test (#6232)
fix managers test

Co-authored-by: Ari Webb <ari@letta.com>
2025-11-24 19:09:33 -08:00
Ari Webb
b0f9986209 feat: make letta_v1_agent default [LET-6153] (#6115)
* agent change

* fix tests

* fix more tests

* memgpt_v2_agent for cloud-api tests

---------

Co-authored-by: Ari Webb <ari@letta.com>
2025-11-24 19:09:33 -08:00
Shelley Pham
b73545cd60 fix: agents created from templates cannot read attached files [LET-6146] (#6137)
* fix: Ensure agents created from templates can read attached files

* test: Add test for template-based agent file attachment from sources
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
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
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
jnjpng
849d0dc64a feat: provider-specific model configuration (#5873) (#5874) 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
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
Kian Jones
60115d4931 fix: lettuce import and add unit tests for new run manager function (#5893)
* fix lettuce import and add unit tests for new run manager function

* fix unit tests

* bump version (unrelated)
2025-11-13 15:36:38 -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
Sarah Wooders
6654473514 fix: handle block race conditions (#5819) 2025-11-13 15:36:14 -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
24a14490d8 fix: add more error logging and tests for streaming LLM errors (#5844) 2025-11-13 15:36:14 -08:00
Kian Jones
60226ad203 fix: missing cursor kwargs (#5763)
* accept cursor logic

* add test
2025-11-13 15:35:34 -08:00
Kian Jones
1059452c11 fix: expect raise on detach to deleted agent (#5770)
just expect raise
2025-11-13 15:35:34 -08:00
Christina Tong
5fddf94ac3 fix: pagination broken in runs table [LET-5790] (#5759)
* fix: pagination broken in runs table [LET-5790]

* update pagination test

* fix test
2025-11-13 15:35:34 -08: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
Matthew Zhou
69343bf5f2 feat: Add delete endpoint [LET-4400] (#5711)
* Add delete endpoint

* Fern autogen
2025-10-24 15:14:20 -07:00
Ari Webb
6b5c3a7130 feat: list_agents_for_archive endpoint [LET-4407] (#5684)
* list_archives_for_agent

* use pattern from blocks instead

* use new parameter include

---------

Co-authored-by: Ari Webb <ari@letta.com>
2025-10-24 15:14:20 -07:00