Skip to content

Commit e45ddeb

Browse files
authored
arch: deprecating recall action and search_memory (OpenHands#2900)
* deprecating recall action * fix integration tests * fix integration tests * remove search memory
1 parent 2b7c4e5 commit e45ddeb

55 files changed

Lines changed: 38 additions & 743 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

agenthub/README.md

Lines changed: 0 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,6 @@ Here is a list of available Actions, which can be returned by `agent.step()`:
3333
- [`FileReadAction`](../opendevin/events/action/files.py) - Reads the content of a file
3434
- [`FileWriteAction`](../opendevin/events/action/files.py) - Writes new content to a file
3535
- [`BrowseURLAction`](../opendevin/events/action/browse.py) - Gets the content of a URL
36-
- [`AgentRecallAction`](../opendevin/events/action/agent.py) - Searches memory (e.g. a vector database)
3736
- [`AddTaskAction`](../opendevin/events/action/tasks.py) - Adds a subtask to the plan
3837
- [`ModifyTaskAction`](../opendevin/events/action/tasks.py) - Changes the state of a subtask.
3938
- [`AgentFinishAction`](../opendevin/events/action/agent.py) - Stops the control loop, allowing the user/delegator agent to enter a new task
@@ -54,7 +53,6 @@ Here is a list of available Observations:
5453
- [`BrowserOutputObservation`](../opendevin/events/observation/browse.py)
5554
- [`FileReadObservation`](../opendevin/events/observation/files.py)
5655
- [`FileWriteObservation`](../opendevin/events/observation/files.py)
57-
- [`AgentRecallObservation`](../opendevin/events/observation/recall.py)
5856
- [`ErrorObservation`](../opendevin/events/observation/error.py)
5957
- [`SuccessObservation`](../opendevin/events/observation/success.py)
6058

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

7371
`step` moves the agent forward one step towards its goal. This probably means
7472
sending a prompt to the LLM, then parsing the response into an `Action`.
75-
76-
### `search_memory`
77-
78-
```
79-
def search_memory(self, query: str) -> list[str]:
80-
```
81-
82-
`search_memory` should return a list of events that match the query. This will be used
83-
for the `recall` action.
84-
85-
You can optionally just return `[]` for this method, meaning the agent has no long-term memory.

agenthub/browsing_agent/browsing_agent.py

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -213,6 +213,3 @@ def step(self, state: State) -> Action:
213213
stop=[')```', ')\n```'],
214214
)
215215
return self.response_parser.parse(response)
216-
217-
def search_memory(self, query: str) -> list[str]:
218-
raise NotImplementedError('Implement this abstract method')

agenthub/codeact_agent/codeact_agent.py

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -208,9 +208,6 @@ def step(self, state: State) -> Action:
208208
)
209209
return self.action_parser.parse(response)
210210

211-
def search_memory(self, query: str) -> list[str]:
212-
raise NotImplementedError('Implement this abstract method')
213-
214211
def _get_messages(self, state: State) -> list[dict[str, str]]:
215212
messages = [
216213
{'role': 'system', 'content': self.system_message},

agenthub/codeact_swe_agent/codeact_swe_agent.py

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -162,9 +162,6 @@ def step(self, state: State) -> Action:
162162

163163
return self.response_parser.parse(response)
164164

165-
def search_memory(self, query: str) -> list[str]:
166-
raise NotImplementedError('Implement this abstract method')
167-
168165
def _get_messages(self, state: State) -> list[dict[str, str]]:
169166
messages = [
170167
{'role': 'system', 'content': self.system_message},

agenthub/delegator_agent/agent.py

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -82,6 +82,3 @@ def step(self, state: State) -> Action:
8282
)
8383
else:
8484
raise Exception('Invalid delegate state')
85-
86-
def search_memory(self, query: str) -> list[str]:
87-
return []

agenthub/dummy_agent/agent.py

Lines changed: 0 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,6 @@
77
Action,
88
AddTaskAction,
99
AgentFinishAction,
10-
AgentRecallAction,
1110
AgentRejectAction,
1211
BrowseInteractiveAction,
1312
BrowseURLAction,
@@ -18,7 +17,6 @@
1817
ModifyTaskAction,
1918
)
2019
from opendevin.events.observation import (
21-
AgentRecallObservation,
2220
CmdOutputObservation,
2321
FileReadObservation,
2422
FileWriteObservation,
@@ -91,12 +89,6 @@ def __init__(self, llm: LLM):
9189
)
9290
],
9391
},
94-
{
95-
'action': AgentRecallAction(query='who am I?'),
96-
'observations': [
97-
AgentRecallObservation('', memories=['I am a computer.']),
98-
],
99-
},
10092
{
10193
'action': BrowseURLAction(url='https://google.com'),
10294
'observations': [
@@ -152,6 +144,3 @@ def step(self, state: State) -> Action:
152144
hist_obs == expected_obs
153145
), f'Expected observation {expected_obs}, got {hist_obs}'
154146
return self.steps[state.iteration]['action']
155-
156-
def search_memory(self, query: str) -> list[str]:
157-
return ['I am a computer.']

agenthub/micro/agent.py

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -79,6 +79,3 @@ def step(self, state: State) -> Action:
7979
action_resp = resp['choices'][0]['message']['content']
8080
action = parse_response(action_resp)
8181
return action
82-
83-
def search_memory(self, query: str) -> list[str]:
84-
return []

agenthub/monologue_agent/agent.py

Lines changed: 0 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,6 @@
88
from opendevin.core.schema import ActionType
99
from opendevin.events.action import (
1010
Action,
11-
AgentRecallAction,
1211
BrowseURLAction,
1312
CmdRunAction,
1413
FileReadAction,
@@ -17,7 +16,6 @@
1716
NullAction,
1817
)
1918
from opendevin.events.observation import (
20-
AgentRecallObservation,
2119
BrowserOutputObservation,
2220
CmdOutputObservation,
2321
FileReadObservation,
@@ -103,8 +101,6 @@ def _add_initial_thoughts(self, task):
103101
)
104102
elif previous_action == ActionType.READ:
105103
observation = FileReadObservation(content=thought, path='')
106-
elif previous_action == ActionType.RECALL:
107-
observation = AgentRecallObservation(content=thought, memories=[])
108104
elif previous_action == ActionType.BROWSE:
109105
observation = BrowserOutputObservation(
110106
content=thought, url='', screenshot=''
@@ -128,10 +124,6 @@ def _add_initial_thoughts(self, task):
128124
path = thought.split('READ ')[1]
129125
action = FileReadAction(path=path)
130126
previous_action = ActionType.READ
131-
elif thought.startswith('RECALL'):
132-
query = thought.split('RECALL ')[1]
133-
action = AgentRecallAction(query=query)
134-
previous_action = ActionType.RECALL
135127
elif thought.startswith('BROWSE'):
136128
url = thought.split('BROWSE ')[1]
137129
action = BrowseURLAction(url=url)
@@ -192,21 +184,6 @@ def step(self, state: State) -> Action:
192184
self.latest_action = action
193185
return action
194186

195-
def search_memory(self, query: str) -> list[str]:
196-
"""
197-
Uses VectorIndexRetriever to find related memories within the long term memory.
198-
Uses search to produce top 10 results.
199-
200-
Parameters:
201-
- The query that we want to find related memories for
202-
203-
Returns:
204-
- A list of top 10 text results that matched the query
205-
"""
206-
if self.memory is None:
207-
return []
208-
return self.memory.search(query)
209-
210187
def reset(self) -> None:
211188
super().reset()
212189

agenthub/monologue_agent/utils/prompts.py

Lines changed: 2 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -35,14 +35,12 @@
3535
* `owner` - the owner of the repo to push to
3636
* `repo` - the name of the repo to push to
3737
* `branch` - the name of the branch to push
38-
* `recall` - recalls a past memory. Arguments:
39-
* `query` - the query to search for
4038
* `message` - make a plan, set a goal, record your thoughts, or ask for more input from the user. Arguments:
4139
* `content` - the message to record
4240
* `wait_for_response` - set to `true` to wait for the user to respond before proceeding
4341
* `finish` - if you're absolutely certain that you've completed your task and have tested your work, use the finish action to stop working.
4442
45-
You MUST take time to think in between read, write, run, browse, push, and recall actions--do this with the `message` action.
43+
You MUST take time to think in between read, write, run, browse, and push actions--do this with the `message` action.
4644
You should never act twice in a row without thinking. But if your last several
4745
actions are all `message` actions, you should consider taking a different action.
4846
@@ -92,15 +90,7 @@
9290
'It seems like I have some kind of short term memory.',
9391
'Each of my thoughts seems to be stored in a JSON array.',
9492
'It seems whatever I say next will be added as an object to the list.',
95-
'But no one has perfect short-term memory. My list of thoughts will be summarized and condensed over time, losing information in the process.',
96-
'Fortunately I have long term memory!',
97-
'I can just perform a recall action, followed by the thing I want to remember. And then related thoughts just spill out!',
98-
"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!",
99-
"Let's try it out!",
100-
'RECALL what it is I want to do',
101-
"Here's what I want to do: $TASK",
102-
'How am I going to get there though?',
103-
"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!",
93+
"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!",
10494
'RUN echo "hello world"',
10595
'hello world',
10696
'Cool! I bet I can write files too using the write action.',

agenthub/planner_agent/agent.py

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,3 @@ def step(self, state: State) -> Action:
4949
messages = [{'content': prompt, 'role': 'user'}]
5050
resp = self.llm.completion(messages=messages)
5151
return self.response_parser.parse(resp)
52-
53-
def search_memory(self, query: str) -> list[str]:
54-
return []

0 commit comments

Comments
 (0)