Commit Graph

6949 Commits

Author SHA1 Message Date
jnjpng
c48cf021cb fix: set api key encrypted secret for providers in memory (#6571)
base

Co-authored-by: Letta Bot <noreply@letta.com>
2025-12-15 12:02:34 -08:00
jnjpng
2536942be2 fix: combined tool manager improvements - tracing and redundant fetches (#6570)
* fix: combined tool manager improvements - tracing and redundant fetches

This PR combines improvements from #6530 and #6535:

- Add tracer import to enable proper tracing spans
- Improve update check logic to verify actual field changes before updating
- Return current_tool directly when no update is needed (avoids redundant fetch)
- Add structured tracing spans to update_tool_by_id_async for better observability
- Fix decorator order for better error handling (raise_on_invalid_id before trace_method)
- Remove unnecessary tracing spans in create_or_update_tool_async

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

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

* revert: remove tracing spans from update_tool_by_id_async

Remove the tracer span additions from update_tool_by_id_async while keeping
all other improvements (decorator order fix, redundant fetch removal, and
improved update check logic).

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

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

---------

Co-authored-by: Letta Bot <noreply@letta.com>
2025-12-15 12:02:34 -08:00
Devansh Jain
d1536df6f6 chore: Update deepseek client for v3.2 models (#6556)
* support for v3.2 models

* streaming + context window fix

* fix for no assitant text from deepseek
2025-12-15 12:02:34 -08:00
cthomas
a7c0bad857 fix: unbound var in summarization [LET-6484] (#6568)
* fix: unbound var in summarization

* fix indentation
2025-12-15 12:02:34 -08:00
jnjpng
fd14657e84 fix: prevent false positive in Secret.get_plaintext() for plaintext values (#6566)
When a Secret is created from plaintext (was_encrypted=False), the
is_encrypted() heuristic can incorrectly identify long API keys as
encrypted. This causes get_plaintext() to return None when no encryption
key is available, even though the value was explicitly stored as plaintext.

Fix: Check was_encrypted flag before trusting is_encrypted() heuristic.
If was_encrypted=False, trust the cached plaintext value.

This is a port of https://github.com/letta-ai/letta/pull/3078 to letta-cloud.

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

Co-authored-by: Letta Bot <noreply@letta.com>
2025-12-15 12:02:34 -08:00
Cameron
8c616a2093 fix: add context prompt to sleeptime agent user message (#6564)
* fix: add context prompt to sleeptime agent user message

Previously the sleeptime agent received only the raw conversation
transcript with no context, causing identity confusion where the
agent would believe it was the primary agent.

Now includes a pre-prompt that:
- Uses "sleeptime agent" terminology explicitly
- Clarifies the agent is NOT the primary agent
- Explains message labels (assistant = primary agent)
- States the agent has no prior turns in the transcript
- Describes the memory management role

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

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

* chore: remove redundant sleeptime pre-prompt line

* chore: add memory_persona reference to sleeptime pre-prompt

* chore: wrap sleeptime pre-prompt in system-reminder tags

* chore: rename transcript to messages in sleeptime pre-prompt

---------

Co-authored-by: Letta <noreply@letta.com>
2025-12-15 12:02:34 -08:00
Cameron
a56c6571d2 fix: update fetch_webpage docstring to reflect actual implementation (#6503)
The docstring incorrectly stated that fetch_webpage uses Jina AI reader.
Updated to accurately describe the actual implementation which uses:
1. Exa API (if EXA_API_KEY is available)
2. Trafilatura (fallback)
3. Readability + html2text (final fallback)

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

Co-authored-by: Letta <noreply@letta.com>
2025-12-15 12:02:34 -08:00
Kian Jones
86fbd39a16 feat: add dd instrumentation to web (#6531)
* add dd instrumentation to web

* instrument web fully

* omit dd

* add error handling for dd-trace initialization

* use logger instead of console in dd-trace error handling

* exception replay

* fix dd-trace native module bundling and error serialization
2025-12-15 12:02:34 -08:00
Kevin Lin
1ca9df0626 feat: Add memory_apply_patch to base tools (#6491)
add memory apply patch
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
Sarah Wooders
4f1fbe45aa feat: add index and concurrency control for tools (fixed alembic) (#6552) 2025-12-15 12:02:34 -08:00
Sarah Wooders
c8c06168e2 Revert "feat: add index and concurrency control for tools " (#6551)
Revert "feat: add index and concurrency control for tools  (#6547)"

This reverts commit f4abf8e061bc2f5e08853b5ce5775a7f8626463a.
2025-12-15 12:02:34 -08:00
Sarah Wooders
a2d3011d84 feat: add index and concurrency control for tools (#6547) 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
a18caf69f7 fix: undo tool manager changes (#6546) 2025-12-15 12:02:34 -08:00
cthomas
2116a07706 fix: incorrect stop reasons (#6539) 2025-12-15 12:02:34 -08:00
cthomas
77d1c3365e fix: granular cancellation check (#6540) 2025-12-15 12:02:34 -08:00
cthomas
b67347dff2 fix: remove redundant letta message conversion (#6538) 2025-12-15 12:02:33 -08:00
cthomas
4916d281ce fix: dont let message ids diverge in memory vs db (#6537) 2025-12-15 12:02:33 -08:00
Kian Jones
74e0172efe fix: AssistantMessage validation error when content is dict (#6533)
fix AssistantMessage validation error when content is dict

validate_function_response can return either a string or dict, but
AssistantMessage.content expects a string. When a tool returns a dict
like {'tofu': 1, 'mofu': 1, 'bofu': 1}, it needs to be JSON-serialized
before passing to AssistantMessage.

Fixes: pydantic_core._pydantic_core.ValidationError: 2 validation errors for AssistantMessage
2025-12-15 12:02:33 -08:00
jnjpng
0c21d20914 fix: redundant tool fetch on no op update and fix tool manager tracing (#6535)
base

Co-authored-by: Letta Bot <noreply@letta.com>
2025-12-15 12:02:33 -08:00
cthomas
6fd73d4dcf chore: add more summarize tracing (#6532) 2025-12-15 12:02:33 -08:00
Kian Jones
edeac2c679 fix: fix gemini otel bug and add tracing for tool upsert (#6523)
add tracing for tool upsert, and fix gemini otel bug
2025-12-15 12:02:33 -08:00
jnjpng
7058d63bd8 fix: update tool check and add tracing to update tool logic (#6530)
base

Co-authored-by: Letta Bot <noreply@letta.com>
2025-12-15 12:02:33 -08:00
Charles Packer
d3f4d00113 feat(core): add support for gpt-5.1-codex-max (#6528) 2025-12-15 12:02:33 -08:00
cthomas
864415532e fix: list index error for sleeptime due to summarization failure (#6525)
fix: list index error for sleeptime
2025-12-15 12:02:33 -08:00
cthomas
109989ac1a fix: tracing for summarizer errors (#6524) 2025-12-15 12:02:33 -08:00
cthomas
0d18ecc2ec feat: add placeholder for image inputs in Anthropic proxy [LET-6449] (#6522)
- Add [IMAGE] placeholder when extracting user messages with image content blocks
- Allows LLM to know images were present in conversation history
- LLM can infer context from surrounding text and conversation flow

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

Co-authored-by: Letta <noreply@letta.com>
2025-12-15 12:02:33 -08:00
jnjpng
e5bda413c0 fix: agent environment variables not using encrypted values (#6520)
* base

* clean up

---------

Co-authored-by: Letta Bot <noreply@letta.com>
2025-12-15 12:02:33 -08:00
cthomas
08772c3f46 feat: improve Anthropic proxy memory injection and message capture (#6519)
- Add Letta memory capability notice in memory blocks prompt
- Fix duplicate message persistence by only capturing latest user message
- Append memory blocks to end of system prompt instead of prepending
- Skip empty description tags in memory block formatting

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

Co-authored-by: Letta <noreply@letta.com>
2025-12-15 12:02:33 -08:00
Kian Jones
0bac88d88a feat: run id correlation for core logs (#6518)
run-id correlation
2025-12-15 12:02:33 -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
cthomas
b486d7b472 feat: forward all client headers in Anthropic proxy (#6517)
- Forward all incoming headers from client to Anthropic API
- Extract header preparation logic into prepare_anthropic_headers() helper
- Filter out hop-by-hop headers and authorization header
- Only add fallback API key if client doesn't provide one

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

Co-authored-by: Letta <noreply@letta.com>
2025-12-15 12:02:33 -08:00
cthomas
7b5d03a714 feat: use Letta XML memory format in Anthropic proxy (#6514)
- Update memory injection to use Letta XML format with memory_blocks tags
- Extract memory formatting into format_memory_blocks() helper function

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

Co-authored-by: Letta <noreply@letta.com>
2025-12-15 12:02:33 -08:00
Christina Tong
972c61d0b8 chore: fallback to timestamp retrieval for message search [LET-6429] (#6510) 2025-12-15 12:02:33 -08:00
Sarah Wooders
3569721fd4 fix: avoid infinite summarization loops (#6506) 2025-12-15 12:02:33 -08:00
Kian Jones
a38475f23d fix: safely load span attributes for provider traces (#6508)
json.dumps on request data. Also remove step and actor since they are already present in the span
2025-12-15 12:02:33 -08:00
Sarah Wooders
9cbb8fa42a feat: add .skills/db-migrations-schema-changes (#6476) 2025-12-15 12:02:33 -08:00
jnjpng
cf30e8f910 chore: add stack info to migration warning log (#6500)
base

Co-authored-by: Letta Bot <noreply@letta.com>
2025-12-15 12:02:33 -08:00
jnjpng
89ca8fe8b0 feat: read from encrypted values with error on fallback [LET-4250] (#6484)
* base

* warning

---------

Co-authored-by: Letta Bot <noreply@letta.com>
2025-12-15 12:02:33 -08:00
Kian Jones
647e271c2a fix: add more logging for stream error (#6490)
* trying tout gpt-5.1-codex

* add unit test for message content

* try to support multimodal

* remove ValueError and add logging on stream error

* prevent stream termination from api spec implementation errors

* fix: remove final_response references from non-Responses API interfaces

* fix: add diagnostic attributes to SimpleOpenAIResponsesStreamingInterface

* fix: remove final_response from SimpleOpenAIStreamingInterface (Chat Completions API)
2025-12-15 12:02:33 -08:00
Kian Jones
5165d60881 feat: add a new span and log the provider request and response data objects (#6492)
add a new span and log the provider request and response data objects
2025-12-15 12:02:33 -08:00
Kian Jones
d6292b6eb6 fix: bug which causes unrecoverable state if previous message was an image (#6486)
* trying tout gpt-5.1-codex

* add unit test for message content

* try to support multimodal
2025-12-15 12:02:33 -08:00
cthomas
5109ba1384 feat: add source param to logging (#6473)
* feat: add source param to logging

* api sync
2025-12-15 12:02:32 -08:00
Kian Jones
964fc05cb9 chore: add more tracing to tool upsert endpoint (#6471)
* add tracing

* fix hallucination
2025-12-15 12:02:19 -08:00
jnjpng
c90eacdcbb fix: step metrics not found (#6472)
* base

* comment

---------

Co-authored-by: Letta Bot <noreply@letta.com>
2025-12-15 12:02:19 -08:00
Sarah Wooders
90e2030f41 fix: fix manual summarization (#6466) 2025-12-15 12:02:19 -08:00
Sarah Wooders
bd97b23025 feat: fallback to all mode for summarizer if error (#6465) 2025-12-15 12:02:19 -08:00
Sarah Wooders
7fa141273d fix: dont run summarizer if pending approval (#6464) 2025-12-15 12:02:19 -08:00
Sarah Wooders
91e3dd8b3e feat: fix new summarizer code and add more tests (#6461) 2025-12-15 12:02:19 -08:00