Commit Graph

40 Commits

Author SHA1 Message Date
Charles Packer
2fc592e0b6 feat(core): add image support in tool returns [LET-7140] (#8985)
* feat(core): add image support in tool returns [LET-7140]

Enable tool_return to support both string and ImageContent content parts,
matching the pattern used for user message inputs. This allows tools
executed client-side to return images back to the agent.

Changes:
- Add LettaToolReturnContentUnion type for text/image content parts
- Update ToolReturn schema to accept Union[str, List[content parts]]
- Update converters for each provider:
  - OpenAI Chat Completions: placeholder text for images
  - OpenAI Responses API: full image support
  - Anthropic: full image support with base64
  - Google: placeholder text for images
- Add resolve_tool_return_images() for URL-to-base64 conversion
- Make create_approval_response_message_from_input() async

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

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

* fix(core): support images in Google tool returns as sibling parts

Following the gemini-cli pattern: images in tool returns are sent as
sibling inlineData parts alongside the functionResponse, rather than
inside it.

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

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

* test(core): add integration tests for multi-modal tool returns [LET-7140]

Tests verify that:
- Models with image support (Anthropic, OpenAI Responses API) can see
  images in tool returns and identify the secret text
- Models without image support (Chat Completions) get placeholder text
  and cannot see the actual image content
- Tool returns with images persist correctly in the database

Uses secret.png test image containing hidden text "FIREBRAWL" that
models must identify to pass the test.

Also fixes misleading comment about Anthropic only supporting base64
images - they support URLs too, we just pre-resolve for consistency.

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

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

* refactor: simplify tool return image support implementation

Reduce code verbosity while maintaining all functionality:
- Extract _resolve_url_to_base64() helper in message_helper.py (eliminates duplication)
- Add _get_text_from_part() helper for text extraction
- Add _get_base64_image_data() helper for image data extraction
- Add _tool_return_to_google_parts() to simplify Google implementation
- Add _image_dict_to_data_url() for OpenAI Responses format
- Use walrus operator and list comprehensions where appropriate
- Add integration_test_multi_modal_tool_returns.py to CI workflow

Net change: -120 lines while preserving all features and test coverage.

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

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

* fix(tests): improve prompt for multi-modal tool return tests

Make prompts more direct to reduce LLM flakiness:
- Simplify tool description: "Retrieves a secret image with hidden text. Call this function to get the image."
- Change user prompt from verbose request to direct command: "Call the get_secret_image function now."
- Apply to both test methods

This reduces ambiguity and makes tool calling more reliable across different LLM models.

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

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

* fix bugs

* test(core): add google_ai/gemini-2.0-flash-exp to multi-modal tests

Add Gemini model to test coverage for multi-modal tool returns. Google AI already supports images in tool returns via sibling inlineData parts.

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

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

* fix(ui): handle multi-modal tool_return type in frontend components

Convert Union<string, LettaToolReturnContentUnion[]> to string for display:
- ViewRunDetails: Convert array to '[Image here]' placeholder
- ToolCallMessageComponent: Convert array to '[Image here]' placeholder

Fixes TypeScript errors in web, desktop-ui, and docker-ui type-checks.

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

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

---------

Co-authored-by: Letta <noreply@letta.com>
Co-authored-by: Caren Thomas <carenthomas@gmail.com>
2026-01-29 12:43:53 -08:00
cthomas
c2f13cf5fa feat: add seq id to error chunks (#8843) 2026-01-19 15:54:42 -08:00
cthomas
6b6ca91183 fix: remove letta ping schema override (#8790) 2026-01-19 15:54:41 -08:00
Christina Tong
f929d53cfe add msg id to search endpoint response [LET-6582] (#7236)
* add msg id to search endpoint response

* rename
2025-12-17 17:31:02 -08:00
Sarah Wooders
a721a00899 feat: add agent_id to search results (#6867) 2025-12-15 12:03:09 -08:00
cthomas
1be2f61f05 feat: add new letta error message stream response type (#6192) 2025-11-24 19:10:11 -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
Sarah Wooders
f61a4b8319 Revert "feat: add input data to pydantic validation error logging" (#5847)
Revert "feat: add input data to pydantic validation error logging (#5748)"

This reverts commit 0a61c0c2c1fa0e09867120af93f17ab6304a795f.
2025-11-13 15:36:14 -08:00
Kian Jones
0036976448 feat: add input data to pydantic validation error logging (#5748)
* idk letta coded lemme review in gh

* remove unused imports
2025-11-13 15:36:14 -08:00
cthomas
73dcc0d4b7 feat: latest hitl + parallel tool call changes (#5565) 2025-10-24 15:12:49 -07:00
cthomas
f8437d47e2 feat: add support for hitl parallel tool calling (#5549)
* feat: add support for hitl parallel tool calling

* rename to requested_tool_calls
2025-10-24 15:12:11 -07:00
Ari Webb
9e94c344b8 using uuid and datetime [LET-5508] (#5430)
* using uuid and datetime

* add run_id

---------

Co-authored-by: Ari Webb <ari@letta.com>
2025-10-24 15:12:11 -07:00
cthomas
6fd6232992 feat: add discriminator type to message return objects (#5318) 2025-10-24 15:11:31 -07:00
cthomas
8e54f40bde feat: add new ApprovalReturn list in api layer (#5304)
* feat: add new ApprovalReturn list in api layer

* use base class

* api sync
2025-10-24 15:11:31 -07:00
Matthew Zhou
45101fd97a feat: Add new tool_calls field to ToolCallMessage [LET-5333] (#5267)
* Add new tool_calls field to ToolCallMessage

* fern autogen
2025-10-09 13:20:52 -07:00
Matthew Zhou
d5de582561 feat: Add new multi tool return field [LET-5330] (#5264)
* Add new multi tool return field

* Fern autogen

* Add deprecated fields

* Run fern autogen
2025-10-09 13:20:52 -07:00
cthomas
6029c80446 fix: approval request for streaming (#4445)
* fix: approval request for streaming

* fix: claude code attempt, unit test passing (add on to #4445) (#4448)

* fix: claude code attempt, unit test passing

* chore: update locks to 0.1.314 from 0.1.312

* chore: just stage-api && just publish-api

* chore: drop dead poetry lock

---------

Co-authored-by: Charles Packer <packercharles@gmail.com>
2025-09-05 17:43:21 -07:00
cthomas
b95c60b106 feat: add new approval message types to letta message union [LET-4113] (#4311)
feat: add new approval message types to letta message union
2025-08-29 13:32:31 -07:00
cthomas
e0be1e028c feat: add new approval request message objects (#4291) 2025-08-28 16:44:48 -07:00
cthomas
5cd4f378d5 feat: add run id to stream response (#4152) 2025-08-25 09:43:45 -07:00
cthomas
39b2a20a7c feat: add optional seq id for chunks in stream (#4143) 2025-08-24 17:25:11 -07:00
Andy Li
eb3babc687 feat: ade support for showing errored messages in ade 2025-07-21 13:03:20 -07:00
Andy Li
b7b678db4e feat: stop reasons and error messages and sentry fixes 2025-07-18 11:56:20 -07:00
Charles Packer
bbcc948213 fix: fix pywright lint errors caused by bad use of pydantic (#3170) 2025-07-06 12:58:21 -07:00
cthomas
9722596a74 feat: add step id on letta message (#1974) 2025-05-01 11:21:59 -07:00
cthomas
eaf9af3d03 feat: add identity id to message model (#1700) 2025-04-14 16:50:37 -07:00
cthomas
9458f40d05 feat: add otid field for message idempotency (#1556) 2025-04-04 08:43:01 -07:00
Matthew Zhou
3ba79db859 feat: Enable Anthropic streaming on new agent loop (#1550) 2025-04-03 19:40:48 -07:00
cthomas
831f7d2f11 feat: add sonnet 3.7 support (#1302) 2025-03-24 16:36:16 -10:00
cthomas
aa2f4258c4 feat: add content parts to message schema (#1273)
Co-authored-by: Matt Zhou <mattzh1314@gmail.com>
2025-03-13 18:43:32 -07:00
cthomas
588c212039 chore: message schema api improvements (#1267) 2025-03-13 12:04:03 -07:00
Sarah Wooders
4aeaec3523 feat: modify message modification route to be via LettaMessage (#1184) 2025-03-06 15:33:16 -08:00
cthomas
11d871785a feat: add content union type for requests (#762) 2025-01-23 20:25:00 -08:00
Sarah Wooders
cc638e3593 chore: remove old OpenAI routers (#717) 2025-01-22 19:04:40 -08:00
cthomas
df00fd2210 fix: manually expose LettaMessageUnion in openapi spec (#682) 2025-01-16 13:19:35 -08:00
cthomas
c183fc6b0e feat: rename internal monologue (#2289) 2024-12-19 15:16:36 -08:00
cthomas
7d5be32a59 feat: rename function to tool in sdk (#2288)
Co-authored-by: Caren Thomas <caren@caren-mac.local>
2024-12-19 12:12:58 -08:00
cthomas
68792caec2 feat: add logs to response for tool run (#2205)
Co-authored-by: Caren Thomas <caren@caren-mac.local>
2024-12-10 13:24:05 -08:00
Charles Packer
8a9e6dddd3 feat: add function IDs to LettaMessage function calls and response (#1909) 2024-10-19 21:47:48 -07:00
Sarah Wooders
8ae1e64987 chore: migrate package name to letta (#1775)
Co-authored-by: Charles Packer <packercharles@gmail.com>
Co-authored-by: Shubham Naik <shubham.naik10@gmail.com>
Co-authored-by: Shubham Naik <shub@memgpt.ai>
2024-09-23 09:15:18 -07:00