Overview

Memory is crucial for agents to understand the flow of events and their causes. If you want your agent to be aware of the general application’s progress, which can be beneficial in certain situations, you can activate Memory. Additionally, if you want your agent to maintain its context continuity even when the application is closed and reopened, persistent memory will solve this need.

When you activate Memory, it saves the conversation history in the current directory based on your agent’s ID. You can continue this by providing an agent ID while creating a new agent.

Enabling Memory

To activate Memory, it is sufficient to set the memory parameter in the AgentConfiguration class to True and specify an agent name. This way, the agent will persistently save the history and gain the opportunity to view events from a broader perspective.

from upsonic import Agent

agent = Agent(
    name="Coder", 
    memory=True # Enable memory
)

Memory Example

For testing memory and how it works lets create a small test. Lets say “Who developed you?” to Agent and then we will create another task and we will ask “What i asked you before?”.

from upsonic import Task, Agent

agent = Agent(
    name="Coder", 
    memory=True # Enable memory
)



task = Task("Who developed you")
task2 = Task("What i asked you before?") # This task will now the history of the previous task


agent.print_do(task)
agent.print_do(task2)

Overview

Memory is crucial for agents to understand the flow of events and their causes. If you want your agent to be aware of the general application’s progress, which can be beneficial in certain situations, you can activate Memory. Additionally, if you want your agent to maintain its context continuity even when the application is closed and reopened, persistent memory will solve this need.

When you activate Memory, it saves the conversation history in the current directory based on your agent’s ID. You can continue this by providing an agent ID while creating a new agent.

Enabling Memory

To activate Memory, it is sufficient to set the memory parameter in the AgentConfiguration class to True and specify an agent name. This way, the agent will persistently save the history and gain the opportunity to view events from a broader perspective.

from upsonic import Agent

agent = Agent(
    name="Coder", 
    memory=True # Enable memory
)

Memory Example

For testing memory and how it works lets create a small test. Lets say “Who developed you?” to Agent and then we will create another task and we will ask “What i asked you before?”.

from upsonic import Task, Agent

agent = Agent(
    name="Coder", 
    memory=True # Enable memory
)



task = Task("Who developed you")
task2 = Task("What i asked you before?") # This task will now the history of the previous task


agent.print_do(task)
agent.print_do(task2)