Skip to content

πŸ™Œ OpenHands: AI-Driven Development

fix(agenthub): update initial thoughts (#281)

Josh Hendershot197e7fb2c0ef
diff --git a/agenthub/langchains_agent/langchains_agent.py b/agenthub/langchains_agent/langchains_agent.py
index 5493cbb277..48e392dbba 100644
--- a/agenthub/langchains_agent/langchains_agent.py
+++ b/agenthub/langchains_agent/langchains_agent.py
@@ -33,30 +33,37 @@ INITIAL_THOUGHTS = [
"Here's what I want to do: $TASK",
"How am I going to get there though?",
"It seems like I have some kind of short term memory.",
- "Each of my thoughts seems to be stored in a numbered list.",
- "It seems whatever I say next will be added to the list.",
+ "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 say RECALL, followed by the thing I want to remember. And then related thoughts just spill out!",
+ "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 say RUN followed by the command I want to run. The command output just jumps into my head!",
+ "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!",
'RUN echo "hello world"',
"hello world",
- "Cool! I bet I can read and edit files too.",
- "RUN echo \"console.log('hello world')\" > test.js",
+ "Cool! I bet I can write files too using the write action.",
+ "WRITE echo \"console.log('hello world')\" > test.js",
"",
"I just created test.js. I'll try and run it now.",
"RUN node test.js",
"hello world",
- "it works!",
- "And if I want to use the browser, I just need to say BROWSE, followed by a website I want to visit, or an action I want to take on the current site",
+ "It works!",
+ "I'm going to try reading it now using the read action.",
+ "READ test.js",
+ "console.log('hello world')",
+ "Nice! I can read files too!",
+ "And if I want to use the browser, I just need to use the browse action and include the url I want to visit in the url argument",
"Let's try that...",
"BROWSE google.com",
'<form><input type="text"></input><button type="submit"></button></form>',
+ "I can browse the web too!",
+ "And once I have completed my task, I can use the finish action to stop working.",
+ "But I should only use the finish action when I'm absolutely certain that I've completed my task and have tested my work.",
"Very cool. Now to accomplish my task.",
"I'll need a strategy. And as I make progress, I'll need to keep refining that strategy. I'll need to set goals, and break them into sub-goals.",
"In between actions, I must always take some time to think, strategize, and set new goals. I should never take two actions in a row.",
@@ -102,7 +109,16 @@ class LangchainsAgent(Agent):
command = thought.split("RUN ")[1]
d = {"action": "run", "args": {"command": command}}
next_is_output = True
-
+ elif thought.startswith("WRITE"):
+ parts = thought.split("WRITE ")[1].split(" > ")
+ path = parts[1]
+ content = parts[0]
+ d = {"action": "write", "args": {"file": path, "content": content}}
+ next_is_output = True
+ elif thought.startswith("READ"):
+ path = thought.split("READ ")[1]
+ d = {"action": "read", "args": {"file": path}}
+ next_is_output = True
elif thought.startswith("RECALL"):
query = thought.split("RECALL ")[1]
d = {"action": "recall", "args": {"query": query}}
diff --git a/agenthub/langchains_agent/utils/prompts.py b/agenthub/langchains_agent/utils/prompts.py
index 2745490e3b..3d30c221ce 100644
--- a/agenthub/langchains_agent/utils/prompts.py
+++ b/agenthub/langchains_agent/utils/prompts.py
@@ -84,7 +84,6 @@ actions are all "think" actions, you should consider taking a different action.
Notes:
* your environment is Debian Linux. You can install software with `apt`
-* you can use `git commit` to stash your work, but you don't have access to a remote repository
* your working directory will not change, even if you run `cd`. All commands will be run in the `/workspace` directory.
* don't run interactive commands, or commands that don't return (e.g. `node server.js`). You may run commands in the background (e.g. `node server.js &`)