Commit Graph

54 Commits

Author SHA1 Message Date
Kian Jones
a92e868ee6 feat: centralize telemetry logging at LLM client level (#8815)
* feat: centralize telemetry logging at LLM client level

Moves telemetry logging from individual adapters to LLMClientBase:
- Add TelemetryStreamWrapper for streaming telemetry on stream close
- Add request_async_with_telemetry() for non-streaming requests
- Add stream_async_with_telemetry() for streaming requests
- Add set_telemetry_context() to configure agent_id, run_id, step_id

Updates adapters and agents to use new pattern:
- LettaLLMAdapter now accepts agent_id/run_id in constructor
- Adapters call set_telemetry_context() before LLM requests
- Removes duplicate telemetry logging from adapters
- Enriches traces with agent_id, run_id, call_type metadata

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

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

* fix: accumulate streaming response content for telemetry

TelemetryStreamWrapper now extracts actual response data from chunks:
- Content text (concatenated from deltas)
- Tool calls (id, name, arguments)
- Model name, finish reason, usage stats

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

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

* refactor: move streaming telemetry to caller (option 3)

- Remove TelemetryStreamWrapper class
- Add log_provider_trace_async() helper to LLMClientBase
- stream_async_with_telemetry() now just returns raw stream
- Callers log telemetry after processing with rich interface data

Updated callers:
- summarizer.py: logs content + usage after stream processing
- letta_agent.py: logs tool_call, reasoning, model, usage

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

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

* fix: pass agent_id and run_id to parent adapter class

LettaLLMStreamAdapter was not passing agent_id/run_id to parent,
causing "unexpected keyword argument" errors.

🐙 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:43 -08:00
Sarah Wooders
ef0f8e20d9 fix: improve summarization prompts (#8764) 2026-01-19 15:54:41 -08:00
cthomas
c3276dda17 fix: summarization drops reasoning content mid turn [LET-7039] (#8769)
fix: summarization drops reasoning content mid turn
2026-01-19 15:54:41 -08:00
Sarah Wooders
e2c6550363 fix: include assistant response in sliding window summarization slice (#8749) 2026-01-19 15:54:41 -08:00
Sarah Wooders
c675c289ef feat: add more summary logging (#7405) 2026-01-12 10:57:19 -08:00
Sarah Wooders
f1bd246e9b feat: use token streaming for anthropic summarization (#7105) 2025-12-17 17:31:02 -08:00
Ari Webb
4878b49fa1 chore: bounds check for assistant message index (#7070) 2025-12-17 17:31:02 -08:00
Sarah Wooders
bd9f3aca9b fix: fix prompt_acknowledgement usage and update summarization prompts (#7012) 2025-12-15 12:03:09 -08:00
Sarah Wooders
a731e01e88 fix: use model instead of model_settings (#6834) 2025-12-15 12:03:09 -08:00
Sarah Wooders
7ea297231a feat: add compaction_settings to agents (#6625)
* initial commit

* Add database migration for compaction_settings field

This migration adds the compaction_settings column to the agents table
to support customized summarization configuration for each agent.

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

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

* fix

* rename

* update apis

* fix tests

* update web test

---------

Co-authored-by: Letta <noreply@letta.com>
Co-authored-by: Kian Jones <kian@letta.com>
2025-12-15 12:02:34 -08:00
Sarah Wooders
70c57c5072 fix: various patches to summarizer (#6597) 2025-12-15 12:02:34 -08:00
Sarah Wooders
bbd52e291c feat: refactor summarization and message persistence code [LET-6464] (#6561) 2025-12-15 12:02:34 -08:00
cthomas
a7c0bad857 fix: unbound var in summarization [LET-6484] (#6568)
* fix: unbound var in summarization

* fix indentation
2025-12-15 12:02:34 -08:00
cthomas
6fd73d4dcf chore: add more summarize tracing (#6532) 2025-12-15 12:02:33 -08:00
Sarah Wooders
90e2030f41 fix: fix manual summarization (#6466) 2025-12-15 12:02:19 -08:00
Sarah Wooders
bd97b23025 feat: fallback to all mode for summarizer if error (#6465) 2025-12-15 12:02:19 -08:00
Sarah Wooders
91e3dd8b3e feat: fix new summarizer code and add more tests (#6461) 2025-12-15 12:02:19 -08:00
Sarah Wooders
c0b422c4c6 fix: patch summarizer and add tests (#6457) 2025-12-15 12:02:19 -08:00
Sarah Wooders
1939a9d185 feat: patch summarizer without changes to AgentState (#6450) 2025-12-15 12:02:19 -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
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
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
c81fded806 chore: dump payload on error (#5918)
dump payload on error
2025-11-13 15:36:39 -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
c2e474e03a feat: refactor logs to parse as a single log line each and filter out 404s from sentry (#5242)
* add multiline log auto detect

* implement logger.exception()

* filter out 404

* remove potentially problematic changes
2025-10-24 15:11:31 -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
Charles Packer
1c7448eb9d fix: patch remaining failing send_message CI tests (#4974)
* fix: patch failing summarizer tests for anthropic claude 3.5

* fix: carveout for gemini-2.5-flash because it doesn't do the send_message tool call

* fix: deprecate old gemini test now that model is unavailable

* fix: deprecate old gemini test now that model is unavailable

* fix: deprecate old gemini test now that model is unavailable

* fix: patch flash flakiness

* fix: relax the gemini 2.5 flash test

* fix: relax the gemini 2.5 flash test

* fix: relax again

* fix: another flash fix

* fix: relax gpt-4o-mini

* fix: swap 4o-mini for 4.1

* fix: drop 4o-mini
2025-10-07 17:50:46 -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
Matthew Zhou
acaf820009 feat: Add project_id to message filtering/inserting to Turbopuffer [LET-4252] (#4466)
* Add project_id

* Fern autogen
2025-09-08 14:35:15 -07:00
Matthew Zhou
2ef47d8002 feat: Add search messages endpoint [LET-4144] (#4434)
* Add search messages endpoint

* Run fern autogen and fix tests
2025-09-05 14:28:27 -07:00
Matthew Zhou
cbf2e09e13 feat: Add project id to message schema [LET-4166] (#4433)
* Add project id

* Propogate through update message by id async

* Add project id testing
2025-09-04 16:50:41 -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
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
Sarah Wooders
f10f27a9ce fix: avoid using summarization agent when not using voice (#4097) 2025-08-25 13:23:24 -07:00
Sarah Wooders
ea26680674 fix: add handling for summarizer llm call (#4028) 2025-08-20 16:25:02 -07:00
jnjpng
fb474c4ac9 fix: require function declarations to be present for setting gemini tool config
Co-authored-by: Jin Peng <jinjpeng@Jins-MacBook-Pro.local>
2025-08-19 12:56:31 -07:00
Charles Packer
3fae6725c3 refactor: revert the default summarizer to the old style (#3168) 2025-07-06 20:15:22 -07:00
Andy Li
32f2cf17b5 feat: expand summarizer providers 2025-07-01 15:07:38 -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
Matthew Zhou
87f4bcad9a feat: Add summarization for more scenarios (#2499) 2025-05-29 11:10:13 -07:00
cthomas
4e08ab26e7 chore: add tracing to summarizer (#2515) 2025-05-28 23:40:35 -07:00
Matthew Zhou
2a6265b8de feat: Add static summarization to new agent loop (#2492) 2025-05-28 12:53:48 -07:00
Andy Li
a45739444f fix: summarization includes tool call message before truncation (#2084)
Co-authored-by: Sarah Wooders <sarahwooders@gmail.com>
2025-05-09 15:01:12 -07:00
Matthew Zhou
c567f3ff40 feat: Move sleeptime voice agent to new agent loop (#1979) 2025-05-01 20:48:33 -07:00
Matthew Zhou
28903be4d5 test: Add tests for summarizer enumeration (#1952) 2025-04-30 16:26:49 -07:00
Matthew Zhou
df175890bd feat: Adjust ephemeral memory agent to become persisted sleeptime agent (#1943) 2025-04-30 11:14:19 -07:00
Sarah Wooders
440df34f16 fix: fix docker image (#1920) 2025-04-28 20:59:07 -07:00