OptionalageOptionalmemoryAdds a memory to the agent's long-term memory.
The content of the memory to add.
Optionalnow: DateOptional current date.
Optionalmetadata: Record<string, unknown>Optional metadata for the memory.
Optionalcallbacks: anyOptional Callbacks instance.
The result of adding the memory to the agent's long-term memory.
Generates a dialogue response to the given observation.
The observation to generate a dialogue response for.
Optionalnow: DateOptional current date.
A boolean indicating whether to continue the dialogue and the output string.
Generates a reaction to the given observation.
The observation to generate a reaction for.
Optionalnow: DateOptional current date.
A boolean indicating whether to continue the dialogue and the output string.
Extracts the action of the given entity from the given observation.
The observation to extract the action from.
The name of the entity to extract the action for.
OptionalrunManager: anyOptional CallbackManagerForChainRun instance.
The extracted action as a string.
Extracts the observed entity from the given observation.
The observation to extract the entity from.
OptionalrunManager: anyOptional CallbackManagerForChainRun instance.
The extracted entity as a string.
Returns a full header of the agent's status, summary, and current time.
Optional configuration object with current date and a boolean to force refresh.
OptionalforceOptionalnow?: DateThe full header as a string.
Gets the agent's summary, which includes the agent's name, age, traits, and a summary of the agent's core characteristics. The summary is updated periodically through probing the agent's memories.
Optionalconfig: { Optional configuration object with current date and a boolean to force refresh.
OptionalforceOptionalnow?: DateOptionalrunManager: anyOptional CallbackManagerForChainRun instance.
The agent's summary as a string.
Return a json-like object representing this chain.
Summarizes memories that are most relevant to an observation.
The observation to summarize related memories for.
OptionalrunManager: anyOptional CallbackManagerForChainRun instance.
The summarized memories as a string.
StaticdeserializeLoad a chain from a json-like object describing it.
Implementation of a generative agent that can learn and form new memories over time. It extends the BaseChain class, which is a generic sequence of calls to components, including other chains.
Example