Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Agent Memory & Agent Work Cycle #91

Open
waterflier opened this issue Nov 1, 2023 · 0 comments
Open

Agent Memory & Agent Work Cycle #91

waterflier opened this issue Nov 1, 2023 · 0 comments

Comments

@waterflier
Copy link
Collaborator

waterflier commented Nov 1, 2023

Agent & Workflow Status (Memory)

There are two types of states in memory: the Agent's own memory and the state within the workflow. The Agent's memory is the core of its identity as an independent entity. Agents with the same factory settings will develop different memories based on their work experiences, ultimately affecting their performance. The focus of their memory tends to be on long-term relationships with people and summaries of similar types of work.

The state within the workflow, on the other hand, represents the concept of "The names change, but the game remains the same." serving the organization's phased goals. Its way of maintaining memory is more conducive to the completion of current TODOs (Tasks).

Currently, I am inclined to implement the above two states in an isomorphic way (Workspace), with the only difference being that the Agent's memory workspace is private, while the state within the workflow is shared by multiple roles. This way, the entire system is still working with the Agent as the main body. The implementation of the workspace is a file system, divided into three main directories: /todos/, /memory/, and /kb/.

Among them, the /todo/ and /kb/ directories support both reading and writing, and the content format is human-friendly. This can support both Agents and real people working in the same workspace, and some todos that cannot be completed by the Agent can be assigned to people. The /memory/ directory stores the Agent's memory (or the work summary of the role in the workflow), which can be read directly but should not be modified.

The main starting point for distinguishing the above two states in design is bionics and personal philosophy. I believe that retaining individual and organizational characteristics can better activate the diversity of the system, have a greater chance of completing tasks, and ultimately achieve AGI (Artificial General Intelligence). Fundamentally, I oppose the concept of an Agent that is "competent in everything and knowledgeable in everything." Individuality is the root of creativity.

Agent Work Cycle

As designed above, the realization of all work goals in the system depends on active Agents. By authorizing and limiting resources for Agents, we can have overall control over the system.

Version 0.5.1 of the Agent is completely message-driven and passive. Events from the environment must first be converted into messages before they can be processed. After adding the Agent work cycle, the following logic is introduced:

Agents have wake/sleep logic. Sleep replenishes the Agent's energy.

When awake, the Agent's timer starts working, and the timer-driven cycle includes:

0. ProcessMessage, similar to before, but the Agent extracts TODOs from the process and adds them to the current Workspace.
1. OnWork, the Agent reads TODOs from the Workspace (which Workspace depends on which Workflows the Agent has joined at that time) and tries to complete them, leaving work logs in the process.
2. The process of completing TODOs is gradual. The Agent first determines whether the TODO can be completed directly. If not, the task is broken down, and the sub-tasks can be handed over to other Agents (or people).
3. OnThink, the Agent analyzes the messages, work logs, and summarizes them to improve the ProcessMessage and OnWork.
4. OnLearn, the Agent learns from external requirements (or autonomously) and modifies the Knowledge base.
5. If an agent takes on a managerial role in a workflow, they can employ management or economic methods such as creating or recruiting agents and posting reward tasks to solve more complex problems. However, I think this part of the discussion can be saved for future versions.

From a product perspective, the goal of the Agent Work Cycle is:

  1. To give the Agent reasonable initiative (to send messages proactively at appropriate times).
  2. To allow the Agent to complete some tasks directly within its authorization range.
  3. To give the Agent stronger capabilities for in-depth thinking, information integration, and learning (extended search analysis) around specific people or things.

Understanding Agent Loop with Jarvis as an Example

Jarvis is a personal assistant, focusing on:

  1. Managing the owner's schedule and providing necessary reminders.
  2. Acting as a consultancy advisor based on the owner's current tasks, collecting and organizing more real-world information.
  3. Excluding the coordination of other Agents, Jarvis only teams up with Mia (Mia is a more pure knowledge organization and collection type Agent).

OnMessage (Passively Triggered)

Update the "Todo List" if necessary.

OnEvent (Passively Triggered)

For example, you can get events from existing calendar services and drive them.

OnWork (Every 5 minutes, note the energy consumption)

Read the schedule, provide necessary proactive reminders, especially natural language descriptions of periodic reminders. Try to complete necessary TODOs at the right time, such as confirming the destination weather before traveling and proactively giving out clothing plans.

OnLearn

  1. Formulate learning plans based on TODOs and work summaries.
  2. Actively use the network to obtain more real-time information according to the learning plan.
  3. Use this real-time information to do a better job as an assistant.

OnThink

Summarize the people and events encountered based on work experience. When the owner has subsequent related tasks, provide more targeted advice.

With the support of the above new facilities, implement some Agents that can solve practical problems (ignoring Token cost issues for now)

1. Shopping assistant, can complete research, comparison, and purchasing tasks based on purchasing needs.

2. Form a team of product managers, programmers, testers, and designers to develop more complete and complex software (MetaGPT has already accumulated a lot in this field).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant