Commit Graph

6345 Commits

Author SHA1 Message Date
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
Kian Jones
185031882a fix: prevent huge otel spans causing pods to be OOMKilled (#5871)
* otel fix

* add unit test

* log the resource id

* iterables support and fix unittest

* fix some edge cases
2025-11-13 15:36:20 -08:00
Charles Packer
95f5d12b9f docs: add parallel tool calling docs (#5876)
* docs: add parallel tool calling docs

* docs: forgot the yaml

* fix: update
2025-11-13 15:36:20 -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
Matthew Zhou
d3ab51b822 feat: Support parallel tool calling streaming for responses OpenAI [LET-5977] (#5867) 2025-11-13 15:36:20 -08:00
Charles Packer
60ed435727 fix(core): patch summarizer on letta_agent_v3.py (letta_agent_v1 loop) (#5863)
* fix(core): patch summarizer

* fix: misc fixes

* refactor: remove fallbacks, instead throw a warning

* refactor: pull out magic number to constant
2025-11-13 15:36:20 -08:00
Sarah Wooders
1f05872b10 fix: patch attaching archival tools (#5869) 2025-11-13 15:36:20 -08:00
Cameron
e8eb2d53e9 docs: fix multimodal content order in examples (#5843)
Updates multimodal examples to place text content before image content,
which prevents request failures.

Changes:
- Reordered content array in all SDK examples to have text first, then image
- Fixed TypeScript mediaType casing (media_type -> mediaType)
- Applied to both URL-based and base64-encoded image examples

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

Co-authored-by: Letta <noreply@letta.com>
2025-11-13 15:36:18 -08:00
Matthew Zhou
ff81f4153b feat: Support parallel tool calling streaming for OpenAI chat completions [LET-4594] (#5865)
* Finish chat completions parallel tool calling

* Undo comments

* Add comments

* Remove test file
2025-11-13 15:36:14 -08:00
Christina Tong
599adb4c26 chore: migrate integration test send message to v1 sdk [LET-5940] (#5794)
* chore: migrate integration test send message to v1 sdk

* new folder

* set up new workflows for integration test

* remove file

* update stainless workflow

* fix import err

* add letta-client version logging

* fix: SDK cache miss should fall back to PyPI instead of failing

When the Stainless SDK cache is not available, the workflow should
fall back to installing the published SDK from PyPI rather than
failing the CI build. The workflow already has this fallback logic
in the "Install Stainless SDK" step, but the "Check SDK cache"
step was failing before it could reach that point.

This change converts the hard failure (exit 1) to a warning message,
allowing the workflow to continue and use the PyPI fallback.

Co-Authored-By: Claude <noreply@anthropic.com>

* force upgrade

* remove frozen

* install before running

* add no sync

* use upgrade instead of upgrade package

* update

* fix llm config

* fix

* update

* update path

* update workflow

* see installed version

* add fallback

* update

* fix mini

* lettaping

* fix: handle o1 token streaming and LettaPing step_id validation

- Skip LettaPing messages in step_id validation (they don't have step_id)
- Move o1/o3/o4 token streaming check before general assertion in assert_tool_call_response
- o1 reasoning models omit AssistantMessage in token streaming mode (6 messages instead of 7)

---------

Co-authored-by: Kian Jones <kian@letta.com>
Co-authored-by: Claude <noreply@anthropic.com>
2025-11-13 15:36:14 -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