Commit Graph

6355 Commits

Author SHA1 Message Date
Kian Jones
361c9a14d8 feat(metrics): Surface custom metrics for temporal workflows and workers (#5951)
* temporal custom metrics

* Delete apps/core/letta/agents/temporal/PRODUCTION_SETUP.md

* Delete apps/core/letta/agents/temporal/DATADOG_METRICS.md

* add unit testing
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
jnjpng
e2774c07c6 feat: generate otid when using input field on message send (#5990)
* base

* try this out

* plz

* fix

---------

Co-authored-by: Letta Bot <noreply@letta.com>
2025-11-13 15:36:55 -08:00
Kian Jones
6943b68288 tests: adding unit testing and fix edge case (#5992)
cursor bugbot suggestion number 2 and adding unit testing
2025-11-13 15:36:55 -08:00
Kian Jones
688397bbd2 fix: filter out messages with empty content in anthropic client (#5987)
* no bare raise in anthropic client. Also filter out messages with empty content

* use client logic

* replace empty/whitespace with period

* cursor bugbot
2025-11-13 15:36:55 -08:00
jnjpng
aa41bd7f6f chore: replace sonnet-3-5 with sonnet-4-5 from send message integration tests (#5989)
add

Co-authored-by: Letta Bot <noreply@letta.com>
2025-11-13 15:36:55 -08:00
jnjpng
05b359b7f5 chore: add local base 64 url image for send message integration (#5969)
* base

* update

* clean up

* update

---------

Co-authored-by: Letta Bot <noreply@letta.com>
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
Charles Packer
6646a27bf7 fix(core): actually use parallel_tool_calls in create/update [LET-6070] (#5984)
fix(core): actually use parallel_tool_calls in create/update
2025-11-13 15:36:55 -08:00
Ari Webb
395c04c52e fix: stainless pagination (#5943)
---------

Co-authored-by: Ari Webb <ari@letta.com>
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
Matthew Zhou
dbad510a6e fix: Bound async queue during streaming (#5976)
Add maxsize = 1
2025-11-13 15:36:55 -08:00
Matthew Zhou
72e80395cc fix: Fix gemini streaming interface string growth [LET-6067] (#5975)
* Fix gemini streaming interface

* Add comments
2025-11-13 15:36:55 -08:00
Matthew Zhou
6f57ae829a fix: Reduce string growth for anthropic (#5974)
Reduce string growth for anthropic
2025-11-13 15:36:55 -08:00
Matthew Zhou
a699aca626 fix: Eliminate O(n^2) string growth for OpenAI [LET-6065] (#5973)
Finish
2025-11-13 15:36:55 -08:00
Ari Webb
162661457a fix: sleeptime agents are broken [LET-6042] (#5953)
minimal solution
2025-11-13 15:36:55 -08:00
Cameron
546c972d2e Simplify docs navigation to 3 tabs (#5940)
* Add archival memory import/export utilities

Added two utility scripts for managing agent archival memories:

- export_agent_memories.py: Export all passages from an agent to JSON
  - Paginates through all results
  - Removes embedding/embedding_config for portability
  - Usage: python export_agent_memories.py <agent_id> [--output <file>]

- import_agent_memories.py: Import passages into an agent from JSON
  - Batch imports with progress tracking
  - Handles optional fields (tags, created_at)
  - Includes dry-run mode for preview
  - Usage: python import_agent_memories.py <agent_id> <input_file>

Use cases:
- Backup/restore agent memories
- Transfer memories between agents
- Seed new agents with existing knowledge bases

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

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

* Reorganize docs navigation structure

- Move 'Legacy & Migration' and 'Research Background' under 'Additional Resources'
- Restructure Tools section with clearer hierarchy:
  - Using Tools (basics)
  - Built-in Tools (prebuilt utilities)
  - Advanced Configuration (rules, variables)
  - Model Context Protocol (integrations)
- Remove awkward 'Utilities' subsection
- Create more logical progression from basics to advanced

* Reorganize docs with task-based structure

Instead of organizing by technical concepts (Memory, Tools, Configuration),
reorganize by user goals and tasks:

1. Building Agents
   - Agent basics & fundamentals
   - Adding Memory (all memory content together)
   - Adding Tools (all tool content together)
   - Multi-modal & structured output

2. Working with Data
   - Files & Filesystem
   - Import/Export workflows
   - Memory export

3. Controlling Behavior
   - Tool rules & workflows
   - Execution controls (streaming, long-running)
   - HITL, scheduling

4. Connecting Systems
   - MCP
   - Multi-user
   - Multi-agent
   - Integrations

5. Experimental Features
   - Groups, sleep-time agents, voice

Benefits:
- Clearer user journey from basics to advanced
- Related content grouped by task, not type
- Easier to find 'how do I...' answers
- Flatter hierarchy, less nesting

* Simplify docs navigation to 3 tabs

Consolidated docs.yml to have only 3 main tabs:
- Developer Guide (all guides and tutorials)
- Examples (cookbooks and tutorials)
- API Reference (API docs)

Removed duplicate tab navigation entries for cloud, showcase, evals, examples, and ref tabs.

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

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

* Reorganize Advanced Features into logical sections

Moved items from Advanced Features section to more appropriate locations:
- Tool-related items → Adding Tools section
- Agent capabilities (streaming, long-running, etc.) → New Agent Capabilities section
- Configuration items (multi-user, scheduling, agent files) → New Configuration section
- Multi-Agent Systems → Top-level section under Building Agents
- Experimental features → Top-level section under Building Agents
- Exporting Archival Memories → Added to Archival Memory section
- MCP → Added under Adding Tools

Removed the Advanced Features section entirely.

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

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

* Create Application Integration section

Renamed "Agent Capabilities" to "Application Integration" and moved appropriate items:
- Streaming Responses
- Long-Running Executions
- Human-in-the-Loop

Kept under Building Agents:
- Multi-Modal Inputs
- JSON Mode & Structured Output
- Files & Filesystem

This better separates agent features from application integration concerns.

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

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

* Move Message Types to Application Integration

Message Types is more about understanding API message formats for integration rather than building agent capabilities.

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

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

* Add missing evals pages and fix all broken links

Added missing evals documentation pages to navigation:
- Core Concepts: Gates
- Graders section: Tool Graders, Rubric Graders, Multi-Metric
- Extractors section: Built-in, Custom
- Advanced section: Custom Graders, Multi-Turn Conversations
- CLI Reference: Commands
- Troubleshooting: Common Issues

Fixed 83 broken links across documentation:
- Evals internal links (updated paths to /guides/evals/...)
- Cloud documentation links (/guides/cloud/...)
- Concept documentation links (legacy memgpt paths)
- Getting started links (composio, quickstart, ade setup)
- Agent documentation links (archival-memory, multiagent, human-in-the-loop)
- Examples links (pdf-chat, shared-memory-blocks, multi-agent-async)
- Changelog API reference links

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

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

* docs: additional pass on docs (#5954)

* refactor: init casing change + light ordering change (pull out tools)

* refactor: another biggie

---------

Co-authored-by: Letta <noreply@letta.com>
Co-authored-by: Charles Packer <packercharles@gmail.com>
2025-11-13 15:36:54 -08:00
Christina Tong
7c731feab3 fix: integration tests send message v1 sdk (#5920)
* fix: integration tests send message v1 sdk

* early cancellationg

* fix image

* remove

* update

* update comment

* specific prompt
2025-11-13 15:36:50 -08:00
Shubham Naik
53d2bd0443 feat: support webhooks for step completions (#5904)
* chore: have letta fire a request after every step

* chore: have letta fire a request after every step

* chore: temporal

* chore: temporal

---------

Co-authored-by: Shubham Naik <shub@memgpt.ai>
2025-11-13 15:36:50 -08:00
Kian Jones
6fa1a1d6c3 make sure tool return chars within max int range (#5942)
* max

* final

* Set return_char_limit maximum to 1 million in OpenAPI spec (#5946)

* Initial plan

* Set max int range to 1 million for return_char_limit

Co-authored-by: kianjones9 <11655409+kianjones9@users.noreply.github.com>

---------

Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com>
Co-authored-by: kianjones9 <11655409+kianjones9@users.noreply.github.com>

* Update tool.py

* fix api

---------

Co-authored-by: Copilot <198982749+Copilot@users.noreply.github.com>
2025-11-13 15:36:50 -08:00
Kian Jones
aedddcb1d1 chore: log payload on all summarizer failures for debugging (#5952)
* log the request data on fallback too

* log at every layer lol
2025-11-13 15:36:50 -08:00
Ari Webb
ed99d7eb2b feat: add input option to send message route [LET-4540] (#5938)
---------

Co-authored-by: Ari Webb <ari@letta.com>
2025-11-13 15:36:50 -08:00
Kian Jones
c92e1d56bb fix: use async_session_factory directly in scheduler (#5944)
DatabaseRegistry.get_async_session_factory() was removed during the sync
DB removal refactor, but scheduler.py still referenced it. This caused
AttributeError failures in all integration and send-message tests.

Fix by importing and using async_session_factory() directly from db module.
2025-11-13 15:36:50 -08:00
Sarah Wooders
caa79d7bc9 feat: add EventMessage and SummaryMessage (#5765)
* feat: add new message types for 1.0

* feat: add new message types for 1.0

* update apis

* update openapi

---------

Co-authored-by: jnjpng <jin@letta.com>
Co-authored-by: Letta Bot <noreply@letta.com>
2025-11-13 15:36:50 -08:00
Kian Jones
d33fd219db chore: debug to info (#5941)
debug to info
2025-11-13 15:36:50 -08:00
Charles Packer
aa7093c585 fix: patch hole in the fallback summarizer where we weren't actually truncating (#5919)
* fix: patch hole in the fallback summarizer where we weren't actually truncating

* fix: remove no-op

* chore: comment

* fix: simplify the new fallback

* fix: properly handle images in summarizer payload
2025-11-13 15:36:50 -08:00
Kian Jones
6c377cdc81 chore(logs): Add resource usage logging to streaming, file uploads, mcp client, and model caches (#5925)
* adding log messages to track memory consumption

* add logging to sources, folders, agentfiles, and mcp clients

* memory logging for tool creation paths
2025-11-13 15:36:50 -08:00
Kian Jones
b9f1c6aece fix(e2b): add monitoring and alerting for e2b (#5935)
* add e2b sandbox template variable to env for now. (may need to pull from secrets to have syncing in future)

* upgrade from info to warning

* apps

* e2b execution time
2025-11-13 15:36:50 -08:00
Cameron
28609d753c docs: migrate documentation to cloud-first approach (#5928)
* Add archival memory import/export utilities

Added two utility scripts for managing agent archival memories:

- export_agent_memories.py: Export all passages from an agent to JSON
  - Paginates through all results
  - Removes embedding/embedding_config for portability
  - Usage: python export_agent_memories.py <agent_id> [--output <file>]

- import_agent_memories.py: Import passages into an agent from JSON
  - Batch imports with progress tracking
  - Handles optional fields (tags, created_at)
  - Includes dry-run mode for preview
  - Usage: python import_agent_memories.py <agent_id> <input_file>

Use cases:
- Backup/restore agent memories
- Transfer memories between agents
- Seed new agents with existing knowledge bases

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

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

* docs: migrate documentation to cloud-first approach

Update all documentation to use Letta Cloud as the default deployment path:
- Remove base_url parameter from cloud examples (uses api.letta.com by default)
- Add token authentication to all SDK examples
- Change localhost URLs to https://api.letta.com in all examples
- Remove embedding parameter from cloud examples (managed automatically)
- Add comprehensive embedding configuration section to self-hosting guide
- Add warnings about required embedding configuration for self-hosted deployments
- Update curl examples to include Authorization headers
- Link to https://app.letta.com/api-keys for token retrieval

Files updated:
- Agent guides (11 files)
- Model configuration pages (5 files)
- Evals documentation (6 files)
- ADE guides (2 files)
- Self-hosting guide
- Voice integration guide
- README
- Quickstart

* docs: fix embedding parameter issues in cloud examples

- Remove leftover embedding parameter from TypeScript example in agents/overview.mdx
- Make self-hosting comment more explicit in README by showing actual embedding parameter syntax

* docs: fix model configuration pages to be self-hosting focused

Model configuration pages (OpenAI, Anthropic, Azure, xAI, Ollama) are about
configuring providers on self-hosted servers, not Letta Cloud. Updated all
SDK examples to:
- Use base_url="http://localhost:8283" instead of cloud token auth
- Include embedding parameter with clear comment
- Use consistent "An embedding model is required for self-hosted" wording
- Add Note directing cloud users to quickstart guide

This clarifies that provider configuration is a self-hosting concern, while
Letta Cloud manages providers automatically.

* fix: remove duplicate Authorization headers in human-in-the-loop docs

* chore: remove utility scripts that shouldn't be in repo

---------

Co-authored-by: Letta <noreply@letta.com>
2025-11-13 15:36:49 -08:00
Charles Packer
b42e9fa7f3 fix(core): properly map bytes overflow to context overflow error (#5930) 2025-11-13 15:36:45 -08:00
jnjpng
81d12d7d40 feat: add new template create agent route without project id path param [LET-5998] (#5898)
* base

* clean up

* generate

---------

Co-authored-by: Letta Bot <noreply@letta.com>
2025-11-13 15:36:45 -08:00
Cameron
30fb3e0bd8 docs: add enterprise-only warning for bring-your-own API keys (#5786)
Added warning message to clarify that BYOK is only available for enterprise customers.

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

Co-authored-by: Letta <noreply@letta.com>
2025-11-13 15:36:45 -08:00
Cameron
d27cfea139 docs: remove pip installation and letta server references (#5827)
Removes all references to pip installation (pip install letta) and the
letta server command from documentation, as Docker is now the only
supported installation method for self-hosting Letta.

Changes:
- Removed pip installation accordion from selfhosting/overview.mdx
- Updated FAQ to indicate Docker is required
- Removed CLI/pip sections from all model provider docs (13 files):
  * OpenAI, Anthropic, Groq, Google AI, DeepSeek, xAI, Together.AI
  * AWS Bedrock, Azure OpenAI, Google Vertex AI
  * Ollama, LM Studio, vLLM, OpenAI Proxy
- Removed "letta server" tabs from agent tool docs (web_search,
  fetch_webpage, run_code)
- Updated evals getting-started.mdx to use Docker in error messages

All references now point to Docker installation with links to the
self-hosting guide. SDK installation (pip install letta-client) remains
intact for developers using the Letta API.

Fixes feedback from user report at docs.letta.com/prompts

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

Co-authored-by: Letta <noreply@letta.com>
2025-11-13 15:36:44 -08:00
Kian Jones
c81fded806 chore: dump payload on error (#5918)
dump payload on error
2025-11-13 15:36:39 -08:00
Matthew Zhou
7b3cb0224a feat: Add gemini parallel tool call streaming for gemini [LET-6027] (#5913)
* Make changes to gemini streaming interface to support parallel tool calling

* Finish send message integration test

* Add comments
2025-11-13 15:36:39 -08:00
Christina Tong
8468ef3cd7 chore: migrate test sdk client to v1 [LET-5981] (#5887)
* chore: migrate test sdk client to v1 [LET-5981]

* simplify

* simplify
2025-11-13 15:36:39 -08:00
Charles Packer
52ff51755c fix: move persistence on message_ids to prevent desync [LET-6011] (#5908)
fix: move persistence on message_ids to prevent desync
2025-11-13 15:36:39 -08:00
Charles Packer
468b47bef5 fix(core): patch sse streaming errors (#5906)
* fix: patch sse streaming errors

* fix: don't re-raise, but log explicitly with sentry

* chore: cleanup comments

* fix: revert change from #5907, also make sure to write out a [DONE] to close the stream
2025-11-13 15:36:39 -08:00
Sarah Wooders
ac599145bb fix: various fixes for runs (#5907)
* Fix agent loop continuing after cancellation in letta_agent_v3

Bug: When a run is cancelled, _check_run_cancellation() sets
self.should_continue=False and returns early from _step(), but the outer
for loop (line 245) continues to the next iteration, executing subsequent
steps even though cancellation was requested.

Symptom: User hits cancel during step 1, backend marks run as cancelled,
but agent continues executing steps 2, 3, etc.

Root cause: After the 'async for chunk in response' loop completes (line 255),
there was no check of self.should_continue before continuing to the next
iteration of the outer step loop.

Fix: Added 'if not self.should_continue: break' check after the inner loop
to exit the outer step loop when cancellation is detected. This makes v3
consistent with v2 which already had this check (line 306-307).

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

Co-authored-by: Letta <noreply@letta.com>

* add integration tests

* passing tests

* fix: minor patches

* undo

---------

Co-authored-by: cpacker <packercharles@gmail.com>
Co-authored-by: Letta <noreply@letta.com>
2025-11-13 15:36:39 -08:00
Charles Packer
a6077f3927 fix(core): Fix agent loop continuing after cancellation in letta_agent_v3 [LET-6006] (#5905)
* Fix agent loop continuing after cancellation in letta_agent_v3

Bug: When a run is cancelled, _check_run_cancellation() sets
self.should_continue=False and returns early from _step(), but the outer
for loop (line 245) continues to the next iteration, executing subsequent
steps even though cancellation was requested.

Symptom: User hits cancel during step 1, backend marks run as cancelled,
but agent continues executing steps 2, 3, etc.

Root cause: After the 'async for chunk in response' loop completes (line 255),
there was no check of self.should_continue before continuing to the next
iteration of the outer step loop.

Fix: Added 'if not self.should_continue: break' check after the inner loop
to exit the outer step loop when cancellation is detected. This makes v3
consistent with v2 which already had this check (line 306-307).

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

Co-authored-by: Letta <noreply@letta.com>

* add integration tests

* fix: misc fixes required to get cancellations to work on letta code localhost

---------

Co-authored-by: Letta <noreply@letta.com>
Co-authored-by: Sarah Wooders <sarahwooders@gmail.com>
2025-11-13 15:36:39 -08:00
Charles Packer
a44c05040a fix(core): big context overflow handling patch (#5901) 2025-11-13 15:36:39 -08:00
Ari Webb
7427c0998e feat: gemini parallel tool calling non streaming [LET-5993] (#5889)
* first hack

* just test non streaming

* stream_steps should pass too

* clean up

---------

Co-authored-by: Ari Webb <ari@letta.com>
2025-11-13 15:36:39 -08:00
Ari Webb
da11d80bf4 fix: add default model gpt4.1 (#5897)
add default model gpt4.1

Co-authored-by: Ari Webb <ari@letta.com>
2025-11-13 15:36:39 -08:00
Sarah Wooders
427ac0c5a2 fix: ignore persisted e2b template (#5890) 2025-11-13 15:36:39 -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
57bb051ea4 feat: add tool return truncation to summarization as a fallback [LET-5970] (#5859) 2025-11-13 15:36:30 -08:00
Kian Jones
cdde791b11 chore: publish nightly from closed source (#5892)
publish nightly from closed source
2025-11-13 15:36:28 -08:00
Kian Jones
193c4f7c4a chore: continued logging cleanup and bugfixes (#5882)
* gracefully handle mcp error, runs/temporal error, and otel exporter bug fixes

* move error handling to managers

* remove migrated error handling from routers

* move logger.error calls to logger.warnings
2025-11-13 15:36:20 -08:00
Christina Tong
381ca5bde8 chore: migrate built in tools integration test to sdk v1 [LET-5980] (#5883)
* chore: migrate built in tools integration test to sdk v1

* fix

* remove trialing commas
2025-11-13 15:36:20 -08:00
Christina Tong
255fdfecf2 feat: migrate integration_test_human_in_the_loop to sdk v1 [LET-5979] (#5878)
* feat: migrate integration_test_human_in_the_loop to sdk v1

* update modify

* parallel tool calling fixes

* fix

* updat aparallel tool calling

* remove regex matching
2025-11-13 15:36:20 -08:00