Commit Graph

70 Commits

Author SHA1 Message Date
Ari Webb
5c6ca705f1 Revert "feat: bring back use message packing for timezone [LET-6846]" (#9302)
Revert "feat: bring back use message packing for timezone [LET-6846] (#9256)"

This reverts commit c5017cccdef95b84fc585b26a0ddc5b7e44eb7c9.
2026-02-24 10:52:06 -08:00
Ari Webb
426f6a8ca4 feat: bring back use message packing for timezone [LET-6846] (#9256)
* feat: bring back use message packing for timezone

* add tests
2026-02-24 10:52:06 -08:00
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
efac48e9ea feat: add zai proxy LET-6543 (#6836)
feat: add zai proxy
2025-12-15 12:03:09 -08:00
cthomas
b3561631da feat: create agents with default project for proxy [LET-6488] (#6716)
* feat: create agents with default project for proxy

* make change less invasive
2025-12-15 12:02:53 -08:00
Sarah Wooders
f417e53638 fix: fix cancellation issues without making too many changes to message_ids persistence (#6442) 2025-12-15 12:02:19 -08:00
cthomas
fa9ec1ee9c fix: missing name in tool return (#6381)
* fix: missing name in tool return

* add empty check
2025-11-26 14:39:39 -08:00
cthomas
4bb116f17c fix: sync api call in message path (#6291)
* fix: sync api call in message path

* remove unused function

* add new error type
2025-11-24 19:10:26 -08:00
cthomas
bb38da7f95 feat: add initial anthropic proxy prototype (#6233)
* feat: add initial anthropic proxy prototype

* prevent api sync
2025-11-24 19:09:33 -08:00
Charles Packer
363a5c1f92 fix: fix poison state from bad approval response (#5979)
* fix: detect and fail on malformed approval responses

* fix: guard against None approvals in utils.py

* fix: add extra warning

* fix: stop silent drops in deserialize_approvals

* fix: patch v3 stream error handling to prevent sending end_turn after an error occurs, and ensures stop_reason is always set when an error occurs

* fix: Prevents infinite client hangs by ensuring a terminal event is ALWAYS sent

* fix:  Ensures terminal events are sent even if inner stream generator fails to
  send them
2025-11-13 15:36:55 -08:00
Charles Packer
4b371dd6fb fix(core): patch bug w/ sleeptime agents and client-side tool executions [LET-6081] (#6001)
* fix(core): patch bug w/ sleeptime agents and client-side tool executions

* fix: add groupid to approvalcreate

* chore: just stage-api && just publish-api
2025-11-13 15:36:55 -08:00
cthomas
6b37ef2cb7 fix: special otid handling for approval request (#5726) 2025-10-24 15:14:31 -07:00
cthomas
7b2e7e2f4c feat: remove un-paginated message list on usage stats [LET-5747] (#5599)
feat: remove un-paginated message list on usage stats
2025-10-24 15:13:15 -07: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
cthomas
69b15d606c feat: support approval requests for parallel tool calls (#5538) 2025-10-24 15:12:11 -07:00
cthomas
505c9cff57 feat: add testing for new hitl paths (#5493) 2025-10-24 15:12:11 -07:00
jnjpng
bcfc94846d fix: include run_id and step_id in temporal agent workflow [LET-5387] (#5429)
* base

* update

* fix: temporal agent workflow usage statistics [LET-5516] (#5436)

* base

* clean up comment

* remove import

---------

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

---------

Co-authored-by: Letta Bot <noreply@letta.com>
2025-10-24 15:12:11 -07:00
Matthew Zhou
bb8a7889e0 feat: Add parallel tool call streaming for anthropic [LET-4601] (#5225)
* wip

* Fix parallel tool calling interface

* wip

* wip adapt using id field

* Integrate new multi tool return schemas into parallel tool calling

* Remove example script

* Reset changes to llm stream adapter since old agent loop should not enable parallel tool calling

* Clean up fallback logic for extracting tool calls

* Remove redundant check

* Simplify logic

* Clean up logic in handle ai response

* Fix tests

* Write anthropic dict conversion to be back compatible

* wip

* Double write tool call id for legacy reasons

* Fix override args failures

* Patch for approvals

* Revert comments

* Remove extraneous prints
2025-10-24 15:11:31 -07:00
cthomas
3128b5e126 feat: add client side tool calling support (#5313) 2025-10-24 15:11:31 -07:00
Matthew Zhou
0f27bf5bdd feat: Support writing packed func return to ToolReturn object (#5209)
* wip

* Add func_response to ToolReturn object

* Fix response packaging

* Backpopulate in to_pydantic

* Fix ordering of packaging

* Add more checks
2025-10-07 17:50:50 -07:00
Matthew Zhou
20ce885e07 feat: Simplify create_letta_messages_from_llm_response [LET-4681] (#5204)
Simplify create_letta_messages_from_llm_response
2025-10-07 17:50:50 -07:00
Matthew Zhou
f2d4d01daa feat: Persist tool call id to ToolReturn (#5193)
Add tool call id
2025-10-07 17:50:49 -07:00
Charles Packer
10a301cc4b fix: use new agent loop in hitl test (#5145)
* feat: rewrite hitl test with new agent loop

* fix: codex changes (#5144)

---------

Co-authored-by: Caren Thomas <carenthomas@gmail.com>
2025-10-07 17:50:49 -07:00
Sarah Wooders
ef07e03ee3 feat: add run_id to input messages and step_id to messages (#5099) 2025-10-07 17:50:48 -07:00
Sarah Wooders
354205f581 feat: create new runs table [LET-4467] (#4841) 2025-10-07 17:50:47 -07:00
Charles Packer
a4041879a4 feat: add new agent loop (squash rebase of OSS PR) (#4815)
* feat: squash rebase of OSS PR

* fix: revert changes that weren't on manual rebase

* fix: caught another one

* fix: disable force

* chore: drop print

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

* fix: make agent_type consistently an arg in the client

* fix: patch multi-modal support

* chore: put in todo stub

* fix: disable hardcoding for tests

* fix: patch validate agent sync (#4882)

patch validate agent sync

* fix: strip bad merge diff

* fix: revert unrelated diff

* fix: react_v2 naming -> letta_v1 naming

* fix: strip bad merge

---------

Co-authored-by: Kevin Lin <klin5061@gmail.com>
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
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
cthomas
315d07568b feat: handle message persistence for approvals flows (#4338) 2025-09-01 14:10:02 -07:00
cthomas
1edcc13778 feat: support filtering out messages when converting to openai dict (#4337)
* feat: support filtering out messages when converting to openai dict

* fix imports
2025-09-01 12:48:45 -07:00
cthomas
8d1389146a feat: support deny tool call request (#4334) 2025-09-01 10:33:18 -07:00
cthomas
86b073d726 feat: support approve tool call request (#4333) 2025-08-31 11:26:21 -07:00
cthomas
b8c2f42d33 feat: add support for approval request creation (#4313) 2025-08-29 15:23:02 -07:00
Kian Jones
fecf6decfb chore: migrate to ruff (#4305)
* base requirements

* autofix

* Configure ruff for Python linting and formatting

- Set up minimal ruff configuration with basic checks (E, W, F, I)
- Add temporary ignores for common issues during migration
- Configure pre-commit hooks to use ruff with pass_filenames
- This enables gradual migration from black to ruff

* Delete sdj

* autofixed only

* migrate lint action

* more autofixed

* more fixes

* change precommit

* try changing the hook

* try this stuff
2025-08-29 11:11:19 -07:00
Andy Li
dc8b8bf4e4 fix: overwritten sentry capture fixes 2025-07-21 13:27:17 -07:00
cthomas
810628acd9 feat: remove organization from pydantic message model (#3411) 2025-07-19 09:28:54 -07:00
Andy Li
60c4e23904 feat: stop reasons and error messages and sentry fixes 2025-07-18 11:56:20 -07:00
Andy Li
04e9f43220 chore: strings lint cleanup (#3374) 2025-07-18 09:20:45 -07:00
Matthew Zhou
a31826d7a5 feat: Override heartbeat request when system forces step exit (#3015) 2025-06-24 19:50:00 -07:00
Sarah Wooders
4deb6e17a9 feat: add ability to configure agent timezone (#2978)
Co-authored-by: Kian Jones <kian@letta.com>
2025-06-24 12:57:37 -07:00
Matthew Zhou
b8057d804f feat: Add required before exit tool rule (#2977) 2025-06-23 17:02:40 -07:00
Andy Li
33bfd14017 fix: metric tracking (#2785) 2025-06-13 13:53:10 -07:00
Andy Li
d2252f2953 feat: otel metrics and expanded collecting (#2647)
(passed tests in last run)
2025-06-05 17:20:14 -07:00
cthomas
904ccd65b6 fix: remove separate tool call id in streaming path (#2641) 2025-06-04 17:35:55 -07:00
Sarah Wooders
8133a5a158 feat: add MCP servers into a table and MCP tool execution to new agent loop (#2323)
Co-authored-by: Matt Zhou <mattzh1314@gmail.com>
Co-authored-by: Kian Jones <11655409+kianjones9@users.noreply.github.com>
2025-05-23 16:22:16 -07:00
Andy Li
a78abc610e feat: track llm provider traces and tracking steps in async agent loop (#2219) 2025-05-19 15:50:56 -07:00
cthomas
0e2291434e fix: don't log null values to otel (#2079) 2025-05-08 15:27:55 -07:00
cthomas
832de7a246 feat: add llm config to ttfs logging (#1998) 2025-05-02 17:41:43 -07:00
cthomas
1b4bb8c960 feat: add time to first token in tracing (#1988) 2025-05-02 13:05:59 -07:00