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

arch: deprecating recall action and search_memory #2900

Merged
merged 5 commits into from
Jul 12, 2024
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 0 additions & 13 deletions agenthub/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,6 @@ Here is a list of available Actions, which can be returned by `agent.step()`:
- [`FileReadAction`](../opendevin/events/action/files.py) - Reads the content of a file
- [`FileWriteAction`](../opendevin/events/action/files.py) - Writes new content to a file
- [`BrowseURLAction`](../opendevin/events/action/browse.py) - Gets the content of a URL
- [`AgentRecallAction`](../opendevin/events/action/agent.py) - Searches memory (e.g. a vector database)
- [`AddTaskAction`](../opendevin/events/action/tasks.py) - Adds a subtask to the plan
- [`ModifyTaskAction`](../opendevin/events/action/tasks.py) - Changes the state of a subtask.
- [`AgentFinishAction`](../opendevin/events/action/agent.py) - Stops the control loop, allowing the user/delegator agent to enter a new task
Expand All @@ -54,7 +53,6 @@ Here is a list of available Observations:
- [`BrowserOutputObservation`](../opendevin/events/observation/browse.py)
- [`FileReadObservation`](../opendevin/events/observation/files.py)
- [`FileWriteObservation`](../opendevin/events/observation/files.py)
- [`AgentRecallObservation`](../opendevin/events/observation/recall.py)
- [`ErrorObservation`](../opendevin/events/observation/error.py)
- [`SuccessObservation`](../opendevin/events/observation/success.py)

Expand All @@ -72,14 +70,3 @@ def step(self, state: "State") -> "Action"

`step` moves the agent forward one step towards its goal. This probably means
sending a prompt to the LLM, then parsing the response into an `Action`.

### `search_memory`

```
def search_memory(self, query: str) -> list[str]:
```

`search_memory` should return a list of events that match the query. This will be used
for the `recall` action.

You can optionally just return `[]` for this method, meaning the agent has no long-term memory.
8 changes: 0 additions & 8 deletions agenthub/dummy_agent/agent.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@
Action,
AddTaskAction,
AgentFinishAction,
AgentRecallAction,
AgentRejectAction,
BrowseInteractiveAction,
BrowseURLAction,
Expand All @@ -18,7 +17,6 @@
ModifyTaskAction,
)
from opendevin.events.observation import (
AgentRecallObservation,
CmdOutputObservation,
FileReadObservation,
FileWriteObservation,
Expand Down Expand Up @@ -91,12 +89,6 @@ def __init__(self, llm: LLM):
)
],
},
{
'action': AgentRecallAction(query='who am I?'),
'observations': [
AgentRecallObservation('', memories=['I am a computer.']),
],
},
{
'action': BrowseURLAction(url='https://google.com'),
'observations': [
Expand Down
8 changes: 0 additions & 8 deletions agenthub/monologue_agent/agent.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@
from opendevin.core.schema import ActionType
from opendevin.events.action import (
Action,
AgentRecallAction,
BrowseURLAction,
CmdRunAction,
FileReadAction,
Expand All @@ -17,7 +16,6 @@
NullAction,
)
from opendevin.events.observation import (
AgentRecallObservation,
BrowserOutputObservation,
CmdOutputObservation,
FileReadObservation,
Expand Down Expand Up @@ -103,8 +101,6 @@ def _add_initial_thoughts(self, task):
)
elif previous_action == ActionType.READ:
observation = FileReadObservation(content=thought, path='')
elif previous_action == ActionType.RECALL:
observation = AgentRecallObservation(content=thought, memories=[])
elif previous_action == ActionType.BROWSE:
observation = BrowserOutputObservation(
content=thought, url='', screenshot=''
Expand All @@ -128,10 +124,6 @@ def _add_initial_thoughts(self, task):
path = thought.split('READ ')[1]
action = FileReadAction(path=path)
previous_action = ActionType.READ
elif thought.startswith('RECALL'):
query = thought.split('RECALL ')[1]
action = AgentRecallAction(query=query)
previous_action = ActionType.RECALL
elif thought.startswith('BROWSE'):
url = thought.split('BROWSE ')[1]
action = BrowseURLAction(url=url)
Expand Down
14 changes: 2 additions & 12 deletions agenthub/monologue_agent/utils/prompts.py
Original file line number Diff line number Diff line change
Expand Up @@ -35,14 +35,12 @@
* `owner` - the owner of the repo to push to
* `repo` - the name of the repo to push to
* `branch` - the name of the branch to push
* `recall` - recalls a past memory. Arguments:
* `query` - the query to search for
* `message` - make a plan, set a goal, record your thoughts, or ask for more input from the user. Arguments:
* `content` - the message to record
* `wait_for_response` - set to `true` to wait for the user to respond before proceeding
* `finish` - if you're absolutely certain that you've completed your task and have tested your work, use the finish action to stop working.

You MUST take time to think in between read, write, run, browse, push, and recall actions--do this with the `message` action.
You MUST take time to think in between read, write, run, browse, and push actions--do this with the `message` action.
You should never act twice in a row without thinking. But if your last several
actions are all `message` actions, you should consider taking a different action.

Expand Down Expand Up @@ -92,15 +90,7 @@
'It seems like I have some kind of short term memory.',
'Each of my thoughts seems to be stored in a JSON array.',
'It seems whatever I say next will be added as an object to the list.',
'But no one has perfect short-term memory. My list of thoughts will be summarized and condensed over time, losing information in the process.',
'Fortunately I have long term memory!',
'I can just perform a recall action, followed by the thing I want to remember. And then related thoughts just spill out!',
"Sometimes they're random thoughts that don't really have to do with what I wanted to remember. But usually they're exactly what I need!",
"Let's try it out!",
'RECALL what it is I want to do',
"Here's what I want to do: $TASK",
'How am I going to get there though?',
"Neat! And it looks like it's easy for me to use the command line too! I just have to perform a run action and include the command I want to run in the command argument. The command output just jumps into my head!",
"It looks like it's easy for me to use the command line too! I just have to perform a run action and include the command I want to run in the command argument. The command output just jumps into my head!",
'RUN echo "hello world"',
'hello world',
'Cool! I bet I can write files too using the write action.',
Expand Down
3 changes: 1 addition & 2 deletions agenthub/planner_agent/prompt.py
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@
* `state` - set to 'in_progress' to start the task, 'completed' to finish it, 'verified' to assert that it was successful, 'abandoned' to give up on it permanently, or `open` to stop working on it for now.
* `finish` - if ALL of your tasks and subtasks have been verified or abandoned, and you're absolutely certain that you've completed your task and have tested your work, use the finish action to stop working.

You MUST take time to think in between read, write, run, browse, and recall actions--do this with the `message` action.
You MUST take time to think in between read, write, run, and browse actions--do this with the `message` action.
You should never act twice in a row without thinking. But if your last several
actions are all `message` actions, you should consider taking a different action.

Expand All @@ -109,7 +109,6 @@ def get_hint(latest_action_id: str) -> str:
ActionType.WRITE: 'You just changed a file. You should think about how it affects your plan.',
ActionType.BROWSE: 'You should think about the page you just visited, and what you learned from it.',
ActionType.MESSAGE: "Look at your last thought in the history above. What does it suggest? Don't think anymore--take action.",
ActionType.RECALL: 'You should think about the information you just recalled, and how it should affect your plan.',
ActionType.ADD_TASK: 'You should think about the next action to take.',
ActionType.MODIFY_TASK: 'You should think about the next action to take.',
ActionType.SUMMARIZE: '',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,6 @@ La mémoire à court terme est stockée en tant qu'objet Monologue et le modèle
`CmdRunAction`,
`FileWriteAction`,
`FileReadAction`,
`AgentRecallAction`,
`BrowseURLAction`,
`GithubPushAction`,
`AgentThinkAction`
Expand All @@ -88,7 +87,6 @@ La mémoire à court terme est stockée en tant qu'objet Monologue et le modèle
`NullObservation`,
`CmdOutputObservation`,
`FileReadObservation`,
`AgentRecallObservation`,
`BrowserOutputObservation`

### Méthodes
Expand Down Expand Up @@ -116,7 +114,6 @@ L'agent reçoit ses paires action-observation précédentes, la tâche actuelle,
`GithubPushAction`,
`FileReadAction`,
`FileWriteAction`,
`AgentRecallAction`,
`AgentThinkAction`,
`AgentFinishAction`,
`AgentSummarizeAction`,
Expand All @@ -129,7 +126,6 @@ L'agent reçoit ses paires action-observation précédentes, la tâche actuelle,
`NullObservation`,
`CmdOutputObservation`,
`FileReadObservation`,
`AgentRecallObservation`,
`BrowserOutputObservation`

### Méthodes
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,6 @@ Monologue Agent利用长短期记忆来完成任务。
`CmdRunAction`,
`FileWriteAction`,
`FileReadAction`,
`AgentRecallAction`,
`BrowseURLAction`,
`GithubPushAction`,
`AgentThinkAction`
Expand All @@ -88,7 +87,6 @@ Monologue Agent利用长短期记忆来完成任务。
`NullObservation`,
`CmdOutputObservation`,
`FileReadObservation`,
`AgentRecallObservation`,
`BrowserOutputObservation`

### 方法
Expand Down Expand Up @@ -116,7 +114,6 @@ Planner agent利用特殊的提示策略为解决问题创建长期计划。
`GithubPushAction`,
`FileReadAction`,
`FileWriteAction`,
`AgentRecallAction`,
`AgentThinkAction`,
`AgentFinishAction`,
`AgentSummarizeAction`,
Expand All @@ -129,7 +126,6 @@ Planner agent利用特殊的提示策略为解决问题创建长期计划。
`NullObservation`,
`CmdOutputObservation`,
`FileReadObservation`,
`AgentRecallObservation`,
`BrowserOutputObservation`

### 方法
Expand Down
4 changes: 0 additions & 4 deletions docs/modules/usage/agents.md
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,6 @@ Short term memory is stored as a Monologue object and the model can condense it
`CmdRunAction`,
`FileWriteAction`,
`FileReadAction`,
`AgentRecallAction`,
`BrowseURLAction`,
`GithubPushAction`,
`AgentThinkAction`
Expand All @@ -83,7 +82,6 @@ Short term memory is stored as a Monologue object and the model can condense it
`NullObservation`,
`CmdOutputObservation`,
`FileReadObservation`,
`AgentRecallObservation`,
`BrowserOutputObservation`

### Methods
Expand Down Expand Up @@ -111,7 +109,6 @@ The agent is given its previous action-observation pairs, current task, and hint
`GithubPushAction`,
`FileReadAction`,
`FileWriteAction`,
`AgentRecallAction`,
`AgentThinkAction`,
`AgentFinishAction`,
`AgentSummarizeAction`,
Expand All @@ -124,7 +121,6 @@ The agent is given its previous action-observation pairs, current task, and hint
`NullObservation`,
`CmdOutputObservation`,
`FileReadObservation`,
`AgentRecallObservation`,
`BrowserOutputObservation`

### Methods
Expand Down
11 changes: 0 additions & 11 deletions docs/static/img/backend_architecture.puml
Original file line number Diff line number Diff line change
Expand Up @@ -14,15 +14,6 @@ class opendevin.observation.AgentMessageObservation {
role: str
observation: str
}
class opendevin.action.agent.AgentRecallAction {
query: str
action: str
}
class opendevin.observation.AgentRecallObservation {
memories: List[str]
role: str
observation: str
}
class opendevin.action.agent.AgentSummarizeAction {
summary: str
action: str
Expand Down Expand Up @@ -173,8 +164,6 @@ class opendevin.server.session.Session {
opendevin.action.base.ExecutableAction <|-- opendevin.action.agent.AgentEchoAction
opendevin.action.base.NotExecutableAction <|-- opendevin.action.agent.AgentFinishAction
opendevin.observation.Observation <|-- opendevin.observation.AgentMessageObservation
opendevin.action.base.ExecutableAction <|-- opendevin.action.agent.AgentRecallAction
opendevin.observation.Observation <|-- opendevin.observation.AgentRecallObservation
opendevin.action.base.NotExecutableAction <|-- opendevin.action.agent.AgentSummarizeAction
opendevin.action.base.NotExecutableAction <|-- opendevin.action.agent.AgentThinkAction
opendevin.action.base.Action <|-- opendevin.action.base.ExecutableAction
Expand Down
3 changes: 0 additions & 3 deletions frontend/src/types/ActionType.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -26,9 +26,6 @@ enum ActionType {
// Delegate a (sub)task to another agent.
DELEGATE = "delegate",

// Searches long-term memory.
RECALL = "recall",

// If you're absolutely certain that you've completed your task and have tested your work,
// use the finish action to stop working.
FINISH = "finish",
Expand Down
3 changes: 0 additions & 3 deletions frontend/src/types/ObservationType.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,6 @@ enum ObservationType {
// The output of an IPython command
RUN_IPYTHON = "run_ipython",

// The result of a search
RECALL = "recall",

// A message from the user
CHAT = "chat",

Expand Down
4 changes: 0 additions & 4 deletions opendevin/core/schema/action.py
Original file line number Diff line number Diff line change
Expand Up @@ -40,10 +40,6 @@ class ActionTypeSchema(BaseModel):
"""Interact with the browser instance.
"""

RECALL: str = Field(default='recall')
"""Searches long-term memory
"""

DELEGATE: str = Field(default='delegate')
"""Delegates a task to another agent.
"""
Expand Down
4 changes: 0 additions & 4 deletions opendevin/core/schema/observation.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,10 +22,6 @@ class ObservationTypeSchema(BaseModel):
"""Runs a IPython cell.
"""

RECALL: str = Field(default='recall')
"""The result of a search
"""

CHAT: str = Field(default='chat')
"""A message from the user
"""
Expand Down
2 changes: 0 additions & 2 deletions opendevin/events/action/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@
from .agent import (
AgentDelegateAction,
AgentFinishAction,
AgentRecallAction,
AgentRejectAction,
AgentSummarizeAction,
ChangeAgentStateAction,
Expand All @@ -22,7 +21,6 @@
'BrowseInteractiveAction',
'FileReadAction',
'FileWriteAction',
'AgentRecallAction',
'AgentFinishAction',
'AgentRejectAction',
'AgentDelegateAction',
Expand Down
15 changes: 1 addition & 14 deletions opendevin/events/action/agent.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
from dataclasses import dataclass, field
from typing import ClassVar

from opendevin.core.schema import ActionType

Expand All @@ -19,18 +18,6 @@ def message(self) -> str:
return f'Agent state changed to {self.agent_state}'


@dataclass
class AgentRecallAction(Action):
query: str
thought: str = ''
action: str = ActionType.RECALL
runnable: ClassVar[bool] = True

@property
def message(self) -> str:
return f"Let me dive into my memories to find what you're looking for! Searching for: '{self.query}'. This might take a moment."


@dataclass
class AgentSummarizeAction(Action):
summary: str
Expand All @@ -54,7 +41,7 @@ class AgentFinishAction(Action):

@property
def message(self) -> str:
if self.thought != "":
if self.thought != '':
return self.thought
return "All done! What's next on the agenda?"

Expand Down
2 changes: 0 additions & 2 deletions opendevin/events/observation/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@
from .error import ErrorObservation
from .files import FileReadObservation, FileWriteObservation
from .observation import Observation
from .recall import AgentRecallObservation
from .reject import RejectObservation
from .success import SuccessObservation

Expand All @@ -18,7 +17,6 @@
'BrowserOutputObservation',
'FileReadObservation',
'FileWriteObservation',
'AgentRecallObservation',
'ErrorObservation',
'AgentStateChangedObservation',
'AgentDelegateObservation',
Expand Down
20 changes: 0 additions & 20 deletions opendevin/events/observation/recall.py

This file was deleted.

Loading