Commit Graph

35 Commits

Author SHA1 Message Date
MagMueller 51598efd56 Trim HistoryItem freeze change tests 2026-05-23 12:20:55 -07:00
Saurav Panda 8236cc7506 agent(history): freeze HistoryItem + lock byte-prefix property in tests
For Gemini's implicit cache (and similar provider caches) to actually
hit step over step, the rendered transcript for steps 1..N-1 must be
byte-identical at step N and at step N+1. The agent already appends
HistoryItems immutably in practice, but nothing in the type prevented
a future caller from mutating one in place — which would silently kill
the cache from that byte onward.

Mark HistoryItem frozen so any mutation now fails loud at runtime
rather than slowly burning input tokens. Add a regression test set
that asserts the cache property directly:

- render(items[:N]) must be a strict byte-prefix of render(items[:N+1])
- to_string() is deterministic for identical inputs
- the prefix property holds across mixed entry shapes (normal steps,
  errors, system messages, follow-up tasks)
- conditional field inclusion doesn't collapse to ambiguous output

Known limitation, not addressed here: max_history_items compaction in
MessageManager.agent_history_description rewrites earlier bytes once
the cap is exceeded (the omitted-count message changes). That's a
larger redesign and deserves its own PR.
2026-05-22 17:55:43 -07:00
Saurav Panda 6b9910a546 changed the threshold for compaction 2026-02-05 16:41:08 -08:00
Saurav Panda 79501fe2cd added message compaction for agent 2026-02-05 12:26:11 -08:00
Mert Unsal 02cf38e864 Revert "allowing MUCH MORE with coordinates" 2025-11-28 04:00:22 -08:00
mertunsall 46cb1a0ae1 allowing MUCH MORE with coordinates 2025-11-27 14:48:23 -08:00
mertunsall 03c9e94dc6 allow reading images such as jpg/png, as well as docx, fixes to the flash system prompt 2025-11-03 16:41:27 -08:00
Magnus Müller d1d313f0f4 Remove </step> - 3 tokens x number of steps taken 2025-10-12 13:08:05 -07:00
Magnus Müller 71c848c8ef fix followup tasks 2025-09-07 18:15:12 -07:00
Magnus Müller c3d0c800a2 Refactor agent prompts for clarity and consistency
- Updated page info text format to enhance readability and structure.
- Changed date format in agent state description to display only the current date.
- Simplified action results formatting in message manager for better clarity.
- Adjusted history item string representation to streamline output and remove unnecessary prefixes.
2025-08-31 19:20:45 -07:00
mertunsall bc9a3a5fbb just improve 2025-08-05 15:07:50 +01:00
mertunsall eb833d34d9 now history is cached 2025-07-23 19:08:50 +02:00
mertunsall d490087a28 FLASH MODE 2025-07-12 21:46:48 +02:00
Magnus Müller 6f221ec504 Refactor message management to categorize messages by type. Updated methods to handle system, state, and consistent messages separately, improving message retrieval and organization. 2025-07-08 23:09:38 +02:00
Magnus Müller 6cbace0321 Remove remove message 2025-07-08 22:47:11 +02:00
mertunsall 63c0f5d086 convert to pydantic 2025-07-01 12:32:54 +02:00
mertunsall 2c465a898a - Introduce a max_history_items parameter to limit the memory of the model
- changed the system messages to have <sys> tag instead of <s> to avoid confusion with HTML
-  Got rid of MessageMetadata, SupportedMessageTypes and implemented cleaner MessageManagerState
- Implemented a HistoryItem class to cleanly reconstruct agent history description
2025-07-01 12:04:27 +02:00
mertunsall fa60e747d9 mr cloudrunner 2025-06-24 23:02:08 +02:00
Gregor Žunič 7a10ae0c96 Squashed commit langchain to native 2025-06-24 12:26:55 +02:00
Nick Sweeting 66b3c26df5 add pyupgrade to lint rules 2025-05-02 15:21:23 +08:00
Nick Sweeting da0c383988 ignore langchain beta warnings 2025-03-30 14:55:42 -07:00
Deshraj Yadav 55e5e2168e Add support for procedural memory 2025-03-28 19:05:21 -07:00
Nick Sweeting fb6fa259a8 apply ruff safe fixes 2025-03-28 18:11:36 -07:00
Nick Sweeting b892b75fdc update dev setup docs 2025-03-28 01:11:10 -07:00
மனோஜ்குமார் பழனிச்சாமி 3bd1218aa6 Ignore LangChainBetaWarning 2025-03-23 11:56:59 +05:30
Magnus Müller ddd8648aaa Refactor message position handling and improve last step messaging
- Update `_add_message_with_tokens` and `add_message` methods to support `None` as default position
- Modify last step warning message in agent service
- Add logging for last step completion
- Improve type hints for message position parameters
2025-02-23 07:03:01 -08:00
Magnus Müller b6e18197a5 Rename total_tokens to current_tokens in message history tracking 2025-02-22 22:31:37 -08:00
Matic Zavadlal 4ccd22d6df Update views.py 2025-02-14 22:05:02 +01:00
Matic Zavadlal af76a92570 stash 2025-02-14 21:55:20 +01:00
Gregor Žunič ded606a233 outsource state 2025-02-13 22:32:18 -08:00
Gregor Žunič aa19548eff outsourced state v1 2025-02-13 21:48:00 -08:00
magmueller b88c177d1c Added planer to comine gpt4o with o3 mini 2025-02-03 14:17:38 -08:00
magmueller c4ee7db940 Message manager 2024-11-24 19:55:55 +01:00
magmueller 29668a6840 Mesage manager cut if too long 2024-11-24 02:01:34 +01:00
magmueller 8a90a8855a Work in progress - message manager 2024-11-22 10:32:37 +01:00