Memory¶
Data structures for episodic memory.
Episode
¶
Bases: BaseModel
A completed task to be stored in memory.
Attributes:
| Name | Type | Description |
|---|---|---|
task |
Task
|
The task that was executed. |
rollout |
str
|
The full agent trajectory for the task. |
result |
TaskResult
|
The final result of the task. |
additional_data |
dict[str, str] | None
|
Optional key-value
annotations added by memory strategies at write time (e.g.
|
completed_at |
datetime
|
Timestamp when the episode was recorded. |
Source code in src/llm_agents_from_scratch/data_structures/memory.py
format
¶
Serialise the episode for prompt injection or embedding.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
mode
|
Literal['xml', 'concat']
|
|
'xml'
|
include
|
list[EpisodeAttr] | None
|
Attributes to include.
Defaults to |
None
|
Returns:
| Name | Type | Description |
|---|---|---|
str |
str
|
Serialised episode string. |