Commit Graph

326 Commits

Author SHA1 Message Date
Kevin Lin
8fc77af685 fix(memory): standardize tool parameter names (#9552)
fix(memory): standardize tool parameter names

    Use old_string/new_string across memory edit tools, docs, tests, and starter kits to avoid mismatched parameter names.

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

    Co-Authored-By: Letta <noreply@letta.com>
    EOF
    )
2026-02-24 10:55:24 -08:00
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
Kian Jones
2568c02b51 fix(core): strip quotes from MCP server header keys and values (#9349)
* fix(core): strip quotes from MCP server header keys and values

Users pasting JSON-formatted env vars into MCP server config end up with
quoted header names like `"CONTEXT7_API_KEY":` which causes
httpx.LocalProtocolError. Sanitize keys (strip surrounding quotes and
trailing colons) and values (strip surrounding quotes) in
resolve_custom_headers, resolve_environment_variables for HTTP configs,
and stdio env dicts.

Datadog: https://us5.datadoghq.com/error-tracking/issue/4a2f4af6-f2d8-11f0-930c-da7ad0900000

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

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

* fix: revert stdio env sanitization to pass-through

The stdio path doesn't need header/env sanitization - that's only
relevant for SSE/streamable HTTP servers with auth headers.

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

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

---------

Co-authored-by: Letta <noreply@letta.com>
2026-02-24 10:52:07 -08:00
Sarah Wooders
0dde155e9a feat: Prefix cache optimization system prompt (#9381) 2026-02-24 10:52:07 -08:00
Cameron
89a7a12b38 fix(core): remove send_message tool requirement from A2A messages (#9383)
The A2A messaging tools were instructing receiving agents to use the
send_message tool to reply, but that tool is often not attached to
agents anymore. This caused agents confusion when they couldn't find
the required tool.

For synchronous functions (send_message_to_agent_and_wait_for_reply,
send_message_to_agents_matching_tags, send_message_to_all_agents_in_group),
the system already captures AssistantMessage automatically, so agents
just need to respond normally.

For the async/fire-and-forget function (send_message_to_agent_async),
updated to indicate it's a one-way notification and hint that messaging
tools exist without requiring a specific one.

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

Co-authored-by: Letta <noreply@letta.com>
2026-02-24 10:52:07 -08:00
Sarah Wooders
526da4c49b Revert "perf: optimize prefix caching by skipping system prompt rebuild on every step" (#9380)
Revert "perf: optimize prefix caching by skipping system prompt rebuild on ev…"

This reverts commit eafa4144c2577a45b7007a177b701863b98d1dfa.
2026-02-24 10:52:07 -08:00
Sarah Wooders
9dbe28e8f1 perf: optimize prefix caching by skipping system prompt rebuild on every step (#9080) 2026-02-24 10:52:07 -08:00
Kian Jones
31d221b47e fix: handle MCP tool schemas missing properties key gracefully (#9347)
MCP tools can have an inputSchema like `{"type": "object", "additionalProperties": false}`
with no `properties` key (valid for zero-arg tools). The hard assert on `"properties" in
parameters_schema` caused an AssertionError. Replace assertions with safe defaults.

Datadog: https://us5.datadoghq.com/error-tracking/issue/ecee9ee2-db75-11f0-ba66-da7ad0900000

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

Co-authored-by: Letta <noreply@letta.com>
2026-02-24 10:52:07 -08:00
Kian Jones
745dd1e124 fix(core): reject empty API keys in Bearer auth headers (#9350)
Empty or None API keys resulted in "Bearer " header values which cause
httpx.LocalProtocolError. Use truthiness checks instead of `is not None`
to also reject empty strings before constructing Authorization headers.

Datadog: https://us5.datadoghq.com/error-tracking/issue/ad3c1e38-d557-11f0-a65d-da7ad0900000

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

Co-authored-by: Letta <noreply@letta.com>
2026-02-24 10:52:07 -08:00
Charles Packer
f58c4a43fa fix(core): remove "edit again if necessary" from memory tool return message (#9367)
Models (especially Opus) take this instruction literally and re-call
the memory edit tool in a loop — one user saw 96 consecutive rethink
calls. Dropping the sentence stops the feedback loop while still
asking the agent to review the result.

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

Co-authored-by: Letta <noreply@letta.com>
2026-02-24 10:52:07 -08:00
Sarah Wooders
3fdf2b6c79 chore: deprecate old agent messaging (#9120) 2026-02-24 10:52:06 -08:00
Kian Jones
1ab21af725 fix: safer type coersion for tools (#8990)
* mvp

* perfrom type coercion in sandbox

* fix: safely resolve typing annotations on host

Use an AST whitelist for generic annotations to avoid eval while keeping list/dict coercion working.

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

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

---------

Co-authored-by: Letta <noreply@letta.com>
2026-01-29 12:43:53 -08:00
Kevin Lin
b5519f02fb feat: make tool return messages more explicit [LET-7145] (#8986)
prompt
2026-01-29 12:43:53 -08:00
Ari Webb
7a104a74fe fix: allow conversation_search time only queries [LET-7094] (#8939)
fix: allow conversation_search time only queries
2026-01-19 15:54:44 -08:00
Kevin Lin
8872c2b5d3 feat: extend memory_apply_patch for memory block create and delete (#8832)
* update memory_apply_patch for memory block create and delete

* update docstring

* update docstring

* fix label

* working
2026-01-19 15:54:42 -08:00
Kevin Lin
758b74b9c4 feat: rename memory tool arguments for consistency with edit tool [LET-6972] (#8631)
* update names

* stage

* chore: retrigger linear workflow
2026-01-19 15:54:41 -08:00
cthomas
9b5067bed9 fix: remove unused sync code (#8613)
* chore: remove unused sync code

* chore: remove deprecated sync Google AI functions

Removes unused sync functions that used httpx.Client (blocking):
- google_ai_get_model_details()
- google_ai_get_model_context_window()
- GoogleGeminiProvider.get_model_context_window()

All code now uses async versions with httpx.AsyncClient.

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

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

---------

Co-authored-by: Letta <noreply@letta.com>
2026-01-19 15:54:37 -08:00
Ari Webb
956e7783ad feat: add ids to archival memory search [LET-6642] (#8355)
* feat: add id to archival memory search tool

* stage api
2026-01-12 10:57:48 -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
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
Sarah Wooders
ceadacd30e feat: support programmatic tool execution (cloud only) (#6441) 2025-12-15 12:02:19 -08:00
Sarah Wooders
0a0cf391fc fix: fix client injection code (#6421) 2025-12-15 12:02:18 -08:00
Cameron
bd5f684346 Update archival memory docstrings for clarity (#6098)
* Update archival memory docstrings for clarity

Improved docstrings for archival_memory_insert and archival_memory_search to:
- Better explain when and how to use these tools
- Provide clearer best practices
- Include more realistic examples (meeting notes, project updates)
- Emphasize semantic search vs keyword matching
- Clarify tag filtering behavior

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

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

* examples

---------

Co-authored-by: Letta <noreply@letta.com>
Co-authored-by: Kevin Lin <kl2806@columbia.edu>
2025-11-13 15:36:56 -08:00
Kevin Lin
f65eaa10c1 feat: Remove view from anthropic tool (#5832)
remove view from anthropic tool
2025-11-13 15:36:14 -08: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
Kevin Lin
4bb54f471c feat: memory apply patch [LET-5548] (#5475) 2025-10-24 15:13:15 -07:00
Kevin Lin
35b5383724 feat: match line number rendering to Anthropic / OAI defaults (#5492) 2025-10-24 15:13:15 -07:00
jnjpng
39a23e5960 fix: mcp schema generation test (#5608)
* base

* base

---------

Co-authored-by: Letta Bot <noreply@letta.com>
2025-10-24 15:13:15 -07:00
jnjpng
b0c0c8752b feat: support anyOf for structured output tools [LET-5615] (#5556)
* base

* works?

* update tests

---------

Co-authored-by: Letta Bot <noreply@letta.com>
2025-10-24 15:13:15 -07:00
Sarah Wooders
08be90f5e9 feat: revise mcp tool routes (#5195)
* refactored version of MCP routs

* feat: revise MCP routes

* working through new routes spec

* refining

* add necessary patch for config

* mcp servers progress

* small fixes

* updates

* finished

* just stage and publish api

* make update static

---------

Co-authored-by: Ari Webb <ari@letta.com>
Co-authored-by: Ari Webb <arijwebb@gmail.com>
2025-10-24 15:13:15 -07:00
Caren Thomas
a5354d7534 chore: bump version 0.11.8 2025-10-07 18:31:26 -07:00
Sarah Wooders
e07a589796 chore: rm composio (#5151) 2025-10-07 17:50:49 -07:00
Sarah Wooders
6016ac0f33 chore: undo fetch_webpage rename (#5132) 2025-10-07 17:50:49 -07:00
Charles Packer
09b173668a feat(core): rename fetch_webpage to web_fetch (#5110) 2025-10-07 17:50:48 -07:00
Sarah Wooders
7b73b25a95 fix: fix mcp for complex schemas and add tests (#5063) 2025-10-07 17:50:48 -07:00
Kevin Lin
09d9c3ffd4 feat: anthropic tools for claude sonnet 4.5 (#4988)
* add anthropic memory tools

* memory view working

* update memory examples

* tools

* feat: some changes (#5003)

* feat: added the ability to modify and add descriptions on creation

* fix: kill dead code & write into core_tool_executor instead

* fix: use block_manager not agent_manager where possible, also turn the return string errors into raising exceptions

* fix: cleanup, get rid of more return string errors replaced with valueerror, also drop deadcode

---------

Co-authored-by: Charles Packer <packercharles@gmail.com>
2025-10-07 17:50:47 -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
cthomas
0776a236c8 feat: add new header dependency in all routes (#2905) 2025-09-15 14:33:08 -07:00
cthomas
2d971cdcf0 feat: hold reference to asyncio tasks in memory (#2823) 2025-09-10 17:08:07 -07:00
jnjpng
2aae4bf0db feat: add resync tool endpoint (#2812)
Co-authored-by: Jin Peng <jinjpeng@Jins-MacBook-Pro.local>
2025-09-09 18:11:02 -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
Charles Packer
388dd46ffc feat: various performance patches for gpt-5 [LET-4157] (#4381)
* feat: increase the verbosity of the heartbeat kwarg

* chore: strip docstrings out from the file in which they are not parsed (duplicates inside base.py

* feat: add examples to the docstrings for memory_replace and memory_insert

* feat: add more examples
2025-09-06 11:23:13 -07:00
Charles Packer
9bbe7ecb3e feat: various performance patches for gpt-5 [LET-4157] (#4381)
* feat: increase the verbosity of the heartbeat kwarg

* chore: strip docstrings out from the file in which they are not parsed (duplicates inside base.py

* feat: add examples to the docstrings for memory_replace and memory_insert

* feat: add more examples
2025-09-06 11:23:13 -07:00
Matthew Zhou
415ae5a928 chore: Add more prompting around archival datetime (#4432)
Add more prompting around archival datetime
2025-09-04 15:31:49 -07:00
Matthew Zhou
56bd02d778 chore: Add more prompting around archival datetime (#4432)
Add more prompting around archival datetime
2025-09-04 15:31:49 -07:00
Matthew Zhou
dda4459245 feat: Make end date inclusive on conversation search (#4431)
Make end date inclusive
2025-09-04 15:26:49 -07:00
Matthew Zhou
ba3843031e feat: Make end date inclusive on conversation search (#4431)
Make end date inclusive
2025-09-04 15:26:49 -07:00
Matthew Zhou
d924cc005b fix: change to pure rank-based RRF for relevance ordering (#4411)
* Fix RRF

* Fix turbopuffer tests
2025-09-03 17:33:19 -07:00