Skip to content

agent

Agent resource settings

Attributes

EPISODIC_COLLECTION_NAME_SUFFIX module-attribute

EPISODIC_COLLECTION_NAME_SUFFIX = '_episodic'

Classes

AgentMemorySettings

Bases: BaseDataModel

Memory settings for an agent.

Attributes:

  • enabled (bool) –

    When true, agent memory features are enabled.

  • default_episodic (str) –

    Name of the default episodic memory collection that is used for agent memory. The memory collection name must belong to the agent.

Attributes

default_episodic class-attribute instance-attribute
default_episodic: str = Field(
    default="",
    title="Default Episodic Memory Collection",
    description="Name of the default episodic memory collection that is used for agent memory. The memory collection name must belong to the agent.",
)
enabled class-attribute instance-attribute
enabled: bool = Field(
    default=False,
    title="Agent Memory Enabled",
    description="When true, agent memory features are enabled.",
)
model_config class-attribute instance-attribute
model_config = ConfigDict(
    populate_by_name=True,
    use_enum_values=True,
    extra="ignore",
    strict=False,
)

Functions

episodic_name staticmethod
episodic_name(agent_name: str) -> str

Generates the episodic memory collection name for an agent.

Parameters:

  • agent_name (str) –

    Agent name

Returns:

  • str ( str ) –

    Episodic memory collection name

AgentResourceSettings

Bases: BaseDataModel

Agent resource settings

Attributes:

  • agent_memory (AgentMemorySettings) –

    Agent memory settings

  • persona (Persona) –

    Agent persona definition

  • dynamic_persona (bool) –

    Flag to enable dynamic value features. When true, once the agent has enough memory history it will stop using its default persona and instead use a generated persona based on its memories. When generating a dynamic persona, the original persona is still used as a component in the generation process.

  • dynamic_persona_min_memories (int) –

    The minimum number of memories needed to generate and save a dynamic persona. If the agent does not meet this minimum number of memories then the default persona will be used.

  • dynamic_persona_max_memories (int) –

    The maximum number of memories that can be returned when generating a dynamic persona. If the agent has more memories then this maximum then the most recently accessed memories will be returned first.

  • dynamic_persona_interval (TimeDeltaModel) –

    A Python timedelta object that controls how often the dynamic persona is updated. Default value is 1 day.

  • time_aware (bool) –

    Flag to enable time awareness features. When true, the current date and time will be sent via a system header to the LLM during inferencing. Additionally, when forming observational memories the corresponding prompt will get augmented with the current date and time.

  • timezone (str) –

    Paired with the time_aware settings, this is the timezone used to generate agent chat and memory timestamps. This setting has no effect when time_aware is False. When time_aware is True and this setting is None then the default backend timezone is used.

Attributes

agent_memory class-attribute instance-attribute
agent_memory: AgentMemorySettings = Field(
    default_factory=AgentMemorySettings, description=__doc__
)
dynamic_persona class-attribute instance-attribute
dynamic_persona: bool = Field(
    default=True,
    title="Dynamic Persona",
    description="Flag to enable dynamic value features. When true, once the agent has enough memory history it will stop using its default persona and instead use a generated persona based on its memories. When generating a dynamic persona, the original persona is still used as a component in the generation process.",
)
dynamic_persona_interval class-attribute instance-attribute
dynamic_persona_interval: TimeDeltaFactory = Field(
    default_factory=lambda: TimeDeltaFactory(days=1),
    title="Dynamic Persona Interval",
    description="A Python timedelta object that controls how often the dynamic persona is updated. Default value is 1 day.",
)
dynamic_persona_max_memories class-attribute instance-attribute
dynamic_persona_max_memories: int = Field(
    default=5000,
    title="Dynamic Persona Maximum Memories",
    description="The maximum number of memories that can be returned when generating a dynamic persona. If the agent has more memories then this maximum then the most recently accessed memories will be returned first.",
)
dynamic_persona_min_memories class-attribute instance-attribute
dynamic_persona_min_memories: int = Field(
    default=100,
    title="Dynamic Persona Minimum Memories",
    description="The minimum number of memories needed to generate and save a dynamic persona. If the agent does not meet this minimum number of memories then the default persona will be used.",
)
model_config class-attribute instance-attribute
model_config = ConfigDict(
    populate_by_name=True,
    use_enum_values=True,
    extra="ignore",
    strict=False,
)
persona class-attribute instance-attribute
persona: Persona = Field(
    default_factory=Persona, description=__doc__
)
time_aware class-attribute instance-attribute
time_aware: bool = Field(
    default=True,
    title="Time Aware",
    description="Flag to enable time awareness features. When true, the current date and time will be sent via a system header to the LLM during inferencing. Additionally, when forming observational memories the corresponding prompt will get augmented with the current date and time.",
)
timezone class-attribute instance-attribute
timezone: str = Field(
    default="",
    title="Agent Timezone",
    description="Paired with the time_aware settings, this is the timezone used to generate agent chat and memory timestamps. This setting has no effect when time_aware is False. When time_aware is True and this setting is None then the default backend timezone is used.",
)

Functions

validate_timezone classmethod
validate_timezone(timezone: str) -> str

Persona

Bases: BaseDataModel

Agent persona definition

Attributes:

  • gender (str) –

    Agent gender

  • pronoun_subject (str) –

    Agent subject pronoun (he/she). Sometime useful to build dynamic prompts.

  • pronoun_object (str) –

    Agent object pronoun (him/her) Sometime useful to build dynamic prompts.

  • pronoun_possessive (str) –

    Agent possessive pronoun (his/hers) Sometime useful to build dynamic prompts.

  • pronoun_reflexive (str) –

    Agent reflexive pronoun (himself/herself) Sometime useful to build dynamic prompts.

  • description (str) –

    Provides an overview of the agent and can typically include things like background and physical description.

  • personality (str) –

    Describes the agent’s personality.

  • special_instructions (List[str]) –

    Special instructions for the agent. These will appear as system messages at the end of conversation to enforce certain behaviors. While powerful, use these sparingly as they can have a significant impact on the agent’s behavior.

Attributes

description class-attribute instance-attribute
description: str = Field(
    default="",
    title="Description",
    description="Description of the agent's physical appearance if applicable.",
)
gender class-attribute instance-attribute
gender: str = Field(
    default="male",
    title="Gender",
    description="Agent gender",
)
model_config class-attribute instance-attribute
model_config = ConfigDict(
    populate_by_name=True,
    use_enum_values=True,
    extra="ignore",
    strict=False,
)
personality class-attribute instance-attribute
personality: str = Field(
    default="A helpful AI assistant.",
    title="Personality",
    description="A narrative that describes the agent's personality.",
)
pronoun_object class-attribute instance-attribute
pronoun_object: str = Field(
    default="him",
    title="Pronoun, Object",
    description="Agent object pronoun (him/her) Sometime useful to build dynamic prompts.",
)
pronoun_possessive class-attribute instance-attribute
pronoun_possessive: str = Field(
    default="his",
    title="Pronoun, Possessive",
    description="Agent possessive pronoun (his/hers) Sometime useful to build dynamic prompts.",
)
pronoun_reflexive class-attribute instance-attribute
pronoun_reflexive: str = Field(
    default="himself",
    title="Pronoun, Reflexive",
    description="Agent reflexive pronoun (himself/herself) Sometime useful to build dynamic prompts.",
)
pronoun_subject class-attribute instance-attribute
pronoun_subject: str = Field(
    default="he",
    title="Pronoun, Subject",
    description="Agent subject pronoun (he/she). Sometime useful to build dynamic prompts.",
)
special_instructions class-attribute instance-attribute
special_instructions: List[str] = Field(
    default_factory=list,
    title="Special Instructions",
    description="Special instructions for the agent. These will appear as system messages at the end of conversation to enforce certain behaviors. While powerful, use these sparingly as they can have a significant impact on the agent's behavior.",
)