feat: conversation-aware memory extraction for Agent.kickoff()

When Agent.kickoff() completes, the overridden _save_to_memory now
includes the full conversation history (up to 20 turns) alongside
task metadata and the final result. This produces significantly
better memory extraction for standalone agent sessions where the
conversation thread carries important context.

The base _save_to_memory (used by Crew-based execution) remains
unchanged since each Task already encodes its own context.

Inspired by Iris's memory service which proved that thread-context-
aware extraction is dramatically more accurate than single-content
extraction.

Tests: 8 new tests covering conversation inclusion, task metadata,
fallback behavior, read-only memory, truncation, and scoped saves.
This commit is contained in:
Joao Moura
2026-04-25 17:48:32 -07:00
parent cb46a1c4ba
commit 62d097a761
3 changed files with 318 additions and 1 deletions

2
uv.lock generated
View File

@@ -13,7 +13,7 @@ resolution-markers = [
]
[options]
exclude-newer = "2026-04-22T16:00:00Z"
exclude-newer = "2026-04-23T07:00:00Z"
[manifest]
members = [