EpisodeHooks
@daydreamsai/core / EpisodeHooks
Interface: EpisodeHooks<TContext>
Defined in: packages/core/src/memory/types.ts:510
Type Parameters
TContext
TContext extends AnyContext = AnyContext
Properties
actionResultRedactor()?
optionalactionResultRedactor: (data) =>any
Defined in: packages/core/src/memory/types.ts:568
Optional redactor for action_result data. If provided, overrides size-based truncation.
Parameters
data
any
Returns
any
includeRefs?
optionalincludeRefs: ("output"|"run"|"thought"|"step"|"input"|"action_call"|"action_result"|"event")[]
Defined in: packages/core/src/memory/types.ts:560
Control which log refs are allowed to be stored in episodes. If omitted, defaults to ['input','output','action_call','action_result','event'] (excludes 'thought').
maxActionResultBytes?
optionalmaxActionResultBytes:number
Defined in: packages/core/src/memory/types.ts:565
Max size (in bytes) allowed for action_result.data before truncation/redaction (default: 4096).
Methods
classifyEpisode()?
optionalclassifyEpisode(episodeData,contextState):string
Defined in: packages/core/src/memory/types.ts:576
Called to classify the type of episode (optional)
Parameters
episodeData
any
The episode data from createEpisode
contextState
ContextState<TContext>
Current context state
Returns
string
Episode type/classification string
createEpisode()?
optionalcreateEpisode(logs,contextState,agent):undefined|CreateEpisodeResult|Episode|Promise<undefined|CreateEpisodeResult|Episode>
Defined in: packages/core/src/memory/types.ts:548
Called to create episode data from collected logs
Parameters
logs
AnyRef[]
Array of logs that make up this episode
contextState
ContextState<TContext>
Current context state
agent
Agent instance
Returns
undefined | CreateEpisodeResult | Episode | Promise<undefined | CreateEpisodeResult | Episode>
Episode data to be stored
extractMetadata()?
optionalextractMetadata(episodeData,logs,contextState):Record<string,any>
Defined in: packages/core/src/memory/types.ts:588
Called to extract additional metadata for the episode (optional)
Parameters
episodeData
any
The episode data from createEpisode
logs
AnyRef[]
The original logs for this episode
contextState
ContextState<TContext>
Current context state
Returns
Record<string, any>
Metadata object
shouldEndEpisode()?
optionalshouldEndEpisode(ref,workingMemory,contextState,agent):boolean|Promise<boolean>
Defined in: packages/core/src/memory/types.ts:534
Called to determine if the current episode should be ended and stored
Parameters
ref
The current log reference being processed
workingMemory
Current working memory state
contextState
ContextState<TContext>
Current context state
agent
Agent instance
Returns
boolean | Promise<boolean>
true if the current episode should be stored
shouldStartEpisode()?
optionalshouldStartEpisode(ref,workingMemory,contextState,agent):boolean|Promise<boolean>
Defined in: packages/core/src/memory/types.ts:519
Called to determine if a new episode should be started
Parameters
ref
The current log reference being processed
workingMemory
Current working memory state
contextState
ContextState<TContext>
Current context state
agent
Agent instance
Returns
boolean | Promise<boolean>
true if a new episode should start