Commit Graph

6916 Commits

Author SHA1 Message Date
jnjpng
58a5375c19 fix: test sdk client due to message batch route ordering (#8733)
* base

* generate
2026-01-19 15:54:40 -08:00
Sarah Wooders
aabd58628e feat: add conversation cancellation endpoint (#8729) 2026-01-19 15:54:40 -08:00
jnjpng
037c20ae1b feat: query param parity for conversation messages (#8730)
* base

* add tests

* generate
2026-01-19 15:54:40 -08:00
Sarah Wooders
9aac2abdfe chore: deprecate identities/groups APIs and remove from SDK (#8580)
* chore: deprecate identities/groups APIs and remove from SDK

- Mark all /v1/identities/* endpoints as deprecated
- Mark all /v1/groups/* endpoints as deprecated
- Remove identities, groups, and batches resources from stainless.yml
- Batch API remains active but hidden from SDK

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

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

* chore: update autogenerated SDK files

* chore: regenerate SDK and OpenAPI spec

Run `just stage-api` and `just publish-api` to sync generated files.

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

Co-authored-by: Sarah Wooders <sarahwooders@users.noreply.github.com>

* chore: remove schedule API from stainless SDK

Remove schedule subresource from stainless.yml to hide scheduled messages
endpoints from the SDK generation.

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

Co-authored-by: Sarah Wooders <sarahwooders@users.noreply.github.com>

---------

Co-authored-by: Letta <noreply@letta.com>
Co-authored-by: letta-code <248085862+letta-code@users.noreply.github.com>
Co-authored-by: Sarah Wooders <sarahwooders@users.noreply.github.com>
2026-01-19 15:54:40 -08:00
jnjpng
e3e758a8c0 feat: add retrieve message endpoint and to client sdk (#8719)
* base

* generate openapi

* try again

* now
2026-01-19 15:54:40 -08:00
Kian Jones
3eae81cf62 feat: add /v1/runs/{run_id}/trace endpoint for OTEL traces (#8682)
* feat: add /v1/runs/{run_id}/trace endpoint for OTEL traces

- Add new endpoint to retrieve filtered OTEL spans for a run
- Filter to only return UI-relevant spans (agent_step, tool executions, root span, TTFT)
- Skip Postgres writes when ClickHouse is enabled for provider traces
- Add USE_CLICKHOUSE_FOR_PROVIDER_TRACES env var to helm/justfile
- Move typecheck CI to self-hosted runners

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

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

* fix: add missing clickhouse_provider_traces.py

The telemetry_manager.py imports ClickhouseProviderTraceReader from
this module, but the file was not included when splitting the PR.

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

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

* autogen

* fix: add trace.retrieve to stainless.yml for SDK generation

Adds the runs.trace.retrieve method mapping so Stainless generates
the useRunsServiceRetrieveTraceForRun hook.

🤖 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:39 -08:00
Sarah Wooders
9d1ad00dd6 Revert "fix: filter orphaned approval_request messages to prevent Anthropic API errors" (#8721)
Revert "fix: filter orphaned approval_request messages to prevent Anthropic A…"

This reverts commit 2df946c0a821ab8346e8e9037e819be24004a51f.
2026-01-19 15:54:39 -08:00
Sarah Wooders
97cdfb4225 Revert "feat: add strict tool calling setting [LET-6902]" (#8720)
Revert "feat: add strict tool calling setting [LET-6902] (#8577)"

This reverts commit 697c9d0dee6af73ec4d5d98780e2ca7632a69173.
2026-01-19 15:54:39 -08:00
jnjpng
eb748b8f1a fix: mcp oauth session user scoping (#8630)
* base

* update

* revert a bit

* revert package lock

* clean up

* update
2026-01-19 15:54:39 -08:00
Ari Webb
2233d141b1 feat: add codex 5.2 context window (#8704) 2026-01-19 15:54:39 -08:00
Charles Packer
ca753a6d50 fix: filter orphaned approval_request messages to prevent Anthropic API errors (#8688) 2026-01-19 15:54:39 -08:00
Ari Webb
20e4286382 fix: allow re-enable sleeptime after deleted [LET-6553] (#8680)
fix: allow re-enable sleeptime after deleted
2026-01-19 15:54:39 -08:00
Sarah Wooders
b888c4c17a feat: allow for conversation-level isolation of blocks (#8684)
* feat: add conversation_id parameter to context endpoint [LET-6989]

Add optional conversation_id query parameter to retrieve_agent_context_window.
When provided, the endpoint uses messages from the specific conversation
instead of the agent's default message_ids.

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

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

* chore: regenerate SDK after context endpoint update [LET-6989]

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

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

* feat: add isolated blocks support for conversations

Allows conversations to have their own copies of specific memory blocks (e.g., todo_list) that override agent defaults, enabling conversation-specific state isolation.

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

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

* undo

* update apis

* test

* cleanup

* fix tests

* simplify

* move override logic

* patch

---------

Co-authored-by: Letta <noreply@letta.com>
2026-01-19 15:54:39 -08:00
Sarah Wooders
9c4f191755 feat: add conversation_id parameter to context endpoint [LET-6989] (#8678)
* feat: add conversation_id parameter to context endpoint [LET-6989]

Add optional conversation_id query parameter to retrieve_agent_context_window.
When provided, the endpoint uses messages from the specific conversation
instead of the agent's default message_ids.

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

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

* chore: regenerate SDK after context endpoint update [LET-6989]

👾 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:39 -08:00
github-actions[bot]
5fbf8f93e2 fix: add explicit timeouts to httpx clients to prevent ReadTimeout errors (#8538)
This commit addresses the httpx.ReadTimeout error detected in production
by adding explicit timeout configurations to several httpx client usages:

1. MCP SSE client: Pass mcp_connect_to_server_timeout (30s) to sse_client()
2. MCP StreamableHTTP client: Pass mcp_connect_to_server_timeout (30s) to streamablehttp_client()
3. OpenAI model list API: Add 30s timeout with 10s connect timeout
4. Google AI model list/details API: Add 30s timeout with 10s connect timeout

Previously, these httpx clients were created without explicit timeouts,
which could cause ReadTimeout errors when remote servers are slow to respond.

Fixes #8073

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

Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
Co-authored-by: datadog-official[bot] <datadog-official[bot]@users.noreply.github.com>
Co-authored-by: Kian Jones <11655409+kianjones9@users.noreply.github.com>
2026-01-19 15:54:38 -08:00
github-actions[bot]
85c40c8154 fix: add streaming fallback for long-running Anthropic requests (#8564)
When the Anthropic SDK detects a request may exceed 10 minutes, it
raises a ValueError requiring streaming mode. This fix catches that
specific error in request_async and automatically falls back to
streaming mode, accumulating the response into the same format as
non-streaming.

This resolves the production error:
"ValueError: Streaming is required for operations that may take
longer than 10 minutes"

Fixes #8516

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

Co-authored-by: letta-code <248085862+letta-code@users.noreply.github.com>
Co-authored-by: datadog-official[bot] <datadog-official[bot]@users.noreply.github.com>
Co-authored-by: Letta <noreply@letta.com>
Co-authored-by: Kian Jones <11655409+kianjones9@users.noreply.github.com>
2026-01-19 15:54:38 -08:00
github-actions[bot]
ebc77d0950 fix: wrap MCP client connection errors in ConnectionError (#8569)
The FastMCP clients were not properly wrapping exceptions from
`connect_to_server()`, causing raw RuntimeErrors (like DNS resolution
failures with "[Errno -2] Name or service not known") to propagate
up unchanged.

Changes:
- Both `AsyncFastMCPSSEClient` and `AsyncFastMCPStreamableHTTPClient`
  now properly catch all exceptions and wrap them in `ConnectionError`
- Added warning-level logging for failed connections
- Provides user-friendly error messages with the server URL

Fixes #8568
Related to #8499



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

Co-authored-by: letta-code <248085862+letta-code@users.noreply.github.com>
Co-authored-by: Letta <noreply@letta.com>
Co-authored-by: Kian Jones <11655409+kianjones9@users.noreply.github.com>
2026-01-19 15:54:38 -08:00
github-actions[bot]
e914075b04 fix: ensure thought_signature is included for Gemini 3 function calls (#8590)
This fixes a 400 INVALID_ARGUMENT error from Google's Gemini API where
function calls were missing required thought_signature in functionCall parts.

Changes:
- Allow signatures when self.model is None (backwards compatibility for
  older messages that may not have had their model field set)
- Only add thought_signature to the FIRST function call for parallel
  tool calls, per Google's docs
- Take the first non-None signature found (don't keep overwriting)

Reference: https://ai.google.dev/gemini-api/docs/thought-signatures

Closes #8589

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

Co-authored-by: letta-code <248085862+letta-code@users.noreply.github.com>
Co-authored-by: datadog-official[bot] <datadog-official[bot]@users.noreply.github.com>
Co-authored-by: Kian Jones <11655409+kianjones9@users.noreply.github.com>
2026-01-19 15:54:38 -08:00
Sarah Wooders
ea36633cd5 fix: make sure structured outputs turned on for openai (#8669) 2026-01-19 15:54:38 -08:00
github-actions[bot]
2460b36f97 fix: handle asyncpg QueryCanceledError for statement timeouts (#8241)
The handle_db_timeout decorator only caught SQLAlchemy's TimeoutError
(for pool/connection timeouts) but not asyncpg's QueryCanceledError
which is thrown when PostgreSQL's statement_timeout kills a long-running
query.

This fix:
- Import asyncpg.exceptions.QueryCanceledError
- Update handle_db_timeout decorator to catch QueryCanceledError and wrap
  it in DatabaseTimeoutError
- Update _handle_dbapi_error method to also handle wrapped QueryCanceledError

Fixes #8108

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

Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
Co-authored-by: Letta <noreply@letta.com>
Co-authored-by: datadog-official[bot] <datadog-official[bot]@users.noreply.github.com>
Co-authored-by: Kian Jones <11655409+kianjones9@users.noreply.github.com>
2026-01-19 15:54:38 -08:00
github-actions[bot]
bfb08e77f8 fix: prevent deadlock in bulk tool upsert by sorting tools by name (#8667)
When multiple concurrent transactions try to upsert the same tools,
they can deadlock if they acquire row locks in different orders.

This fix sorts tools by name before the bulk INSERT to ensure all
transactions acquire locks in a consistent order, preventing deadlocks.

Fixes #8666

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

Co-authored-by: letta-code <248085862+letta-code@users.noreply.github.com>
Co-authored-by: datadog-official[bot] <datadog-official[bot]@users.noreply.github.com>
Co-authored-by: Letta <noreply@letta.com>
Co-authored-by: Kian Jones <11655409+kianjones9@users.noreply.github.com>
2026-01-19 15:54:38 -08:00
github-actions[bot]
a5108c96b4 fix: handle ToolError exceptions in MCP clients to reduce production alerts (#8599)
Add ToolError to exception handling alongside McpError in MCP client classes.
ToolError is raised by fastmcp for input validation errors (e.g., missing
required properties like 'filename'). Both error types are expected user-facing
errors from external MCP servers and should be logged at warning/debug level
to avoid triggering production alerts.

Fixes issue with production error: "fastmcp.exceptions.ToolError: Input
validation error: 'filename' is a required property"

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

Co-authored-by: letta-code <248085862+letta-code@users.noreply.github.com>
Co-authored-by: Letta <noreply@letta.com>
Co-authored-by: datadog-official[bot] <datadog-official[bot]@users.noreply.github.com>
Co-authored-by: Kian Jones <11655409+kianjones9@users.noreply.github.com>
2026-01-19 15:54:38 -08:00
github-actions[bot]
f67af1b13d fix: Handle ExceptionGroup errors in MCP client cleanup (#8561)
The MCP library internally uses TaskGroup for async operations, which can
raise ExceptionGroup when cleanup fails. This was causing unhandled errors
to propagate in production.

Changes:
- Update cleanup() method in AsyncBaseMCPClient to catch ExceptionGroup
  using except* syntax and log errors at debug level (best-effort cleanup)
- Remove redundant try/except blocks in mcp_manager.py and
  mcp_server_manager.py that incorrectly re-raised cleanup exceptions

Fixes #8560

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

Co-authored-by: letta-code <248085862+letta-code@users.noreply.github.com>
Co-authored-by: Letta <noreply@letta.com>
Co-authored-by: Kian Jones <11655409+kianjones9@users.noreply.github.com>
2026-01-19 15:54:38 -08:00
Ari Webb
282df3a3fe fix: increase limit for list mcp servers (#8674) 2026-01-19 15:54:38 -08:00
Ari Webb
3682f87cbf fix: fix pagination for blocks [LET-6359] (#8628)
fix: fix pagination for blocks
2026-01-19 15:54:38 -08:00
Sarah Wooders
bdede5f90c feat: add strict tool calling setting [LET-6902] (#8577) 2026-01-19 15:54:38 -08:00
jnjpng
979062114c chore: fix typo and improve MCP OAuth comments (#8629)
- Fix typo "upate" -> "update" in TODO comments (mcp_manager.py, mcp_server_manager.py)
- Improve comments in OAuth callback handler to explain why MCPOAuthSession
  is used directly (callback is unauthenticated, manager requires actor)
- Clean up variable naming in callback handler

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

Co-authored-by: Letta <noreply@letta.com>
2026-01-19 15:54:38 -08:00
cthomas
ab4ccfca31 feat: add tags support to blocks (#8474)
* feat: add tags support to blocks

* fix: add timestamps and org scoping to blocks_tags

Addresses PR feedback:

1. Migration: Added timestamps (created_at, updated_at), soft delete
   (is_deleted), audit fields (_created_by_id, _last_updated_by_id),
   and organization_id to blocks_tags table for filtering support.
   Follows SQLite baseline pattern (composite PK of block_id+tag, no
   separate id column) to avoid insert failures.

2. ORM: Relationship already correct with lazy="raise" to prevent
   implicit joins and passive_deletes=True for efficient CASCADE deletes.

3. Schema: Changed normalize_tags() from Any to dict for type safety.

4. SQLite: Added blocks_tags to SQLite baseline schema to prevent
   table-not-found errors.

5. Code: Updated all tag row inserts to include organization_id.

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

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

* fix: add ORM columns and update SQLite baseline for blocks_tags

Fixes test failures (CompileError: Unconsumed column names: organization_id):

1. ORM: Added organization_id, timestamps, audit fields to BlocksTags
   ORM model to match database schema from migrations.

2. SQLite baseline: Added full column set to blocks_tags (organization_id,
   timestamps, audit fields) to match PostgreSQL schema.

3. Test: Added 'tags' to expected Block schema fields.

This ensures SQLite and PostgreSQL have matching schemas and the ORM
can consume all columns that the code inserts.

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

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

* revert change to existing alembic migration

* fix: remove passive_deletes and SQLite support for blocks_tags

1. Removed passive_deletes=True from Block.tags relationship to match
   AgentsTags pattern (neither have ondelete CASCADE in DB schema).

2. Removed SQLite branch from _replace_block_pivot_rows_async since
   blocks_tags table is PostgreSQL-only (migration skips SQLite).

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

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

* api sync

---------

Co-authored-by: Letta <noreply@letta.com>
2026-01-19 15:54:38 -08:00
jnjpng
c550457b60 feat: static redirect callback for mcp server oauth (#8611)
* base

* base

* more

* final

* remove

* pass
2026-01-19 15:54:38 -08:00
jnjpng
089ea415ab fix: update test_tool_schema_parsing.py to use requests.post directly (#8625)
The `make_post_request` function was removed in commit b1bbf9aabf as
part of cleaning up unused sync code, but the test file still imported
it. This change replaces the removed function with direct `requests.post`
calls.

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

Co-authored-by: Letta <noreply@letta.com>
2026-01-19 15:54:37 -08:00
Kian Jones
6e803174f5 chore; bump ddtrace version (#8465)
* Revert "chore: temp revert to public ddtrace (#8462)"

This reverts commit 09e541b7732fdc03be4cd9c00cc2c8518300acf1.

* Update ddtrace version requirement in pyproject.toml

Removed specific ddtrace versions for profiling and updated to a minimum version requirement.
2026-01-19 15:54:37 -08:00
cthomas
870c5955d9 fix: wrap tpuf operations in thread pool (#8615)
* fix: wrap turbopuffer vector writes in thread pool

Turbopuffer library does CPU-intensive base64 encoding of vectors
synchronously in async functions (_async_transform_recursive →
b64encode_vector), blocking the event loop during file uploads.

Solution: Created _run_turbopuffer_write_in_thread() helper that runs
turbopuffer writes in an isolated event loop within a worker thread.

Applied to all vector write operations:
- insert_tools()
- insert_archival_memories()
- insert_messages()
- insert_file_passages()

This prevents pybase64.b64encode_as_string() from blocking the main
event loop during vector encoding.

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

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

* fix: wrap all turbopuffer operations in thread pool

Extended the thread pool wrapping to ALL turbopuffer write operations,
including delete operations, for complete isolation from the main event loop.

All turbopuffer namespace.write() calls now run in isolated event loops
within worker threads, preventing any potential CPU work from blocking.

🐾 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
cthomas
c05f3cec0b fix: wrap markitdown PDF processing in asyncio.to_thread (#8614)
MarkItDown.convert() does blocking file I/O and CPU-intensive PDF parsing.
This was blocking the event loop during file uploads.

Now wraps the entire markitdown pipeline (tempfile write, convert, cleanup)
in asyncio.to_thread() to run in thread pool.

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

Co-authored-by: Letta <noreply@letta.com>
2026-01-19 15:54:37 -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
cthomas
57cb2d7566 fix: async functions must call async methods (#8612)
Critical fixes:
- llm_client_base.send_llm_request() now calls await self.request_async() instead of self.request()
- Remove unused sync get_openai_embedding() that used sync OpenAI client
- Remove deprecated compile_in_thread_async() from Memory

These were blocking the event loop during LLM requests and embeddings.

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

Co-authored-by: Letta <noreply@letta.com>
2026-01-19 15:54:37 -08:00
Ari Webb
851798d71a fix: step_id is none (#8528) 2026-01-19 15:54:37 -08:00
jnjpng
aca5c99a2b feat: use fast mcp 2.0 oauth provider (#8608)
* base

* scopes
2026-01-19 15:54:37 -08:00
jnjpng
35ecf2279f chore: remove dead sync model validator code (#8606)
Remove commented-out sync_value_and_value_enc model validator and
unused imports (traceback, model_validator, logger). This code was
disabled and replaced with async decryption via from_orm_async methods.
2026-01-19 15:54:37 -08:00
Charles Packer
ff05f0e200 docs: pricing docs fix (#5791)
* fix: patch pricing

* fix: point out byok

* fix: updated

* fix: another boost
2026-01-19 15:54:23 -08:00
Shubham Naik
852e960d88 chore: regenerate api (#5624)
Co-authored-by: Shubham Naik <shub@memgpt.ai>
2026-01-19 15:53:10 -08:00
Cameron Pfiffer
399d04a3e1 feat: add shared memory block tutorial, update memory block guide (#5503)
feat: update documentation and add new tutorials for memory blocks and agent collaboration

- Updated navigation paths in docs.yml to reflect new tutorial locations.
- Added comprehensive guides on shared memory blocks and attaching/detaching memory blocks.
- Enhanced existing documentation for memory blocks with examples and best practices.
- Corrected API key references in prebuilt tools documentation.

These changes aim to improve user understanding and facilitate multi-agent collaboration through shared memory systems.
2026-01-19 15:52:23 -08:00
Sarah Wooders
b8a6496acb feat: add runs_metrics table (#5169) 2026-01-19 15:51:30 -08:00
Matthew Zhou
b824daec2f fix: Remove requirement for tool returns [LET-4715] (#5254)
* Keep legacy functionality

* Refactor for cleanliness
2026-01-19 15:47:07 -08:00
Kian Jones
2b29478c08 Kian/remove uv caching (#4903)
* remove enable cache

* trigger CI

* remove extra with paramters which I believe to be unecessary

* try installing uv manuallly to avoid post install step

* should be fixed by manually installing and not using the action

* remove comment to trigger
2026-01-19 15:43:57 -08:00
Charles Packer
265ec3b478 fix: update gh templates (#3155) 2026-01-18 13:50:17 -08:00
cthomas
67013ef1bb chore: bump version 0.16.2 (#3140) 2026-01-12 11:04:11 -08:00
Caren Thomas
a626dec278 uv lock 2026-01-12 11:00:12 -08:00
Ari Webb
6d859174c2 feat: make conversations throw http busy to stop race condition [LET-6842] (#8411)
* feat: make conversations throw http busy to stop race condition

* use redis lock instead

* move acquire lock into redis client, integration tests, move lock release into run manager

* fix tests, bug

* conditional import

* remove else

* better release

* run ci

* final reordering lock

* update tests

* wrong naming of lock holder token
2026-01-12 10:57:49 -08:00
jnjpng
59c2b19812 fix: remove sync model validator for env var (#8518)
* base

* import
2026-01-12 10:57:49 -08:00
cthomas
03a64993cf fix: make file reads async (#8513) 2026-01-12 10:57:49 -08:00