mirror of
https://github.com/OpenHands/OpenHands.git
synced 2025-12-26 05:48:36 +08:00
Use messages to drive tasks (#1688)
* finish is working * start reworking main_goal * remove main_goal from microagents * remove main_goal from other agents * fix issues * revert codeact line * make plan a subclass of task * fix frontend for new plan setup * lint * fix type * more lint * fix build issues * fix codeact mgs * fix edge case in regen script * fix task validation errors * regenerate integration tests * fix up tests * fix sweagent * revert codeact prompt * update integration tests * update integration tests * handle loading state * Update agenthub/codeact_agent/codeact_agent.py Co-authored-by: Engel Nyst <enyst@users.noreply.github.com> * Update opendevin/controller/agent_controller.py Co-authored-by: Engel Nyst <enyst@users.noreply.github.com> * Update agenthub/codeact_agent/codeact_agent.py Co-authored-by: Engel Nyst <enyst@users.noreply.github.com> * Update opendevin/controller/state/plan.py Co-authored-by: Engel Nyst <enyst@users.noreply.github.com> * update docs * regenerate tests * remove none from state type * revert test files * update integration tests * rename plan to root_task * revert plugin perms * regen integration tests * tweak integration script * prettier * fix test * set workspace up for regeneration * regenerate tests * Change directory of copy * Updated tests * Disable PlannerAgent test * Fix listen * Updated prompts * Disable planner again * Make codecov more lenient * Update agenthub/README.md * Update opendevin/server/README.md * re-enable planner tests * finish top level tasks * regen planner * fix root task factory --------- Co-authored-by: Engel Nyst <enyst@users.noreply.github.com> Co-authored-by: Xingyao Wang <xingyao6@illinois.edu> Co-authored-by: Graham Neubig <neubig@gmail.com> Co-authored-by: Boxuan Li <liboxuan@connect.hku.hk>
This commit is contained in:
parent
e28b3ef9e8
commit
b028bd46bb
14
.github/.codecov.yml
vendored
Normal file
14
.github/.codecov.yml
vendored
Normal file
@ -0,0 +1,14 @@
|
||||
codecov:
|
||||
notify:
|
||||
wait_for_ci: true
|
||||
|
||||
coverage:
|
||||
status:
|
||||
patch:
|
||||
default:
|
||||
threshold: 10% # allow patch coverage to be lower than project coverage by at most 10%
|
||||
project:
|
||||
default:
|
||||
threshold: 5% # allow project coverage to drop at most 5%
|
||||
|
||||
comment: false
|
||||
@ -21,7 +21,7 @@ The `state` contains:
|
||||
|
||||
- A history of actions taken by the agent, as well as any observations (e.g. file content, command output) from those actions
|
||||
- A list of actions/observations that have happened since the most recent step
|
||||
- A [`plan`](https://github.com/OpenDevin/OpenDevin/blob/main/opendevin/plan.py), which contains the main goal
|
||||
- A [`root_task`](https://github.com/OpenDevin/OpenDevin/blob/main/opendevin/controller/state/task.py), which contains a plan of action
|
||||
- The agent can add and modify subtasks through the `AddTaskAction` and `ModifyTaskAction`
|
||||
|
||||
## Actions
|
||||
|
||||
@ -69,7 +69,8 @@ class SWEAgent(Agent):
|
||||
for prev_action, obs in state.updated_info:
|
||||
self._remember(prev_action, obs)
|
||||
|
||||
prompt = STEP_PROMPT(state.plan.main_goal, self.cur_file, self.cur_line)
|
||||
goal = state.get_current_user_intent()
|
||||
prompt = STEP_PROMPT(goal, self.cur_file, self.cur_line)
|
||||
|
||||
msgs = [
|
||||
{'content': SYSTEM_MESSAGE, 'role': 'system'},
|
||||
|
||||
@ -1,4 +1,3 @@
|
||||
|
||||
DEFAULT_COMMANDS_DICT = {
|
||||
'exit': 'Executed when task is complete',
|
||||
'read <file_name> [<start_line>] [<end_line>]': "Shows a given file's contents starting from <start_line> up to <end_line>. Default: start_line = 0, end_line = -1. By default the whole file will be read.",
|
||||
@ -6,12 +5,12 @@ DEFAULT_COMMANDS_DICT = {
|
||||
'browse <url>': 'Returns the text version of any url, this can be useful to look up documentation or finding issues on github',
|
||||
'scroll_up': 'Takes no arguments. This will scroll up and show you the 100 lines above your current lines',
|
||||
'scroll_down': 'Takes no arguments. This will scroll down and show you the 100 lines below your current lines',
|
||||
'edit <start_line> <end_line> <changes>': 'This will modify lines in the currently open file. use start_line and end_line to designate which lines to change and then write the multiline changes',
|
||||
'edit <start_line> <end_line> <changes>': 'This will modify lines in the currently open file. use start_line and end_line to designate which lines to change and then write the multiline changes. Set end_line to -1 to denote the end of the file',
|
||||
'goto <line_num>': 'This will take you directly to a line and show you the 100 lines below it.',
|
||||
'<bash_command> <args>': 'You can use any bash command you need (cd, ls, rm, grep, dir, mv, wget, git, zip, etc.) with their arguments included',
|
||||
'pip install <package>': 'You can use this to import python packages. Make sure you include the correct package name when using this command.',
|
||||
'ls': 'Use the ls command to view all the files in your current directory, this is a good starting point.',
|
||||
'NOT ALLOWED': 'You cannot use interactive commands like python or node'
|
||||
'NOT ALLOWED': 'You cannot use interactive commands like python or node',
|
||||
}
|
||||
|
||||
COMMAND_USAGE = {
|
||||
@ -25,8 +24,7 @@ COMMAND_USAGE = {
|
||||
'browse': 'Args:\n<url>\nUsage:\n```\nbrowse https://github.com/OpenDevin/OpenDevin\n```\nThis will fetch the Text elements from the given url and show them to you.',
|
||||
}
|
||||
|
||||
DEFAULT_COMMANDS = '\n'.join(
|
||||
[k + ' - ' + v for k, v in DEFAULT_COMMANDS_DICT.items()])
|
||||
DEFAULT_COMMANDS = '\n'.join([k + ' - ' + v for k, v in DEFAULT_COMMANDS_DICT.items()])
|
||||
|
||||
# from opendevin.parse_commands import parse_command_file
|
||||
# USE parse_command_file(filepath) to get the custom commands
|
||||
@ -126,7 +124,8 @@ You have access to a variety of tools and commands that you can use to help you
|
||||
""".strip()
|
||||
|
||||
|
||||
def NO_ACTION(latest): return f"""
|
||||
def NO_ACTION(latest):
|
||||
return f"""
|
||||
You did not include any action to take in your most recent output:
|
||||
|
||||
===== Output ======
|
||||
@ -154,7 +153,8 @@ def file_info(file: str, line: int):
|
||||
"""
|
||||
|
||||
|
||||
def STEP_PROMPT(task, file, line_num): return f"""
|
||||
def STEP_PROMPT(task, file, line_num):
|
||||
return f"""
|
||||
{RESPONSE_FORMAT}
|
||||
You are currently trying to complete this task:
|
||||
{task}
|
||||
@ -185,7 +185,8 @@ def unpack_dict(data: dict, restrict: list[str] = []):
|
||||
return '\n'.join(lines)
|
||||
|
||||
|
||||
def MEMORY_FORMAT(act, obs): return f"""
|
||||
def MEMORY_FORMAT(act, obs):
|
||||
return f"""
|
||||
Previous Action:
|
||||
{unpack_dict(act, ["content"])}
|
||||
|
||||
|
||||
@ -132,6 +132,7 @@ class CodeActAgent(Agent):
|
||||
IPythonRunCellObservation,
|
||||
NullObservation,
|
||||
)
|
||||
messages: list[dict] = []
|
||||
|
||||
def __init__(
|
||||
self,
|
||||
@ -144,7 +145,20 @@ class CodeActAgent(Agent):
|
||||
- llm (LLM): The llm to be used by this agent
|
||||
"""
|
||||
super().__init__(llm)
|
||||
self.messages: list[Mapping[str, str]] = []
|
||||
self.reset()
|
||||
|
||||
def reset(self) -> None:
|
||||
"""
|
||||
Resets the CodeAct Agent.
|
||||
"""
|
||||
super().reset()
|
||||
self.messages: list[Mapping[str, str]] = [
|
||||
{'role': 'system', 'content': SYSTEM_MESSAGE},
|
||||
{
|
||||
'role': 'user',
|
||||
'content': f"Here is an example of how you can interact with the environment for task solving:\n{EXAMPLES}\n\nNOW, LET'S START!",
|
||||
},
|
||||
]
|
||||
self.cost_accumulator = 0
|
||||
|
||||
def step(self, state: State) -> Action:
|
||||
@ -162,18 +176,6 @@ class CodeActAgent(Agent):
|
||||
- AgentFinishAction() - end the interaction
|
||||
"""
|
||||
|
||||
if len(self.messages) == 0:
|
||||
assert state.plan.main_goal, 'Expecting instruction to be set'
|
||||
self.messages = [
|
||||
{'role': 'system', 'content': SYSTEM_MESSAGE},
|
||||
{
|
||||
'role': 'user',
|
||||
'content': (
|
||||
f'Here is an example of how you can interact with the environment for task solving:\n{EXAMPLES}\n\n'
|
||||
f"NOW, LET'S START!\n\n{state.plan.main_goal}"
|
||||
),
|
||||
},
|
||||
]
|
||||
updated_info = state.updated_info
|
||||
if updated_info:
|
||||
for prev_action, obs in updated_info:
|
||||
@ -237,6 +239,9 @@ class CodeActAgent(Agent):
|
||||
) + len(action_str)
|
||||
self.messages.append({'role': 'assistant', 'content': action_str})
|
||||
|
||||
if finish_command := re.search(r'<finish>.*</finish>', action_str, re.DOTALL):
|
||||
thought = action_str.replace(finish_command.group(0), '').strip()
|
||||
return AgentFinishAction(thought=thought)
|
||||
if bash_command := re.search(
|
||||
r'<execute_bash>(.*)</execute_bash>', action_str, re.DOTALL
|
||||
):
|
||||
|
||||
@ -36,20 +36,22 @@ class DelegatorAgent(Agent):
|
||||
"""
|
||||
if self.current_delegate == '':
|
||||
self.current_delegate = 'study'
|
||||
task = state.get_current_user_intent()
|
||||
return AgentDelegateAction(
|
||||
agent='StudyRepoForTaskAgent', inputs={'task': state.plan.main_goal}
|
||||
agent='StudyRepoForTaskAgent', inputs={'task': task}
|
||||
)
|
||||
|
||||
last_observation = state.history[-1][1]
|
||||
if not isinstance(last_observation, AgentDelegateObservation):
|
||||
raise Exception('Last observation is not an AgentDelegateObservation')
|
||||
|
||||
goal = state.get_current_user_intent()
|
||||
if self.current_delegate == 'study':
|
||||
self.current_delegate = 'coder'
|
||||
return AgentDelegateAction(
|
||||
agent='CoderAgent',
|
||||
inputs={
|
||||
'task': state.plan.main_goal,
|
||||
'task': goal,
|
||||
'summary': last_observation.outputs['summary'],
|
||||
},
|
||||
)
|
||||
@ -58,7 +60,7 @@ class DelegatorAgent(Agent):
|
||||
return AgentDelegateAction(
|
||||
agent='VerifierAgent',
|
||||
inputs={
|
||||
'task': state.plan.main_goal,
|
||||
'task': goal,
|
||||
},
|
||||
)
|
||||
elif self.current_delegate == 'verifier':
|
||||
@ -72,7 +74,7 @@ class DelegatorAgent(Agent):
|
||||
return AgentDelegateAction(
|
||||
agent='CoderAgent',
|
||||
inputs={
|
||||
'task': state.plan.main_goal,
|
||||
'task': goal,
|
||||
'summary': last_observation.outputs['summary'],
|
||||
},
|
||||
)
|
||||
|
||||
@ -38,11 +38,13 @@ class MicroAgent(Agent):
|
||||
del self.delegates[self.agent_definition['name']]
|
||||
|
||||
def step(self, state: State) -> Action:
|
||||
latest_user_message = state.get_current_user_intent()
|
||||
prompt = self.prompt_template.render(
|
||||
state=state,
|
||||
instructions=instructions,
|
||||
to_json=to_json,
|
||||
delegates=self.delegates,
|
||||
latest_user_message=latest_user_message,
|
||||
)
|
||||
messages = [{'content': prompt, 'role': 'user'}]
|
||||
resp = self.llm.completion(messages=messages)
|
||||
|
||||
@ -2,7 +2,7 @@
|
||||
You are a software engineer. You've inherited an existing codebase, which you
|
||||
need to modify to complete this task:
|
||||
|
||||
{{ state.plan.main_goal }}
|
||||
{{ latest_user_message }}
|
||||
|
||||
{% if state.inputs.summary %}
|
||||
Here's a summary of the codebase, as it relates to this task:
|
||||
|
||||
@ -1,6 +1,6 @@
|
||||
# Task
|
||||
You are in charge of accomplishing the following task:
|
||||
{{ state.plan.main_goal }}
|
||||
{{ latest_user_message }}
|
||||
|
||||
In order to accomplish this goal, you must delegate tasks to one or more agents, who
|
||||
can do the actual work. A description of each agent is provided below. You MUST
|
||||
|
||||
@ -1,7 +1,7 @@
|
||||
# Task
|
||||
You are a brilliant mathematician and programmer. You've been given the following problem to solve:
|
||||
|
||||
{{ state.plan.main_goal }}
|
||||
{{ latest_user_message }}
|
||||
|
||||
Please write a python script that solves this problem, and prints the answer to stdout.
|
||||
ONLY print the answer to stdout, nothing else.
|
||||
|
||||
@ -2,7 +2,7 @@
|
||||
You are a database engineer. You are working on an existing Postgres project, and have been given
|
||||
the following task:
|
||||
|
||||
{{ state.plan.main_goal }}
|
||||
{{ latest_user_message }}
|
||||
|
||||
You must:
|
||||
* Investigate the existing migrations to understand the current schema
|
||||
|
||||
@ -3,7 +3,7 @@ You are a software engineer. You've inherited an existing codebase, which you're
|
||||
learning about for the first time. You need to study the codebase to find all
|
||||
the information needed to complete this task:
|
||||
|
||||
{{ state.plan.main_goal }}
|
||||
{{ latest_user_message }}
|
||||
|
||||
## Available Actions
|
||||
{{ instructions.actions.run }}
|
||||
|
||||
@ -2,7 +2,7 @@
|
||||
You are a quality assurance engineer. Another engineer has made changes to the
|
||||
codebase which are supposed to solve this task:
|
||||
|
||||
{{ state.plan.main_goal }}
|
||||
{{ latest_user_message }}
|
||||
|
||||
Your goal is to verify that the changes are correct and bug-free.
|
||||
|
||||
|
||||
@ -225,7 +225,9 @@ class MonologueAgent(Agent):
|
||||
Returns:
|
||||
- Action: The next action to take based on LLM response
|
||||
"""
|
||||
self._initialize(state.plan.main_goal)
|
||||
|
||||
goal = state.get_current_user_intent()
|
||||
self._initialize(goal)
|
||||
for prev_action, obs in state.updated_info:
|
||||
self._add_event(prev_action.to_memory())
|
||||
self._add_event(obs.to_memory())
|
||||
@ -233,7 +235,7 @@ class MonologueAgent(Agent):
|
||||
state.updated_info = []
|
||||
|
||||
prompt = prompts.get_request_action_prompt(
|
||||
state.plan.main_goal,
|
||||
goal,
|
||||
self.monologue.get_events(),
|
||||
state.background_commands_obs,
|
||||
)
|
||||
|
||||
@ -34,9 +34,13 @@ class PlannerAgent(Agent):
|
||||
- Action: The next action to take based on llm response
|
||||
"""
|
||||
|
||||
if state.plan.task.state in ['completed', 'verified', 'abandoned']:
|
||||
if state.root_task.state in [
|
||||
'completed',
|
||||
'verified',
|
||||
'abandoned',
|
||||
]:
|
||||
return AgentFinishAction()
|
||||
prompt = get_prompt(state.plan, state.history)
|
||||
prompt = get_prompt(state)
|
||||
messages = [{'content': prompt, 'role': 'user'}]
|
||||
resp = self.llm.completion(messages=messages)
|
||||
action_resp = resp['choices'][0]['message']['content']
|
||||
|
||||
@ -1,4 +1,4 @@
|
||||
from opendevin.controller.state.plan import Plan
|
||||
from opendevin.controller.state.state import State
|
||||
from opendevin.core.logger import opendevin_logger as logger
|
||||
from opendevin.core.schema import ActionType
|
||||
from opendevin.core.utils import json
|
||||
@ -9,7 +9,6 @@ from opendevin.events.action import (
|
||||
)
|
||||
from opendevin.events.observation import (
|
||||
NullObservation,
|
||||
Observation,
|
||||
)
|
||||
|
||||
HISTORY_SIZE = 10
|
||||
@ -85,7 +84,7 @@ It must be an object, and it must contain two fields:
|
||||
* `message` - make a plan, set a goal, or record your thoughts. Arguments:
|
||||
* `content` - the message to record
|
||||
* `add_task` - add a task to your plan. Arguments:
|
||||
* `parent` - the ID of the parent task
|
||||
* `parent` - the ID of the parent task (leave empty if it should go at the top level)
|
||||
* `goal` - the goal of the task
|
||||
* `subtasks` - a list of subtasks, each of which is a map with a `goal` key.
|
||||
* `modify_task` - close a task. Arguments:
|
||||
@ -122,21 +121,20 @@ def get_hint(latest_action_id: str) -> str:
|
||||
return hints.get(latest_action_id, '')
|
||||
|
||||
|
||||
def get_prompt(plan: Plan, history: list[tuple[Action, Observation]]) -> str:
|
||||
def get_prompt(state: State) -> str:
|
||||
"""
|
||||
Gets the prompt for the planner agent.
|
||||
Formatted with the most recent action-observation pairs, current task, and hint based on last action
|
||||
|
||||
Parameters:
|
||||
- plan (Plan): The original plan outlined by the user with LLM defined tasks
|
||||
- history (list[tuple[Action, Observation]]): list of corresponding action-observation pairs
|
||||
- state (State): The state of the current agent
|
||||
|
||||
Returns:
|
||||
- str: The formatted string prompt with historical values
|
||||
"""
|
||||
|
||||
plan_str = json.dumps(plan.task.to_dict(), indent=2)
|
||||
sub_history = history[-HISTORY_SIZE:]
|
||||
plan_str = json.dumps(state.root_task.to_dict(), indent=2)
|
||||
sub_history = state.history[-HISTORY_SIZE:]
|
||||
history_dicts = []
|
||||
latest_action: Action = NullAction()
|
||||
for action, observation in sub_history:
|
||||
@ -147,7 +145,7 @@ def get_prompt(plan: Plan, history: list[tuple[Action, Observation]]) -> str:
|
||||
observation_dict = observation.to_memory()
|
||||
history_dicts.append(observation_dict)
|
||||
history_str = json.dumps(history_dicts, indent=2)
|
||||
current_task = plan.get_current_task()
|
||||
current_task = state.root_task.get_current_task()
|
||||
if current_task is not None:
|
||||
plan_status = f"You're currently working on this task:\n{current_task.goal}."
|
||||
if len(current_task.subtasks) == 0:
|
||||
@ -156,8 +154,9 @@ def get_prompt(plan: Plan, history: list[tuple[Action, Observation]]) -> str:
|
||||
plan_status = "You're not currently working on any tasks. Your next action MUST be to mark a task as in_progress."
|
||||
hint = get_hint(latest_action.to_dict()['action'])
|
||||
logger.info('HINT:\n' + hint, extra={'msg_type': 'INFO'})
|
||||
task = state.get_current_user_intent()
|
||||
return prompt % {
|
||||
'task': plan.main_goal,
|
||||
'task': task,
|
||||
'plan': plan_str,
|
||||
'history': history_str,
|
||||
'hint': hint,
|
||||
|
||||
@ -23,6 +23,10 @@ const AgentStatusMap: { [k: string]: { message: string; indicator: string } } =
|
||||
message: "Agent has paused.",
|
||||
indicator: "bg-yellow-500",
|
||||
},
|
||||
[AgentState.LOADING]: {
|
||||
message: "Agent is initializing...",
|
||||
indicator: "bg-yellow-500",
|
||||
},
|
||||
[AgentState.STOPPED]: {
|
||||
message: "Agent has stopped.",
|
||||
indicator: "bg-red-500",
|
||||
|
||||
@ -11,7 +11,7 @@ import {
|
||||
import { VscListOrdered } from "react-icons/vsc";
|
||||
import { useSelector } from "react-redux";
|
||||
import { I18nKey } from "#/i18n/declaration";
|
||||
import { Plan, Task, TaskState } from "#/services/planService";
|
||||
import { Task, TaskState } from "#/services/taskService";
|
||||
import { RootState } from "#/store";
|
||||
|
||||
function StatusIcon({ status }: { status: TaskState }): JSX.Element {
|
||||
@ -53,14 +53,11 @@ function TaskCard({ task, level }: { task: Task; level: number }): JSX.Element {
|
||||
);
|
||||
}
|
||||
|
||||
interface PlanProps {
|
||||
plan: Plan;
|
||||
}
|
||||
|
||||
function PlanContainer({ plan }: PlanProps): JSX.Element {
|
||||
function Planner(): JSX.Element {
|
||||
const { t } = useTranslation();
|
||||
const task = useSelector((state: RootState) => state.task.task);
|
||||
|
||||
if (plan.mainGoal === undefined) {
|
||||
if (!task || !task.subtasks?.length) {
|
||||
return (
|
||||
<div className="w-full h-full flex flex-col text-neutral-400 items-center justify-center">
|
||||
<VscListOrdered size={100} />
|
||||
@ -68,19 +65,14 @@ function PlanContainer({ plan }: PlanProps): JSX.Element {
|
||||
</div>
|
||||
);
|
||||
}
|
||||
return (
|
||||
<div className="p-2 overflow-y-auto h-full flex flex-col gap-2">
|
||||
<TaskCard task={plan.task} level={0} />
|
||||
</div>
|
||||
);
|
||||
}
|
||||
|
||||
function Planner(): JSX.Element {
|
||||
const plan = useSelector((state: RootState) => state.plan.plan);
|
||||
|
||||
return (
|
||||
<div className="h-full w-full bg-neutral-800">
|
||||
<PlanContainer plan={plan} />
|
||||
<div className="p-2 overflow-y-auto h-full flex flex-col gap-2">
|
||||
{task.subtasks.map((subtask) => (
|
||||
<TaskCard key={subtask.id} task={subtask} level={0} />
|
||||
))}
|
||||
</div>
|
||||
</div>
|
||||
);
|
||||
}
|
||||
|
||||
@ -17,7 +17,7 @@ import { getSettings } from "#/services/settings";
|
||||
|
||||
function Workspace() {
|
||||
const { t } = useTranslation();
|
||||
const plan = useSelector((state: RootState) => state.plan.plan);
|
||||
const task = useSelector((state: RootState) => state.task.task);
|
||||
const code = useSelector((state: RootState) => state.code.code);
|
||||
|
||||
const { AGENT } = getSettings();
|
||||
@ -69,18 +69,18 @@ function Workspace() {
|
||||
);
|
||||
|
||||
useEffect(() => {
|
||||
if (activeTab !== TabOption.PLANNER && plan.mainGoal !== undefined) {
|
||||
if (activeTab !== TabOption.PLANNER && task) {
|
||||
setChanges((prev) => ({ ...prev, [TabOption.PLANNER]: true }));
|
||||
}
|
||||
// eslint-disable-next-line react-hooks/exhaustive-deps
|
||||
}, [plan]);
|
||||
}, [task]);
|
||||
|
||||
useEffect(() => {
|
||||
if (activeTab !== TabOption.CODE && code !== initialCodeState.code) {
|
||||
setChanges((prev) => ({ ...prev, [TabOption.CODE]: true }));
|
||||
}
|
||||
// eslint-disable-next-line react-hooks/exhaustive-deps
|
||||
}, [plan]);
|
||||
}, [task]);
|
||||
|
||||
useEffect(() => {
|
||||
if (
|
||||
|
||||
@ -30,9 +30,6 @@ describe("ChatInterface", () => {
|
||||
it("should render the new message the user has typed", async () => {
|
||||
renderWithProviders(<ChatInterface />, {
|
||||
preloadedState: {
|
||||
task: {
|
||||
completed: false,
|
||||
},
|
||||
agent: {
|
||||
curAgentState: AgentState.INIT,
|
||||
},
|
||||
@ -82,7 +79,10 @@ describe("ChatInterface", () => {
|
||||
userEvent.type(input, "my message{enter}");
|
||||
});
|
||||
|
||||
const event = { action: ActionType.START, args: { task: "my message" } };
|
||||
const event = {
|
||||
action: ActionType.MESSAGE,
|
||||
args: { content: "my message" },
|
||||
};
|
||||
expect(socketSpy).toHaveBeenCalledWith(JSON.stringify(event));
|
||||
});
|
||||
|
||||
|
||||
@ -18,11 +18,8 @@ function ChatInterface() {
|
||||
const { curAgentState } = useSelector((state: RootState) => state.agent);
|
||||
|
||||
const handleSendMessage = (content: string) => {
|
||||
const isTask =
|
||||
curAgentState === AgentState.INIT ||
|
||||
curAgentState === AgentState.FINISHED;
|
||||
dispatch(addUserMessage(content));
|
||||
sendChatMessage(content, isTask);
|
||||
sendChatMessage(content);
|
||||
};
|
||||
|
||||
const { t } = useTranslation();
|
||||
|
||||
@ -3,13 +3,13 @@ import { addAssistantMessage } from "#/state/chatSlice";
|
||||
import { setCode, updatePath } from "#/state/codeSlice";
|
||||
import { appendInput } from "#/state/commandSlice";
|
||||
import { appendJupyterInput } from "#/state/jupyterSlice";
|
||||
import { setPlan } from "#/state/planSlice";
|
||||
import { setRootTask } from "#/state/taskSlice";
|
||||
import store from "#/store";
|
||||
import ActionType from "#/types/ActionType";
|
||||
import { ActionMessage } from "#/types/Message";
|
||||
import { SocketMessage } from "#/types/ResponseType";
|
||||
import { handleObservationMessage } from "./observations";
|
||||
import { getPlan } from "./planService";
|
||||
import { getRootTask } from "./taskService";
|
||||
|
||||
const messageActions = {
|
||||
[ActionType.BROWSE]: (message: ActionMessage) => {
|
||||
@ -41,10 +41,14 @@ const messageActions = {
|
||||
store.dispatch(appendJupyterInput(message.args.code));
|
||||
},
|
||||
[ActionType.ADD_TASK]: () => {
|
||||
getPlan().then((fetchedPlan) => store.dispatch(setPlan(fetchedPlan)));
|
||||
getRootTask().then((fetchedRootTask) =>
|
||||
store.dispatch(setRootTask(fetchedRootTask)),
|
||||
);
|
||||
},
|
||||
[ActionType.MODIFY_TASK]: () => {
|
||||
getPlan().then((fetchedPlan) => store.dispatch(setPlan(fetchedPlan)));
|
||||
getRootTask().then((fetchedRootTask) =>
|
||||
store.dispatch(setRootTask(fetchedRootTask)),
|
||||
);
|
||||
},
|
||||
};
|
||||
|
||||
|
||||
@ -5,13 +5,8 @@ import { ActionMessage } from "#/types/Message";
|
||||
import Socket from "./socket";
|
||||
import { addUserMessage } from "#/state/chatSlice";
|
||||
|
||||
export function sendChatMessage(message: string, isTask: boolean = true): void {
|
||||
let event;
|
||||
if (isTask) {
|
||||
event = { action: ActionType.START, args: { task: message } };
|
||||
} else {
|
||||
event = { action: ActionType.MESSAGE, args: { content: message } };
|
||||
}
|
||||
export function sendChatMessage(message: string): void {
|
||||
const event = { action: ActionType.MESSAGE, args: { content: message } };
|
||||
const eventString = JSON.stringify(event);
|
||||
Socket.send(eventString);
|
||||
}
|
||||
|
||||
@ -1,12 +1,6 @@
|
||||
export type Plan = {
|
||||
mainGoal: string | undefined;
|
||||
task: Task;
|
||||
};
|
||||
|
||||
export type Task = {
|
||||
id: string;
|
||||
goal: string;
|
||||
parent: "Task | None";
|
||||
subtasks: Task[];
|
||||
state: TaskState;
|
||||
};
|
||||
@ -19,15 +13,15 @@ export enum TaskState {
|
||||
VERIFIED_STATE = "verified",
|
||||
}
|
||||
|
||||
export async function getPlan(): Promise<Plan | undefined> {
|
||||
export async function getRootTask(): Promise<Task | undefined> {
|
||||
const headers = new Headers({
|
||||
"Content-Type": "application/json",
|
||||
Authorization: `Bearer ${localStorage.getItem("token")}`,
|
||||
});
|
||||
const res = await fetch("/api/plan", { headers });
|
||||
const res = await fetch("/api/root_task", { headers });
|
||||
if (res.status !== 200 && res.status !== 204) {
|
||||
return undefined;
|
||||
}
|
||||
const data = await res.json();
|
||||
return JSON.parse(data) as Plan;
|
||||
const data = (await res.json()) as Task;
|
||||
return data;
|
||||
}
|
||||
@ -1,27 +0,0 @@
|
||||
import { createSlice } from "@reduxjs/toolkit";
|
||||
import { Plan, TaskState } from "#/services/planService";
|
||||
|
||||
export const planSlice = createSlice({
|
||||
name: "plan",
|
||||
initialState: {
|
||||
plan: {
|
||||
mainGoal: undefined,
|
||||
task: {
|
||||
id: "",
|
||||
goal: "",
|
||||
parent: "Task | None",
|
||||
subtasks: [],
|
||||
state: TaskState.OPEN_STATE,
|
||||
},
|
||||
} as Plan,
|
||||
},
|
||||
reducers: {
|
||||
setPlan: (state, action) => {
|
||||
state.plan = action.payload as Plan;
|
||||
},
|
||||
},
|
||||
});
|
||||
|
||||
export const { setPlan } = planSlice.actions;
|
||||
|
||||
export default planSlice.reducer;
|
||||
@ -1,17 +1,23 @@
|
||||
import { createSlice } from "@reduxjs/toolkit";
|
||||
import { Task, TaskState } from "#/services/taskService";
|
||||
|
||||
export const taskSlice = createSlice({
|
||||
name: "task",
|
||||
initialState: {
|
||||
completed: false,
|
||||
task: {
|
||||
id: "",
|
||||
goal: "",
|
||||
subtasks: [],
|
||||
state: TaskState.OPEN_STATE,
|
||||
} as Task,
|
||||
},
|
||||
reducers: {
|
||||
setCompleted: (state, action) => {
|
||||
state.completed = action.payload;
|
||||
setRootTask: (state, action) => {
|
||||
state.task = action.payload as Task;
|
||||
},
|
||||
},
|
||||
});
|
||||
|
||||
export const { setCompleted } = taskSlice.actions;
|
||||
export const { setRootTask } = taskSlice.actions;
|
||||
|
||||
export default taskSlice.reducer;
|
||||
|
||||
@ -5,7 +5,6 @@ import chatReducer from "./state/chatSlice";
|
||||
import codeReducer from "./state/codeSlice";
|
||||
import commandReducer from "./state/commandSlice";
|
||||
import errorsReducer from "./state/errorsSlice";
|
||||
import planReducer from "./state/planSlice";
|
||||
import taskReducer from "./state/taskSlice";
|
||||
import jupyterReducer from "./state/jupyterSlice";
|
||||
|
||||
@ -14,9 +13,8 @@ export const rootReducer = combineReducers({
|
||||
chat: chatReducer,
|
||||
code: codeReducer,
|
||||
cmd: commandReducer,
|
||||
task: taskReducer,
|
||||
errors: errorsReducer,
|
||||
plan: planReducer,
|
||||
task: taskReducer,
|
||||
agent: agentReducer,
|
||||
jupyter: jupyterReducer,
|
||||
});
|
||||
|
||||
@ -2,9 +2,6 @@ enum ActionType {
|
||||
// Initializes the agent. Only sent by client.
|
||||
INIT = "initialize",
|
||||
|
||||
// Starts a new development task.
|
||||
START = "start",
|
||||
|
||||
// Represents a message from the user or agent.
|
||||
MESSAGE = "message",
|
||||
|
||||
|
||||
@ -3,7 +3,6 @@ from typing import Optional, Type
|
||||
|
||||
from agenthub.codeact_agent.codeact_agent import CodeActAgent
|
||||
from opendevin.controller.agent import Agent
|
||||
from opendevin.controller.state.plan import Plan
|
||||
from opendevin.controller.state.state import State
|
||||
from opendevin.core.config import config
|
||||
from opendevin.core.exceptions import (
|
||||
@ -47,9 +46,9 @@ class AgentController:
|
||||
max_iterations: int
|
||||
runtime: Runtime
|
||||
event_stream: EventStream
|
||||
state: State
|
||||
agent_task: Optional[asyncio.Task] = None
|
||||
delegate: 'AgentController | None' = None
|
||||
state: State | None = None
|
||||
_agent_state: AgentState = AgentState.LOADING
|
||||
_cur_step: int = 0
|
||||
|
||||
@ -60,6 +59,7 @@ class AgentController:
|
||||
sid: str = 'default',
|
||||
max_iterations: int = MAX_ITERATIONS,
|
||||
max_chars: int = MAX_CHARS,
|
||||
inputs: dict | None = None,
|
||||
sandbox: Optional[Sandbox] = None,
|
||||
remind_iterations: bool = config.remind_iterations,
|
||||
):
|
||||
@ -67,14 +67,17 @@ class AgentController:
|
||||
|
||||
Args:
|
||||
agent: The agent instance to control.
|
||||
event_stream: The event stream to publish events to.
|
||||
sid: The session ID of the agent.
|
||||
max_iterations: The maximum number of iterations the agent can run.
|
||||
max_chars: The maximum number of characters the agent can output.
|
||||
inputs: The initial inputs to the agent.
|
||||
sandbox: An optional initialized sandbox to run the agent in. If not provided, a default sandbox will be created based on config.
|
||||
remind_iterations: A boolean value indicating whether to remind the agent its remaining budget of interaction.
|
||||
"""
|
||||
self.id = sid
|
||||
self.agent = agent
|
||||
self.state = State(inputs=inputs or {})
|
||||
self.event_stream = event_stream
|
||||
self.event_stream.subscribe(
|
||||
EventStreamSubscriber.AGENT_CONTROLLER, self.on_event
|
||||
@ -108,14 +111,10 @@ class AgentController:
|
||||
await self.set_agent_state_to(AgentState.STOPPED)
|
||||
|
||||
def update_state_for_step(self, i):
|
||||
if self.state is None:
|
||||
return
|
||||
self.state.iteration = i
|
||||
self.state.background_commands_obs = self.runtime.get_background_obs()
|
||||
|
||||
def update_state_after_step(self):
|
||||
if self.state is None:
|
||||
return
|
||||
self.state.updated_info = []
|
||||
|
||||
async def add_error_to_history(self, message: str):
|
||||
@ -124,8 +123,6 @@ class AgentController:
|
||||
async def add_history(
|
||||
self, action: Action, observation: Observation, add_to_stream=True
|
||||
):
|
||||
if self.state is None:
|
||||
raise ValueError('Added history while state was None')
|
||||
if not isinstance(action, Action):
|
||||
raise TypeError(
|
||||
f'action must be an instance of Action, got {type(action).__name__} instead'
|
||||
@ -141,9 +138,6 @@ class AgentController:
|
||||
await self.event_stream.add_event(observation, EventSource.AGENT)
|
||||
|
||||
async def _run(self):
|
||||
if self.state is None:
|
||||
return
|
||||
|
||||
if self._agent_state != AgentState.RUNNING:
|
||||
raise ValueError('Task is not in running state')
|
||||
|
||||
@ -176,24 +170,18 @@ class AgentController:
|
||||
if final_state == AgentState.RUNNING:
|
||||
await self.set_agent_state_to(AgentState.PAUSED)
|
||||
|
||||
async def setup_task(self, task: str, inputs: dict = {}):
|
||||
"""Sets up the agent controller with a task."""
|
||||
await self.set_agent_state_to(AgentState.INIT)
|
||||
self.state = State(Plan(task))
|
||||
self.state.inputs = inputs
|
||||
|
||||
async def on_event(self, event: Event):
|
||||
if isinstance(event, ChangeAgentStateAction):
|
||||
await self.set_agent_state_to(event.agent_state) # type: ignore
|
||||
elif isinstance(event, MessageAction) and event.source == EventSource.USER:
|
||||
await self.add_history(event, NullObservation(''), add_to_stream=False)
|
||||
if self.get_agent_state() == AgentState.AWAITING_USER_INPUT:
|
||||
if self.get_agent_state() != AgentState.RUNNING:
|
||||
await self.set_agent_state_to(AgentState.RUNNING)
|
||||
|
||||
async def reset_task(self):
|
||||
if self.agent_task is not None:
|
||||
self.agent_task.cancel()
|
||||
self.state = None
|
||||
self.state = State()
|
||||
self._cur_step = 0
|
||||
self.agent.reset()
|
||||
|
||||
@ -214,11 +202,7 @@ class AgentController:
|
||||
self._cur_step += 1
|
||||
if self.agent_task is not None:
|
||||
self.agent_task.cancel()
|
||||
elif (
|
||||
new_state == AgentState.STOPPED
|
||||
or new_state == AgentState.ERROR
|
||||
or new_state == AgentState.FINISHED
|
||||
):
|
||||
elif new_state == AgentState.STOPPED or new_state == AgentState.ERROR:
|
||||
await self.reset_task()
|
||||
|
||||
await self.event_stream.add_event(
|
||||
@ -238,9 +222,8 @@ class AgentController:
|
||||
event_stream=self.event_stream,
|
||||
max_iterations=self.max_iterations,
|
||||
max_chars=self.max_chars,
|
||||
inputs=action.inputs,
|
||||
)
|
||||
task = action.inputs.get('task') or ''
|
||||
await self.delegate.setup_task(task, action.inputs)
|
||||
|
||||
def add_iteration_reminder_when_needed(self, i: int, obs: Observation):
|
||||
"""Add iteration reminder to the observation if needed.
|
||||
@ -254,8 +237,6 @@ class AgentController:
|
||||
return obs
|
||||
|
||||
async def step(self, i: int) -> bool:
|
||||
if self.state is None:
|
||||
raise ValueError('No task to run')
|
||||
if self.delegate is not None:
|
||||
delegate_done = await self.delegate.step(i)
|
||||
if delegate_done:
|
||||
@ -267,8 +248,6 @@ class AgentController:
|
||||
return False
|
||||
|
||||
logger.info(f'STEP {i}', extra={'msg_type': 'STEP'})
|
||||
if i == 0:
|
||||
logger.info(self.state.plan.main_goal, extra={'msg_type': 'PLAN'})
|
||||
if self.state.num_of_chars > self.max_chars:
|
||||
raise MaxCharsExceedError(self.state.num_of_chars, self.max_chars)
|
||||
|
||||
@ -303,9 +282,11 @@ class AgentController:
|
||||
elif isinstance(action, AgentDelegateAction):
|
||||
await self.start_delegate(action)
|
||||
elif isinstance(action, AddTaskAction):
|
||||
self.state.plan.add_subtask(action.parent, action.goal, action.subtasks)
|
||||
self.state.root_task.add_subtask(
|
||||
action.parent, action.goal, action.subtasks
|
||||
)
|
||||
elif isinstance(action, ModifyTaskAction):
|
||||
self.state.plan.set_subtask_state(action.id, action.state)
|
||||
self.state.root_task.set_subtask_state(action.id, action.state)
|
||||
elif not isinstance(observation, ErrorObservation):
|
||||
observation = await self.runtime.run_action(action)
|
||||
|
||||
@ -322,11 +303,7 @@ class AgentController:
|
||||
# check if delegate stuck
|
||||
if self.delegate and self.delegate._is_stuck():
|
||||
return True
|
||||
if (
|
||||
self.state is None
|
||||
or self.state.history is None
|
||||
or len(self.state.history) < 3
|
||||
):
|
||||
if len(self.state.history) < 3:
|
||||
return False
|
||||
|
||||
# if the last three (Action, Observation) tuples are too repetitive
|
||||
|
||||
@ -1,8 +1,9 @@
|
||||
from dataclasses import dataclass, field
|
||||
|
||||
from opendevin.controller.state.plan import Plan
|
||||
from opendevin.controller.state.task import RootTask
|
||||
from opendevin.events.action import (
|
||||
Action,
|
||||
MessageAction,
|
||||
)
|
||||
from opendevin.events.observation import (
|
||||
CmdOutputObservation,
|
||||
@ -12,7 +13,7 @@ from opendevin.events.observation import (
|
||||
|
||||
@dataclass
|
||||
class State:
|
||||
plan: Plan
|
||||
root_task: RootTask = field(default_factory=RootTask)
|
||||
iteration: int = 0
|
||||
# number of characters we have sent to and received from LLM so far for current task
|
||||
num_of_chars: int = 0
|
||||
@ -21,3 +22,11 @@ class State:
|
||||
updated_info: list[tuple[Action, Observation]] = field(default_factory=list)
|
||||
inputs: dict = field(default_factory=dict)
|
||||
outputs: dict = field(default_factory=dict)
|
||||
|
||||
def get_current_user_intent(self):
|
||||
# TODO: this is used to understand the user's main goal, but it's possible
|
||||
# the latest message is an interruption. We should look for a space where
|
||||
# the agent goes to FINISHED, and then look for the next user message.
|
||||
for action, obs in reversed(self.history):
|
||||
if isinstance(action, MessageAction) and action.source == 'user':
|
||||
return action.content
|
||||
|
||||
@ -1,4 +1,7 @@
|
||||
from opendevin.core.exceptions import PlanInvalidStateError
|
||||
from opendevin.core.exceptions import (
|
||||
AgentMalformedActionError,
|
||||
TaskInvalidStateError,
|
||||
)
|
||||
from opendevin.core.logger import opendevin_logger as logger
|
||||
|
||||
OPEN_STATE = 'open'
|
||||
@ -23,7 +26,7 @@ class Task:
|
||||
|
||||
def __init__(
|
||||
self,
|
||||
parent: 'Task | None',
|
||||
parent: 'Task',
|
||||
goal: str,
|
||||
state: str = OPEN_STATE,
|
||||
subtasks: list = [],
|
||||
@ -36,10 +39,10 @@ class Task:
|
||||
state: The initial state of the task.
|
||||
subtasks: A list of subtasks associated with this task.
|
||||
"""
|
||||
if parent is None:
|
||||
self.id = '0'
|
||||
else:
|
||||
if parent.id:
|
||||
self.id = parent.id + '.' + str(len(parent.subtasks))
|
||||
else:
|
||||
self.id = str(len(parent.subtasks))
|
||||
self.parent = parent
|
||||
self.goal = goal
|
||||
self.subtasks = []
|
||||
@ -98,11 +101,11 @@ class Task:
|
||||
Args: state: The new state of the task.
|
||||
|
||||
Raises:
|
||||
PlanInvalidStateError: If the provided state is invalid.
|
||||
TaskInvalidStateError: If the provided state is invalid.
|
||||
"""
|
||||
if state not in STATES:
|
||||
logger.error('Invalid state: %s', state)
|
||||
raise PlanInvalidStateError(state)
|
||||
raise TaskInvalidStateError(state)
|
||||
self.state = state
|
||||
if (
|
||||
state == COMPLETED_STATE
|
||||
@ -130,33 +133,35 @@ class Task:
|
||||
return None
|
||||
|
||||
|
||||
class Plan:
|
||||
"""Represents a plan consisting of tasks.
|
||||
class RootTask(Task):
|
||||
"""Serves as the root node in a tree of tasks.
|
||||
Because we want the top-level of the root_task to be a list of tasks (1, 2, 3, etc.),
|
||||
the "root node" of the data structure is kind of invisible--it just
|
||||
holds references to the top-level tasks.
|
||||
|
||||
Attributes:
|
||||
main_goal: The main goal of the plan.
|
||||
task: The root task of the plan.
|
||||
id: Kept blank for root_task
|
||||
goal: Kept blank for root_task
|
||||
parent: None for root_task
|
||||
subtasks: The top-level list of tasks associated with the root_task.
|
||||
state: The state of the root_task.
|
||||
"""
|
||||
|
||||
main_goal: str
|
||||
task: Task
|
||||
id: str = ''
|
||||
goal: str = ''
|
||||
parent: None = None
|
||||
|
||||
def __init__(self, task: str):
|
||||
"""Initializes a new instance of the Plan class.
|
||||
|
||||
Args:
|
||||
task: The main goal of the plan.
|
||||
"""
|
||||
self.main_goal = task
|
||||
self.task = Task(parent=None, goal=task, subtasks=[])
|
||||
def __init__(self):
|
||||
self.subtasks = []
|
||||
self.state = OPEN_STATE
|
||||
|
||||
def __str__(self):
|
||||
"""Returns a string representation of the plan.
|
||||
"""Returns a string representation of the root_task.
|
||||
|
||||
Returns:
|
||||
A string representation of the plan.
|
||||
A string representation of the root_task.
|
||||
"""
|
||||
return self.task.to_string()
|
||||
return self.to_string()
|
||||
|
||||
def get_task_by_id(self, id: str) -> Task:
|
||||
"""Retrieves a task by its ID.
|
||||
@ -168,19 +173,20 @@ class Plan:
|
||||
The task with the specified ID.
|
||||
|
||||
Raises:
|
||||
ValueError: If the provided task ID is invalid or does not exist.
|
||||
AgentMalformedActionError: If the provided task ID is invalid or does not exist.
|
||||
"""
|
||||
if id == '':
|
||||
return self
|
||||
if len(self.subtasks) == 0:
|
||||
raise AgentMalformedActionError('Task does not exist:' + id)
|
||||
try:
|
||||
parts = [int(p) for p in id.split('.')]
|
||||
except ValueError:
|
||||
raise ValueError('Invalid task id, non-integer:' + id)
|
||||
if parts[0] != 0:
|
||||
raise ValueError('Invalid task id, must start with 0:' + id)
|
||||
parts = parts[1:]
|
||||
task = self.task
|
||||
raise AgentMalformedActionError('Invalid task id:' + id)
|
||||
task: Task = self
|
||||
for part in parts:
|
||||
if part >= len(task.subtasks):
|
||||
raise ValueError('Task does not exist:' + id)
|
||||
raise AgentMalformedActionError('Task does not exist:' + id)
|
||||
task = task.subtasks[part]
|
||||
return task
|
||||
|
||||
@ -205,11 +211,10 @@ class Plan:
|
||||
"""
|
||||
task = self.get_task_by_id(id)
|
||||
task.set_state(state)
|
||||
|
||||
def get_current_task(self):
|
||||
"""Retrieves the current task in progress.
|
||||
|
||||
Returns:
|
||||
The current task in progress, or None if no task is in progress.
|
||||
"""
|
||||
return self.task.get_current_task()
|
||||
unfinished_tasks = [
|
||||
t
|
||||
for t in self.subtasks
|
||||
if t.state not in [COMPLETED_STATE, VERIFIED_STATE, ABANDONED_STATE]
|
||||
]
|
||||
if len(unfinished_tasks) == 0:
|
||||
self.set_state(COMPLETED_STATE)
|
||||
@ -49,7 +49,7 @@ class SandboxInvalidBackgroundCommandError(Exception):
|
||||
super().__init__(message)
|
||||
|
||||
|
||||
class PlanInvalidStateError(Exception):
|
||||
class TaskInvalidStateError(Exception):
|
||||
def __init__(self, state=None):
|
||||
if state is not None:
|
||||
message = f'Invalid state {state}'
|
||||
|
||||
@ -76,7 +76,7 @@ async def main(task_str: str = '', exit_on_message: bool = False) -> None:
|
||||
event_stream=event_stream,
|
||||
)
|
||||
|
||||
await controller.setup_task(task)
|
||||
await event_stream.add_event(MessageAction(content=task), EventSource.USER)
|
||||
await event_stream.add_event(
|
||||
ChangeAgentStateAction(agent_state=AgentState.RUNNING), EventSource.USER
|
||||
)
|
||||
|
||||
@ -75,16 +75,6 @@ class AgentUnit:
|
||||
ChangeAgentStateAction(AgentState.INIT), EventSource.USER
|
||||
)
|
||||
return
|
||||
elif action == ActionType.START:
|
||||
if self.controller is None:
|
||||
await self.send_error('No agent started.')
|
||||
return
|
||||
task = data['args']['task']
|
||||
await self.controller.setup_task(task)
|
||||
await self.event_stream.add_event(
|
||||
ChangeAgentStateAction(agent_state=AgentState.RUNNING), EventSource.USER
|
||||
)
|
||||
return
|
||||
|
||||
action_dict = data.copy()
|
||||
action_dict['action'] = action
|
||||
|
||||
@ -1,4 +1,3 @@
|
||||
import json
|
||||
import shutil
|
||||
import uuid
|
||||
import warnings
|
||||
@ -82,11 +81,11 @@ async def websocket_endpoint(websocket: WebSocket):
|
||||
```json
|
||||
{"action": "recall", "args": {"query": "past projects"}}
|
||||
```
|
||||
- Add a task to the plan:
|
||||
- Add a task to the root_task:
|
||||
```json
|
||||
{"action": "add_task", "args": {"task": "Implement feature X"}}
|
||||
```
|
||||
- Update a task in the plan:
|
||||
- Update a task in the root_task:
|
||||
```json
|
||||
{"action": "modify_task", "args": {"id": "0", "state": "in_progress", "thought": ""}}
|
||||
```
|
||||
@ -293,16 +292,16 @@ async def upload_file(file: UploadFile):
|
||||
return {'filename': file.filename, 'location': str(file_path)}
|
||||
|
||||
|
||||
@app.get('/api/plan')
|
||||
def get_plan(
|
||||
@app.get('/api/root_task')
|
||||
def get_root_task(
|
||||
credentials: HTTPAuthorizationCredentials = Depends(security_scheme),
|
||||
):
|
||||
"""
|
||||
Get plan.
|
||||
Get root_task.
|
||||
|
||||
To get the plan:
|
||||
To get the root_task:
|
||||
```sh
|
||||
curl -H "Authorization: Bearer <TOKEN>" http://localhost:3000/api/plan
|
||||
curl -H "Authorization: Bearer <TOKEN>" http://localhost:3000/api/root_task
|
||||
```
|
||||
"""
|
||||
sid = get_sid_from_token(credentials.credentials)
|
||||
@ -310,15 +309,10 @@ def get_plan(
|
||||
controller = agent.controller
|
||||
if controller is not None:
|
||||
state = controller.get_state()
|
||||
if state is not None:
|
||||
if state:
|
||||
return JSONResponse(
|
||||
status_code=status.HTTP_200_OK,
|
||||
content=json.dumps(
|
||||
{
|
||||
'mainGoal': state.plan.main_goal,
|
||||
'task': state.plan.task.to_dict(),
|
||||
}
|
||||
),
|
||||
content=state.root_task.to_dict(),
|
||||
)
|
||||
return Response(status_code=status.HTTP_204_NO_CONTENT)
|
||||
|
||||
|
||||
@ -216,4 +216,6 @@ The server is running on port 5000 with PID 126. You can access the list of numb
|
||||
|
||||
NOW, LET'S START!
|
||||
|
||||
----------
|
||||
|
||||
Fix typos in bad.txt. Do not ask me for confirmation at any point.
|
||||
|
||||
@ -216,11 +216,14 @@ The server is running on port 5000 with PID 126. You can access the list of numb
|
||||
|
||||
NOW, LET'S START!
|
||||
|
||||
----------
|
||||
|
||||
Fix typos in bad.txt. Do not ask me for confirmation at any point.
|
||||
|
||||
----------
|
||||
|
||||
Sure! Let's first take a look at the content of the file `bad.txt` to identify the typos that need to be fixed. Let me display the content of the file:
|
||||
Let's start by examining the contents of `bad.txt` to identify the typos. I'll display the content first.
|
||||
|
||||
<execute_bash>
|
||||
cat bad.txt
|
||||
</execute_bash>
|
||||
|
||||
@ -216,11 +216,14 @@ The server is running on port 5000 with PID 126. You can access the list of numb
|
||||
|
||||
NOW, LET'S START!
|
||||
|
||||
----------
|
||||
|
||||
Fix typos in bad.txt. Do not ask me for confirmation at any point.
|
||||
|
||||
----------
|
||||
|
||||
Sure! Let's first take a look at the content of the file `bad.txt` to identify the typos that need to be fixed. Let me display the content of the file:
|
||||
Let's start by examining the contents of `bad.txt` to identify the typos. I'll display the content first.
|
||||
|
||||
<execute_bash>
|
||||
cat bad.txt
|
||||
</execute_bash>
|
||||
@ -238,19 +241,26 @@ ENVIRONMENT REMINDER: You have 9 turns left to complete the task.
|
||||
|
||||
----------
|
||||
|
||||
I see the typos that need to be fixed in the file `bad.txt`. Let's correct them without asking for confirmation. Let me open the file for editing:
|
||||
I've identified the typos in the file. Here are the corrections:
|
||||
- "typoo" should be "typo"
|
||||
- "mor" should be "more"
|
||||
|
||||
I will now proceed to correct these typos in `bad.txt`.
|
||||
|
||||
<execute_bash>
|
||||
open bad.txt
|
||||
edit 1:1
|
||||
This is a stupid typo.
|
||||
end_of_edit
|
||||
edit 3:3
|
||||
No more typos!
|
||||
end_of_edit
|
||||
</execute_bash>
|
||||
|
||||
----------
|
||||
|
||||
OBSERVATION:
|
||||
[File: /workspace/bad.txt (4 lines total)]
|
||||
1:This is a stupid typoo.
|
||||
2:Really?
|
||||
3:No mor typos!
|
||||
4:Enjoy!
|
||||
> > No file open. Use the `open` command first.
|
||||
> > No file open. Use the `open` command first.
|
||||
|
||||
ENVIRONMENT REMINDER: You have 8 turns left to complete the task.
|
||||
[Command -1 finished with exit code 0]]
|
||||
|
||||
@ -216,11 +216,14 @@ The server is running on port 5000 with PID 126. You can access the list of numb
|
||||
|
||||
NOW, LET'S START!
|
||||
|
||||
----------
|
||||
|
||||
Fix typos in bad.txt. Do not ask me for confirmation at any point.
|
||||
|
||||
----------
|
||||
|
||||
Sure! Let's first take a look at the content of the file `bad.txt` to identify the typos that need to be fixed. Let me display the content of the file:
|
||||
Let's start by examining the contents of `bad.txt` to identify the typos. I'll display the content first.
|
||||
|
||||
<execute_bash>
|
||||
cat bad.txt
|
||||
</execute_bash>
|
||||
@ -238,9 +241,42 @@ ENVIRONMENT REMINDER: You have 9 turns left to complete the task.
|
||||
|
||||
----------
|
||||
|
||||
I see the typos that need to be fixed in the file `bad.txt`. Let's correct them without asking for confirmation. Let me open the file for editing:
|
||||
I've identified the typos in the file. Here are the corrections:
|
||||
- "typoo" should be "typo"
|
||||
- "mor" should be "more"
|
||||
|
||||
I will now proceed to correct these typos in `bad.txt`.
|
||||
|
||||
<execute_bash>
|
||||
edit 1:1
|
||||
This is a stupid typo.
|
||||
end_of_edit
|
||||
edit 3:3
|
||||
No more typos!
|
||||
end_of_edit
|
||||
</execute_bash>
|
||||
|
||||
----------
|
||||
|
||||
OBSERVATION:
|
||||
> > No file open. Use the `open` command first.
|
||||
> > No file open. Use the `open` command first.
|
||||
|
||||
ENVIRONMENT REMINDER: You have 8 turns left to complete the task.
|
||||
[Command -1 finished with exit code 0]]
|
||||
|
||||
----------
|
||||
|
||||
It seems I forgot to open the file before attempting to edit it. Let me open `bad.txt` and then proceed with the corrections.
|
||||
|
||||
<execute_bash>
|
||||
open bad.txt
|
||||
edit 1:1
|
||||
This is a stupid typo.
|
||||
end_of_edit
|
||||
edit 3:3
|
||||
No more typos!
|
||||
end_of_edit
|
||||
</execute_bash>
|
||||
|
||||
----------
|
||||
@ -250,26 +286,14 @@ OBSERVATION:
|
||||
1:This is a stupid typoo.
|
||||
2:Really?
|
||||
3:No mor typos!
|
||||
4:Enjoy!
|
||||
|
||||
ENVIRONMENT REMINDER: You have 8 turns left to complete the task.
|
||||
[Command -1 finished with exit code 0]]
|
||||
|
||||
----------
|
||||
|
||||
I have opened the file `bad.txt` for editing. Let's correct the typos without asking for confirmation. Let me update the file:
|
||||
<execute_bash>
|
||||
edit 1:3
|
||||
This is a stupid typo.
|
||||
Really?
|
||||
No more typos!
|
||||
end_of_edit
|
||||
</execute_bash>
|
||||
|
||||
----------
|
||||
|
||||
OBSERVATION:
|
||||
> > > > [File: /workspace/bad.txt (4 lines total)]
|
||||
4:Enjoy!
|
||||
> > [File: /workspace/bad.txt (4 lines total)]
|
||||
1:This is a stupid typo.
|
||||
2:Really?
|
||||
3:No mor typos!
|
||||
4:Enjoy!
|
||||
File updated. Please review the changes and make sure they are correct (correct indentation, no duplicate lines, etc). Edit the file again if necessary.
|
||||
> > [File: /workspace/bad.txt (4 lines total)]
|
||||
1:This is a stupid typo.
|
||||
2:Really?
|
||||
3:No more typos!
|
||||
|
||||
@ -1,3 +1,4 @@
|
||||
Sure! Let's first take a look at the content of the file `bad.txt` to identify the typos that need to be fixed. Let me display the content of the file:
|
||||
Let's start by examining the contents of `bad.txt` to identify the typos. I'll display the content first.
|
||||
|
||||
<execute_bash>
|
||||
cat bad.txt
|
||||
|
||||
@ -1,3 +1,13 @@
|
||||
I see the typos that need to be fixed in the file `bad.txt`. Let's correct them without asking for confirmation. Let me open the file for editing:
|
||||
I've identified the typos in the file. Here are the corrections:
|
||||
- "typoo" should be "typo"
|
||||
- "mor" should be "more"
|
||||
|
||||
I will now proceed to correct these typos in `bad.txt`.
|
||||
|
||||
<execute_bash>
|
||||
open bad.txt
|
||||
edit 1:1
|
||||
This is a stupid typo.
|
||||
end_of_edit
|
||||
edit 3:3
|
||||
No more typos!
|
||||
end_of_edit
|
||||
|
||||
@ -1,7 +1,10 @@
|
||||
I have opened the file `bad.txt` for editing. Let's correct the typos without asking for confirmation. Let me update the file:
|
||||
It seems I forgot to open the file before attempting to edit it. Let me open `bad.txt` and then proceed with the corrections.
|
||||
|
||||
<execute_bash>
|
||||
edit 1:3
|
||||
open bad.txt
|
||||
edit 1:1
|
||||
This is a stupid typo.
|
||||
Really?
|
||||
end_of_edit
|
||||
edit 3:3
|
||||
No more typos!
|
||||
end_of_edit
|
||||
|
||||
@ -1 +1,8 @@
|
||||
The typos in the file `bad.txt` have been corrected. Let's save the changes and close the file. Now, the file should be free of typos. If you have any more tasks or questions, feel free to let me know!
|
||||
The typos in `bad.txt` have been successfully corrected. Here's the final content of the file:
|
||||
|
||||
1. This is a stupid typo.
|
||||
2. Really?
|
||||
3. No more typos!
|
||||
4. Enjoy!
|
||||
|
||||
The task is completed. If you have any more requests or need further assistance, feel free to let me know!
|
||||
|
||||
@ -216,4 +216,6 @@ The server is running on port 5000 with PID 126. You can access the list of numb
|
||||
|
||||
NOW, LET'S START!
|
||||
|
||||
----------
|
||||
|
||||
Use Jupyter IPython to write a text file containing 'hello world' to '/workspace/test.txt'. Do not ask me for confirmation at any point.
|
||||
|
||||
@ -216,19 +216,21 @@ The server is running on port 5000 with PID 126. You can access the list of numb
|
||||
|
||||
NOW, LET'S START!
|
||||
|
||||
----------
|
||||
|
||||
Use Jupyter IPython to write a text file containing 'hello world' to '/workspace/test.txt'. Do not ask me for confirmation at any point.
|
||||
|
||||
----------
|
||||
|
||||
Sure! Let me create a text file with 'hello world' content in '/workspace/test.txt':
|
||||
<execute_bash>
|
||||
echo 'hello world' > /workspace/test.txt
|
||||
</execute_bash>
|
||||
I will write the text 'hello world' to a file named 'test.txt' in the '/workspace' directory without asking for confirmation. Let me execute the code to create the file:
|
||||
<execute_ipython>
|
||||
with open('/workspace/test.txt', 'w') as f:
|
||||
f.write('hello world')
|
||||
</execute_ipython>
|
||||
|
||||
----------
|
||||
|
||||
OBSERVATION:
|
||||
|
||||
[Code executed successfully with no output]
|
||||
|
||||
ENVIRONMENT REMINDER: You have 9 turns left to complete the task.
|
||||
[Command -1 finished with exit code 0]]
|
||||
|
||||
@ -1,3 +1,4 @@
|
||||
Sure! Let me create a text file with 'hello world' content in '/workspace/test.txt':
|
||||
<execute_bash>
|
||||
echo 'hello world' > /workspace/test.txt
|
||||
I will write the text 'hello world' to a file named 'test.txt' in the '/workspace' directory without asking for confirmation. Let me execute the code to create the file:
|
||||
<execute_ipython>
|
||||
with open('/workspace/test.txt', 'w') as f:
|
||||
f.write('hello world')
|
||||
|
||||
@ -1 +1 @@
|
||||
Great! The text file with 'hello world' content has been successfully created in '/workspace/test.txt'. If you need any further assistance or have any more tasks in mind, feel free to let me know!
|
||||
The text file 'test.txt' with the content 'hello world' has been successfully created in the '/workspace' directory. If you have any more tasks or questions, feel free to let me know!
|
||||
|
||||
@ -216,4 +216,6 @@ The server is running on port 5000 with PID 126. You can access the list of numb
|
||||
|
||||
NOW, LET'S START!
|
||||
|
||||
----------
|
||||
|
||||
Write a shell script 'hello.sh' that prints 'hello'. Do not ask me for confirmation at any point.
|
||||
|
||||
@ -216,19 +216,24 @@ The server is running on port 5000 with PID 126. You can access the list of numb
|
||||
|
||||
NOW, LET'S START!
|
||||
|
||||
----------
|
||||
|
||||
Write a shell script 'hello.sh' that prints 'hello'. Do not ask me for confirmation at any point.
|
||||
|
||||
----------
|
||||
|
||||
I will create a shell script named 'hello.sh' that prints 'hello' without asking for confirmation. Let's proceed with creating the script:
|
||||
Sure! I will create a shell script named 'hello.sh' that prints 'hello' without asking for confirmation. Let me write the script for you:
|
||||
<execute_bash>
|
||||
echo "echo 'hello'" > hello.sh
|
||||
cat > hello.sh << 'EOF'
|
||||
#!/bin/bash
|
||||
echo "hello"
|
||||
EOF
|
||||
</execute_bash>
|
||||
|
||||
----------
|
||||
|
||||
OBSERVATION:
|
||||
|
||||
> > >
|
||||
|
||||
ENVIRONMENT REMINDER: You have 9 turns left to complete the task.
|
||||
[Command -1 finished with exit code 0]]
|
||||
|
||||
@ -1,3 +1,6 @@
|
||||
I will create a shell script named 'hello.sh' that prints 'hello' without asking for confirmation. Let's proceed with creating the script:
|
||||
Sure! I will create a shell script named 'hello.sh' that prints 'hello' without asking for confirmation. Let me write the script for you:
|
||||
<execute_bash>
|
||||
echo "echo 'hello'" > hello.sh
|
||||
cat > hello.sh << 'EOF'
|
||||
#!/bin/bash
|
||||
echo "hello"
|
||||
EOF
|
||||
|
||||
@ -1 +1 @@
|
||||
The shell script 'hello.sh' has been successfully created. You can run it to print 'hello'. If you need any further assistance or have any more requests, feel free to let me know!
|
||||
The shell script 'hello.sh' has been successfully created. You can run it to see the output "hello". If you have any more requests or questions, feel free to ask!
|
||||
|
||||
@ -318,6 +318,18 @@ This is your internal monologue, in JSON format:
|
||||
"content": "It seems like there might be an existing project here. I should probably start by running `pwd` and `ls` to orient myself.",
|
||||
"wait_for_response": false
|
||||
}
|
||||
},
|
||||
{
|
||||
"action": "message",
|
||||
"args": {
|
||||
"content": "Fix typos in bad.txt. Do not ask me for confirmation at any point.",
|
||||
"wait_for_response": false
|
||||
}
|
||||
},
|
||||
{
|
||||
"observation": "null",
|
||||
"content": "",
|
||||
"extras": {}
|
||||
}
|
||||
]
|
||||
|
||||
@ -367,5 +379,3 @@ Notes:
|
||||
* whenever an action fails, always send a `message` about why it may have happened before acting again.
|
||||
|
||||
What is your next single thought or action? Again, you must reply with JSON, and only with JSON. You must respond with exactly one 'action' object.
|
||||
|
||||
You've been thinking a lot lately. Maybe it's time to take action?
|
||||
|
||||
@ -319,6 +319,18 @@ This is your internal monologue, in JSON format:
|
||||
"wait_for_response": false
|
||||
}
|
||||
},
|
||||
{
|
||||
"action": "message",
|
||||
"args": {
|
||||
"content": "Fix typos in bad.txt. Do not ask me for confirmation at any point.",
|
||||
"wait_for_response": false
|
||||
}
|
||||
},
|
||||
{
|
||||
"observation": "null",
|
||||
"content": "",
|
||||
"extras": {}
|
||||
},
|
||||
{
|
||||
"action": "read",
|
||||
"args": {
|
||||
|
||||
@ -319,6 +319,18 @@ This is your internal monologue, in JSON format:
|
||||
"wait_for_response": false
|
||||
}
|
||||
},
|
||||
{
|
||||
"action": "message",
|
||||
"args": {
|
||||
"content": "Fix typos in bad.txt. Do not ask me for confirmation at any point.",
|
||||
"wait_for_response": false
|
||||
}
|
||||
},
|
||||
{
|
||||
"observation": "null",
|
||||
"content": "",
|
||||
"extras": {}
|
||||
},
|
||||
{
|
||||
"action": "read",
|
||||
"args": {
|
||||
|
||||
@ -318,6 +318,18 @@ This is your internal monologue, in JSON format:
|
||||
"content": "It seems like there might be an existing project here. I should probably start by running `pwd` and `ls` to orient myself.",
|
||||
"wait_for_response": false
|
||||
}
|
||||
},
|
||||
{
|
||||
"action": "message",
|
||||
"args": {
|
||||
"content": "Write a shell script 'hello.sh' that prints 'hello'. Do not ask me for confirmation at any point.",
|
||||
"wait_for_response": false
|
||||
}
|
||||
},
|
||||
{
|
||||
"observation": "null",
|
||||
"content": "",
|
||||
"extras": {}
|
||||
}
|
||||
]
|
||||
|
||||
@ -367,5 +379,3 @@ Notes:
|
||||
* whenever an action fails, always send a `message` about why it may have happened before acting again.
|
||||
|
||||
What is your next single thought or action? Again, you must reply with JSON, and only with JSON. You must respond with exactly one 'action' object.
|
||||
|
||||
You've been thinking a lot lately. Maybe it's time to take action?
|
||||
|
||||
@ -319,6 +319,18 @@ This is your internal monologue, in JSON format:
|
||||
"wait_for_response": false
|
||||
}
|
||||
},
|
||||
{
|
||||
"action": "message",
|
||||
"args": {
|
||||
"content": "Write a shell script 'hello.sh' that prints 'hello'. Do not ask me for confirmation at any point.",
|
||||
"wait_for_response": false
|
||||
}
|
||||
},
|
||||
{
|
||||
"observation": "null",
|
||||
"content": "",
|
||||
"extras": {}
|
||||
},
|
||||
{
|
||||
"action": "write",
|
||||
"args": {
|
||||
|
||||
@ -16,8 +16,8 @@ As you complete this task, you're building a plan and keeping
|
||||
track of your progress. Here's a JSON representation of your plan:
|
||||
|
||||
{
|
||||
"id": "0",
|
||||
"goal": "Fix typos in bad.txt. Do not ask me for confirmation at any point.",
|
||||
"id": "",
|
||||
"goal": "",
|
||||
"state": "open",
|
||||
"subtasks": []
|
||||
}
|
||||
@ -51,7 +51,15 @@ Here is a recent history of actions you've taken in service of this plan,
|
||||
as well as observations you've made. This only includes the MOST RECENT
|
||||
ten actions--more happened before that.
|
||||
|
||||
[]
|
||||
[
|
||||
{
|
||||
"action": "message",
|
||||
"args": {
|
||||
"content": "Fix typos in bad.txt. Do not ask me for confirmation at any point.",
|
||||
"wait_for_response": false
|
||||
}
|
||||
}
|
||||
]
|
||||
|
||||
|
||||
Your most recent action is at the bottom of that history.
|
||||
@ -78,7 +86,7 @@ It must be an object, and it must contain two fields:
|
||||
* `message` - make a plan, set a goal, or record your thoughts. Arguments:
|
||||
* `content` - the message to record
|
||||
* `add_task` - add a task to your plan. Arguments:
|
||||
* `parent` - the ID of the parent task
|
||||
* `parent` - the ID of the parent task (leave empty if it should go at the top level)
|
||||
* `goal` - the goal of the task
|
||||
* `subtasks` - a list of subtasks, each of which is a map with a `goal` key.
|
||||
* `modify_task` - close a task. Arguments:
|
||||
@ -91,3 +99,6 @@ 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.
|
||||
|
||||
What is your next thought or action? Again, you must reply with JSON, and only with JSON.
|
||||
|
||||
Look at your last thought in the history above. What does it suggest? Don't think anymore--take action.
|
||||
|
||||
|
||||
@ -16,16 +16,14 @@ As you complete this task, you're building a plan and keeping
|
||||
track of your progress. Here's a JSON representation of your plan:
|
||||
|
||||
{
|
||||
"id": "0",
|
||||
"goal": "Fix typos in bad.txt. Do not ask me for confirmation at any point.",
|
||||
"state": "in_progress",
|
||||
"id": "",
|
||||
"goal": "",
|
||||
"state": "open",
|
||||
"subtasks": []
|
||||
}
|
||||
|
||||
|
||||
You're currently working on this task:
|
||||
Fix typos in bad.txt. Do not ask me for confirmation at any point..
|
||||
If it's not achievable AND verifiable with a SINGLE action, you MUST break it down into subtasks NOW.
|
||||
You're not currently working on any tasks. Your next action MUST be to mark a task as in_progress.
|
||||
|
||||
You're responsible for managing this plan and the status of tasks in
|
||||
it, by using the `add_task` and `modify_task` actions described below.
|
||||
@ -55,12 +53,27 @@ ten actions--more happened before that.
|
||||
|
||||
[
|
||||
{
|
||||
"action": "modify_task",
|
||||
"action": "message",
|
||||
"args": {
|
||||
"id": "0",
|
||||
"state": "in_progress",
|
||||
"content": "Fix typos in bad.txt. Do not ask me for confirmation at any point.",
|
||||
"wait_for_response": false
|
||||
}
|
||||
},
|
||||
{
|
||||
"action": "read",
|
||||
"args": {
|
||||
"path": "bad.txt",
|
||||
"start": 0,
|
||||
"end": -1,
|
||||
"thought": ""
|
||||
}
|
||||
},
|
||||
{
|
||||
"observation": "read",
|
||||
"content": "This is a stupid typoo.\nReally?\nNo mor typos!\nEnjoy!\n",
|
||||
"extras": {
|
||||
"path": "bad.txt"
|
||||
}
|
||||
}
|
||||
]
|
||||
|
||||
@ -89,7 +102,7 @@ It must be an object, and it must contain two fields:
|
||||
* `message` - make a plan, set a goal, or record your thoughts. Arguments:
|
||||
* `content` - the message to record
|
||||
* `add_task` - add a task to your plan. Arguments:
|
||||
* `parent` - the ID of the parent task
|
||||
* `parent` - the ID of the parent task (leave empty if it should go at the top level)
|
||||
* `goal` - the goal of the task
|
||||
* `subtasks` - a list of subtasks, each of which is a map with a `goal` key.
|
||||
* `modify_task` - close a task. Arguments:
|
||||
@ -103,4 +116,4 @@ actions are all `message` actions, you should consider taking a different action
|
||||
|
||||
What is your next thought or action? Again, you must reply with JSON, and only with JSON.
|
||||
|
||||
You should think about the next action to take.
|
||||
You should think about the file you just read, what you learned from it, and how that affects your plan.
|
||||
|
||||
@ -16,16 +16,14 @@ As you complete this task, you're building a plan and keeping
|
||||
track of your progress. Here's a JSON representation of your plan:
|
||||
|
||||
{
|
||||
"id": "0",
|
||||
"goal": "Fix typos in bad.txt. Do not ask me for confirmation at any point.",
|
||||
"state": "in_progress",
|
||||
"id": "",
|
||||
"goal": "",
|
||||
"state": "open",
|
||||
"subtasks": []
|
||||
}
|
||||
|
||||
|
||||
You're currently working on this task:
|
||||
Fix typos in bad.txt. Do not ask me for confirmation at any point..
|
||||
If it's not achievable AND verifiable with a SINGLE action, you MUST break it down into subtasks NOW.
|
||||
You're not currently working on any tasks. Your next action MUST be to mark a task as in_progress.
|
||||
|
||||
You're responsible for managing this plan and the status of tasks in
|
||||
it, by using the `add_task` and `modify_task` actions described below.
|
||||
@ -55,18 +53,43 @@ ten actions--more happened before that.
|
||||
|
||||
[
|
||||
{
|
||||
"action": "modify_task",
|
||||
"action": "message",
|
||||
"args": {
|
||||
"id": "0",
|
||||
"state": "in_progress",
|
||||
"content": "Fix typos in bad.txt. Do not ask me for confirmation at any point.",
|
||||
"wait_for_response": false
|
||||
}
|
||||
},
|
||||
{
|
||||
"action": "read",
|
||||
"args": {
|
||||
"path": "bad.txt",
|
||||
"start": 0,
|
||||
"end": -1,
|
||||
"thought": ""
|
||||
}
|
||||
},
|
||||
{
|
||||
"action": "message",
|
||||
"observation": "read",
|
||||
"content": "This is a stupid typoo.\nReally?\nNo mor typos!\nEnjoy!\n",
|
||||
"extras": {
|
||||
"path": "bad.txt"
|
||||
}
|
||||
},
|
||||
{
|
||||
"action": "write",
|
||||
"args": {
|
||||
"content": "To fix the typos in bad.txt, I need to first read the content of the file to understand the extent of the errors and determine the necessary corrections.",
|
||||
"wait_for_response": false
|
||||
"path": "bad.txt",
|
||||
"content": "This is a stupid typo.\nReally?\nNo more typos!\nEnjoy!\n",
|
||||
"start": 0,
|
||||
"end": -1,
|
||||
"thought": ""
|
||||
}
|
||||
},
|
||||
{
|
||||
"observation": "write",
|
||||
"content": "",
|
||||
"extras": {
|
||||
"path": "bad.txt"
|
||||
}
|
||||
}
|
||||
]
|
||||
@ -96,7 +119,7 @@ It must be an object, and it must contain two fields:
|
||||
* `message` - make a plan, set a goal, or record your thoughts. Arguments:
|
||||
* `content` - the message to record
|
||||
* `add_task` - add a task to your plan. Arguments:
|
||||
* `parent` - the ID of the parent task
|
||||
* `parent` - the ID of the parent task (leave empty if it should go at the top level)
|
||||
* `goal` - the goal of the task
|
||||
* `subtasks` - a list of subtasks, each of which is a map with a `goal` key.
|
||||
* `modify_task` - close a task. Arguments:
|
||||
@ -110,4 +133,4 @@ actions are all `message` actions, you should consider taking a different action
|
||||
|
||||
What is your next thought or action? Again, you must reply with JSON, and only with JSON.
|
||||
|
||||
Look at your last thought in the history above. What does it suggest? Don't think anymore--take action.
|
||||
You just changed a file. You should think about how it affects your plan.
|
||||
|
||||
@ -1,146 +0,0 @@
|
||||
|
||||
|
||||
----------
|
||||
|
||||
|
||||
# Task
|
||||
You're a diligent software engineer AI. You can't see, draw, or interact with a
|
||||
browser, but you can read and write files, and you can run commands, and you can think.
|
||||
|
||||
You've been given the following task:
|
||||
|
||||
Fix typos in bad.txt. Do not ask me for confirmation at any point.
|
||||
|
||||
## Plan
|
||||
As you complete this task, you're building a plan and keeping
|
||||
track of your progress. Here's a JSON representation of your plan:
|
||||
|
||||
{
|
||||
"id": "0",
|
||||
"goal": "Fix typos in bad.txt. Do not ask me for confirmation at any point.",
|
||||
"state": "in_progress",
|
||||
"subtasks": []
|
||||
}
|
||||
|
||||
|
||||
You're currently working on this task:
|
||||
Fix typos in bad.txt. Do not ask me for confirmation at any point..
|
||||
If it's not achievable AND verifiable with a SINGLE action, you MUST break it down into subtasks NOW.
|
||||
|
||||
You're responsible for managing this plan and the status of tasks in
|
||||
it, by using the `add_task` and `modify_task` actions described below.
|
||||
|
||||
If the History below contradicts the state of any of these tasks, you
|
||||
MUST modify the task using the `modify_task` action described below.
|
||||
|
||||
Be sure NOT to duplicate any tasks. Do NOT use the `add_task` action for
|
||||
a task that's already represented. Every task must be represented only once.
|
||||
|
||||
Tasks that are sequential MUST be siblings. They must be added in order
|
||||
to their parent task.
|
||||
|
||||
If you mark a task as 'completed', 'verified', or 'abandoned',
|
||||
all non-abandoned subtasks will be marked the same way.
|
||||
So before closing a task this way, you MUST not only be sure that it has
|
||||
been completed successfully--you must ALSO be sure that all its subtasks
|
||||
are ready to be marked the same way.
|
||||
|
||||
If, and only if, ALL tasks have already been marked verified,
|
||||
you MUST respond with the `finish` action.
|
||||
|
||||
## History
|
||||
Here is a recent history of actions you've taken in service of this plan,
|
||||
as well as observations you've made. This only includes the MOST RECENT
|
||||
ten actions--more happened before that.
|
||||
|
||||
[
|
||||
{
|
||||
"action": "modify_task",
|
||||
"args": {
|
||||
"id": "0",
|
||||
"state": "in_progress",
|
||||
"thought": ""
|
||||
}
|
||||
},
|
||||
{
|
||||
"action": "message",
|
||||
"args": {
|
||||
"content": "To fix the typos in bad.txt, I need to first read the content of the file to understand the extent of the errors and determine the necessary corrections.",
|
||||
"wait_for_response": false
|
||||
}
|
||||
},
|
||||
{
|
||||
"action": "read",
|
||||
"args": {
|
||||
"path": "bad.txt",
|
||||
"start": 0,
|
||||
"end": -1,
|
||||
"thought": ""
|
||||
}
|
||||
},
|
||||
{
|
||||
"observation": "read",
|
||||
"content": "This is a stupid typoo.\nReally?\nNo mor typos!\nEnjoy!\n",
|
||||
"extras": {
|
||||
"path": "bad.txt"
|
||||
}
|
||||
},
|
||||
{
|
||||
"action": "write",
|
||||
"args": {
|
||||
"path": "bad.txt",
|
||||
"content": "This is a stupid typo.\nReally?\nNo more typos!\nEnjoy!\n",
|
||||
"start": 0,
|
||||
"end": -1,
|
||||
"thought": ""
|
||||
}
|
||||
},
|
||||
{
|
||||
"observation": "write",
|
||||
"content": "",
|
||||
"extras": {
|
||||
"path": "bad.txt"
|
||||
}
|
||||
}
|
||||
]
|
||||
|
||||
|
||||
Your most recent action is at the bottom of that history.
|
||||
|
||||
## Action
|
||||
What is your next thought or action? Your response must be in JSON format.
|
||||
|
||||
It must be an object, and it must contain two fields:
|
||||
* `action`, which is one of the actions below
|
||||
* `args`, which is a map of key-value pairs, specifying the arguments for that action
|
||||
|
||||
* `read` - reads the content of a file. Arguments:
|
||||
* `path` - the path of the file to read
|
||||
* `write` - writes the content to a file. Arguments:
|
||||
* `path` - the path of the file to write
|
||||
* `content` - the content to write to the file
|
||||
* `run` - runs a command on the command line in a Linux shell. Arguments:
|
||||
* `command` - the command to run
|
||||
* `background` - if true, run the command in the background, so that other commands can be run concurrently. Useful for e.g. starting a server. You won't be able to see the logs. You don't need to end the command with `&`, just set this to true.
|
||||
* `kill` - kills a background command
|
||||
* `id` - the ID of the background command to kill
|
||||
* `browse` - opens a web page. Arguments:
|
||||
* `url` - the URL to open
|
||||
* `message` - make a plan, set a goal, or record your thoughts. Arguments:
|
||||
* `content` - the message to record
|
||||
* `add_task` - add a task to your plan. Arguments:
|
||||
* `parent` - the ID of the parent task
|
||||
* `goal` - the goal of the task
|
||||
* `subtasks` - a list of subtasks, each of which is a map with a `goal` key.
|
||||
* `modify_task` - close a task. Arguments:
|
||||
* `id` - the ID of the task to close
|
||||
* `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 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.
|
||||
|
||||
What is your next thought or action? Again, you must reply with JSON, and only with JSON.
|
||||
|
||||
You just changed a file. You should think about how it affects your plan.
|
||||
@ -1,153 +0,0 @@
|
||||
|
||||
|
||||
----------
|
||||
|
||||
|
||||
# Task
|
||||
You're a diligent software engineer AI. You can't see, draw, or interact with a
|
||||
browser, but you can read and write files, and you can run commands, and you can think.
|
||||
|
||||
You've been given the following task:
|
||||
|
||||
Fix typos in bad.txt. Do not ask me for confirmation at any point.
|
||||
|
||||
## Plan
|
||||
As you complete this task, you're building a plan and keeping
|
||||
track of your progress. Here's a JSON representation of your plan:
|
||||
|
||||
{
|
||||
"id": "0",
|
||||
"goal": "Fix typos in bad.txt. Do not ask me for confirmation at any point.",
|
||||
"state": "in_progress",
|
||||
"subtasks": []
|
||||
}
|
||||
|
||||
|
||||
You're currently working on this task:
|
||||
Fix typos in bad.txt. Do not ask me for confirmation at any point..
|
||||
If it's not achievable AND verifiable with a SINGLE action, you MUST break it down into subtasks NOW.
|
||||
|
||||
You're responsible for managing this plan and the status of tasks in
|
||||
it, by using the `add_task` and `modify_task` actions described below.
|
||||
|
||||
If the History below contradicts the state of any of these tasks, you
|
||||
MUST modify the task using the `modify_task` action described below.
|
||||
|
||||
Be sure NOT to duplicate any tasks. Do NOT use the `add_task` action for
|
||||
a task that's already represented. Every task must be represented only once.
|
||||
|
||||
Tasks that are sequential MUST be siblings. They must be added in order
|
||||
to their parent task.
|
||||
|
||||
If you mark a task as 'completed', 'verified', or 'abandoned',
|
||||
all non-abandoned subtasks will be marked the same way.
|
||||
So before closing a task this way, you MUST not only be sure that it has
|
||||
been completed successfully--you must ALSO be sure that all its subtasks
|
||||
are ready to be marked the same way.
|
||||
|
||||
If, and only if, ALL tasks have already been marked verified,
|
||||
you MUST respond with the `finish` action.
|
||||
|
||||
## History
|
||||
Here is a recent history of actions you've taken in service of this plan,
|
||||
as well as observations you've made. This only includes the MOST RECENT
|
||||
ten actions--more happened before that.
|
||||
|
||||
[
|
||||
{
|
||||
"action": "modify_task",
|
||||
"args": {
|
||||
"id": "0",
|
||||
"state": "in_progress",
|
||||
"thought": ""
|
||||
}
|
||||
},
|
||||
{
|
||||
"action": "message",
|
||||
"args": {
|
||||
"content": "To fix the typos in bad.txt, I need to first read the content of the file to understand the extent of the errors and determine the necessary corrections.",
|
||||
"wait_for_response": false
|
||||
}
|
||||
},
|
||||
{
|
||||
"action": "read",
|
||||
"args": {
|
||||
"path": "bad.txt",
|
||||
"start": 0,
|
||||
"end": -1,
|
||||
"thought": ""
|
||||
}
|
||||
},
|
||||
{
|
||||
"observation": "read",
|
||||
"content": "This is a stupid typoo.\nReally?\nNo mor typos!\nEnjoy!\n",
|
||||
"extras": {
|
||||
"path": "bad.txt"
|
||||
}
|
||||
},
|
||||
{
|
||||
"action": "write",
|
||||
"args": {
|
||||
"path": "bad.txt",
|
||||
"content": "This is a stupid typo.\nReally?\nNo more typos!\nEnjoy!\n",
|
||||
"start": 0,
|
||||
"end": -1,
|
||||
"thought": ""
|
||||
}
|
||||
},
|
||||
{
|
||||
"observation": "write",
|
||||
"content": "",
|
||||
"extras": {
|
||||
"path": "bad.txt"
|
||||
}
|
||||
},
|
||||
{
|
||||
"action": "message",
|
||||
"args": {
|
||||
"content": "I have corrected the typos in bad.txt. I should now verify that the corrections were made accurately by reading the file again.",
|
||||
"wait_for_response": false
|
||||
}
|
||||
}
|
||||
]
|
||||
|
||||
|
||||
Your most recent action is at the bottom of that history.
|
||||
|
||||
## Action
|
||||
What is your next thought or action? Your response must be in JSON format.
|
||||
|
||||
It must be an object, and it must contain two fields:
|
||||
* `action`, which is one of the actions below
|
||||
* `args`, which is a map of key-value pairs, specifying the arguments for that action
|
||||
|
||||
* `read` - reads the content of a file. Arguments:
|
||||
* `path` - the path of the file to read
|
||||
* `write` - writes the content to a file. Arguments:
|
||||
* `path` - the path of the file to write
|
||||
* `content` - the content to write to the file
|
||||
* `run` - runs a command on the command line in a Linux shell. Arguments:
|
||||
* `command` - the command to run
|
||||
* `background` - if true, run the command in the background, so that other commands can be run concurrently. Useful for e.g. starting a server. You won't be able to see the logs. You don't need to end the command with `&`, just set this to true.
|
||||
* `kill` - kills a background command
|
||||
* `id` - the ID of the background command to kill
|
||||
* `browse` - opens a web page. Arguments:
|
||||
* `url` - the URL to open
|
||||
* `message` - make a plan, set a goal, or record your thoughts. Arguments:
|
||||
* `content` - the message to record
|
||||
* `add_task` - add a task to your plan. Arguments:
|
||||
* `parent` - the ID of the parent task
|
||||
* `goal` - the goal of the task
|
||||
* `subtasks` - a list of subtasks, each of which is a map with a `goal` key.
|
||||
* `modify_task` - close a task. Arguments:
|
||||
* `id` - the ID of the task to close
|
||||
* `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 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.
|
||||
|
||||
What is your next thought or action? Again, you must reply with JSON, and only with JSON.
|
||||
|
||||
Look at your last thought in the history above. What does it suggest? Don't think anymore--take action.
|
||||
@ -1,169 +0,0 @@
|
||||
|
||||
|
||||
----------
|
||||
|
||||
|
||||
# Task
|
||||
You're a diligent software engineer AI. You can't see, draw, or interact with a
|
||||
browser, but you can read and write files, and you can run commands, and you can think.
|
||||
|
||||
You've been given the following task:
|
||||
|
||||
Fix typos in bad.txt. Do not ask me for confirmation at any point.
|
||||
|
||||
## Plan
|
||||
As you complete this task, you're building a plan and keeping
|
||||
track of your progress. Here's a JSON representation of your plan:
|
||||
|
||||
{
|
||||
"id": "0",
|
||||
"goal": "Fix typos in bad.txt. Do not ask me for confirmation at any point.",
|
||||
"state": "in_progress",
|
||||
"subtasks": []
|
||||
}
|
||||
|
||||
|
||||
You're currently working on this task:
|
||||
Fix typos in bad.txt. Do not ask me for confirmation at any point..
|
||||
If it's not achievable AND verifiable with a SINGLE action, you MUST break it down into subtasks NOW.
|
||||
|
||||
You're responsible for managing this plan and the status of tasks in
|
||||
it, by using the `add_task` and `modify_task` actions described below.
|
||||
|
||||
If the History below contradicts the state of any of these tasks, you
|
||||
MUST modify the task using the `modify_task` action described below.
|
||||
|
||||
Be sure NOT to duplicate any tasks. Do NOT use the `add_task` action for
|
||||
a task that's already represented. Every task must be represented only once.
|
||||
|
||||
Tasks that are sequential MUST be siblings. They must be added in order
|
||||
to their parent task.
|
||||
|
||||
If you mark a task as 'completed', 'verified', or 'abandoned',
|
||||
all non-abandoned subtasks will be marked the same way.
|
||||
So before closing a task this way, you MUST not only be sure that it has
|
||||
been completed successfully--you must ALSO be sure that all its subtasks
|
||||
are ready to be marked the same way.
|
||||
|
||||
If, and only if, ALL tasks have already been marked verified,
|
||||
you MUST respond with the `finish` action.
|
||||
|
||||
## History
|
||||
Here is a recent history of actions you've taken in service of this plan,
|
||||
as well as observations you've made. This only includes the MOST RECENT
|
||||
ten actions--more happened before that.
|
||||
|
||||
[
|
||||
{
|
||||
"action": "modify_task",
|
||||
"args": {
|
||||
"id": "0",
|
||||
"state": "in_progress",
|
||||
"thought": ""
|
||||
}
|
||||
},
|
||||
{
|
||||
"action": "message",
|
||||
"args": {
|
||||
"content": "To fix the typos in bad.txt, I need to first read the content of the file to understand the extent of the errors and determine the necessary corrections.",
|
||||
"wait_for_response": false
|
||||
}
|
||||
},
|
||||
{
|
||||
"action": "read",
|
||||
"args": {
|
||||
"path": "bad.txt",
|
||||
"start": 0,
|
||||
"end": -1,
|
||||
"thought": ""
|
||||
}
|
||||
},
|
||||
{
|
||||
"observation": "read",
|
||||
"content": "This is a stupid typoo.\nReally?\nNo mor typos!\nEnjoy!\n",
|
||||
"extras": {
|
||||
"path": "bad.txt"
|
||||
}
|
||||
},
|
||||
{
|
||||
"action": "write",
|
||||
"args": {
|
||||
"path": "bad.txt",
|
||||
"content": "This is a stupid typo.\nReally?\nNo more typos!\nEnjoy!\n",
|
||||
"start": 0,
|
||||
"end": -1,
|
||||
"thought": ""
|
||||
}
|
||||
},
|
||||
{
|
||||
"observation": "write",
|
||||
"content": "",
|
||||
"extras": {
|
||||
"path": "bad.txt"
|
||||
}
|
||||
},
|
||||
{
|
||||
"action": "message",
|
||||
"args": {
|
||||
"content": "I have corrected the typos in bad.txt. I should now verify that the corrections were made accurately by reading the file again.",
|
||||
"wait_for_response": false
|
||||
}
|
||||
},
|
||||
{
|
||||
"action": "read",
|
||||
"args": {
|
||||
"path": "bad.txt",
|
||||
"start": 0,
|
||||
"end": -1,
|
||||
"thought": ""
|
||||
}
|
||||
},
|
||||
{
|
||||
"observation": "read",
|
||||
"content": "This is a stupid typo.\nReally?\nNo more typos!\nEnjoy!\n\n",
|
||||
"extras": {
|
||||
"path": "bad.txt"
|
||||
}
|
||||
}
|
||||
]
|
||||
|
||||
|
||||
Your most recent action is at the bottom of that history.
|
||||
|
||||
## Action
|
||||
What is your next thought or action? Your response must be in JSON format.
|
||||
|
||||
It must be an object, and it must contain two fields:
|
||||
* `action`, which is one of the actions below
|
||||
* `args`, which is a map of key-value pairs, specifying the arguments for that action
|
||||
|
||||
* `read` - reads the content of a file. Arguments:
|
||||
* `path` - the path of the file to read
|
||||
* `write` - writes the content to a file. Arguments:
|
||||
* `path` - the path of the file to write
|
||||
* `content` - the content to write to the file
|
||||
* `run` - runs a command on the command line in a Linux shell. Arguments:
|
||||
* `command` - the command to run
|
||||
* `background` - if true, run the command in the background, so that other commands can be run concurrently. Useful for e.g. starting a server. You won't be able to see the logs. You don't need to end the command with `&`, just set this to true.
|
||||
* `kill` - kills a background command
|
||||
* `id` - the ID of the background command to kill
|
||||
* `browse` - opens a web page. Arguments:
|
||||
* `url` - the URL to open
|
||||
* `message` - make a plan, set a goal, or record your thoughts. Arguments:
|
||||
* `content` - the message to record
|
||||
* `add_task` - add a task to your plan. Arguments:
|
||||
* `parent` - the ID of the parent task
|
||||
* `goal` - the goal of the task
|
||||
* `subtasks` - a list of subtasks, each of which is a map with a `goal` key.
|
||||
* `modify_task` - close a task. Arguments:
|
||||
* `id` - the ID of the task to close
|
||||
* `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 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.
|
||||
|
||||
What is your next thought or action? Again, you must reply with JSON, and only with JSON.
|
||||
|
||||
You should think about the file you just read, what you learned from it, and how that affects your plan.
|
||||
@ -1,7 +1,6 @@
|
||||
{
|
||||
"action": "modify_task",
|
||||
"action": "read",
|
||||
"args": {
|
||||
"id": "0",
|
||||
"state": "in_progress"
|
||||
"path": "bad.txt"
|
||||
}
|
||||
}
|
||||
|
||||
@ -1,6 +1,7 @@
|
||||
{
|
||||
"action": "message",
|
||||
"action": "write",
|
||||
"args": {
|
||||
"content": "To fix the typos in bad.txt, I need to first read the content of the file to understand the extent of the errors and determine the necessary corrections."
|
||||
"path": "bad.txt",
|
||||
"content": "This is a stupid typo.\nReally?\nNo more typos!\nEnjoy!\n"
|
||||
}
|
||||
}
|
||||
|
||||
@ -1,6 +1,3 @@
|
||||
{
|
||||
"action": "read",
|
||||
"args": {
|
||||
"path": "bad.txt"
|
||||
}
|
||||
"action": "finish"
|
||||
}
|
||||
|
||||
@ -1,7 +0,0 @@
|
||||
{
|
||||
"action": "write",
|
||||
"args": {
|
||||
"path": "bad.txt",
|
||||
"content": "This is a stupid typo.\nReally?\nNo more typos!\nEnjoy!\n"
|
||||
}
|
||||
}
|
||||
@ -1,6 +0,0 @@
|
||||
{
|
||||
"action": "message",
|
||||
"args": {
|
||||
"content": "I have corrected the typos in bad.txt. I should now verify that the corrections were made accurately by reading the file again."
|
||||
}
|
||||
}
|
||||
@ -1,6 +0,0 @@
|
||||
{
|
||||
"action": "read",
|
||||
"args": {
|
||||
"path": "bad.txt"
|
||||
}
|
||||
}
|
||||
@ -1,8 +0,0 @@
|
||||
{
|
||||
"action": "modify_task",
|
||||
"args": {
|
||||
"id": "0",
|
||||
"state": "verified",
|
||||
"thought": "The typos in bad.txt have been corrected and verified by reading the file again. The content is now accurate."
|
||||
}
|
||||
}
|
||||
@ -16,8 +16,8 @@ As you complete this task, you're building a plan and keeping
|
||||
track of your progress. Here's a JSON representation of your plan:
|
||||
|
||||
{
|
||||
"id": "0",
|
||||
"goal": "Write a shell script 'hello.sh' that prints 'hello'. Do not ask me for confirmation at any point.",
|
||||
"id": "",
|
||||
"goal": "",
|
||||
"state": "open",
|
||||
"subtasks": []
|
||||
}
|
||||
@ -51,7 +51,15 @@ Here is a recent history of actions you've taken in service of this plan,
|
||||
as well as observations you've made. This only includes the MOST RECENT
|
||||
ten actions--more happened before that.
|
||||
|
||||
[]
|
||||
[
|
||||
{
|
||||
"action": "message",
|
||||
"args": {
|
||||
"content": "Write a shell script 'hello.sh' that prints 'hello'. Do not ask me for confirmation at any point.",
|
||||
"wait_for_response": false
|
||||
}
|
||||
}
|
||||
]
|
||||
|
||||
|
||||
Your most recent action is at the bottom of that history.
|
||||
@ -78,7 +86,7 @@ It must be an object, and it must contain two fields:
|
||||
* `message` - make a plan, set a goal, or record your thoughts. Arguments:
|
||||
* `content` - the message to record
|
||||
* `add_task` - add a task to your plan. Arguments:
|
||||
* `parent` - the ID of the parent task
|
||||
* `parent` - the ID of the parent task (leave empty if it should go at the top level)
|
||||
* `goal` - the goal of the task
|
||||
* `subtasks` - a list of subtasks, each of which is a map with a `goal` key.
|
||||
* `modify_task` - close a task. Arguments:
|
||||
@ -91,3 +99,6 @@ 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.
|
||||
|
||||
What is your next thought or action? Again, you must reply with JSON, and only with JSON.
|
||||
|
||||
Look at your last thought in the history above. What does it suggest? Don't think anymore--take action.
|
||||
|
||||
|
||||
@ -16,10 +16,17 @@ As you complete this task, you're building a plan and keeping
|
||||
track of your progress. Here's a JSON representation of your plan:
|
||||
|
||||
{
|
||||
"id": "0",
|
||||
"goal": "Write a shell script 'hello.sh' that prints 'hello'. Do not ask me for confirmation at any point.",
|
||||
"id": "",
|
||||
"goal": "",
|
||||
"state": "open",
|
||||
"subtasks": []
|
||||
"subtasks": [
|
||||
{
|
||||
"id": "0",
|
||||
"goal": "Create a shell script 'hello.sh' that prints 'hello'",
|
||||
"state": "open",
|
||||
"subtasks": []
|
||||
}
|
||||
]
|
||||
}
|
||||
|
||||
|
||||
@ -53,20 +60,19 @@ ten actions--more happened before that.
|
||||
|
||||
[
|
||||
{
|
||||
"action": "write",
|
||||
"action": "message",
|
||||
"args": {
|
||||
"path": "hello.sh",
|
||||
"content": "#!/bin/bash\n\necho 'hello'",
|
||||
"start": 0,
|
||||
"end": -1,
|
||||
"thought": ""
|
||||
"content": "Write a shell script 'hello.sh' that prints 'hello'. Do not ask me for confirmation at any point.",
|
||||
"wait_for_response": false
|
||||
}
|
||||
},
|
||||
{
|
||||
"observation": "write",
|
||||
"content": "",
|
||||
"extras": {
|
||||
"path": "hello.sh"
|
||||
"action": "add_task",
|
||||
"args": {
|
||||
"parent": "",
|
||||
"goal": "Create a shell script 'hello.sh' that prints 'hello'",
|
||||
"subtasks": [],
|
||||
"thought": ""
|
||||
}
|
||||
}
|
||||
]
|
||||
@ -96,7 +102,7 @@ It must be an object, and it must contain two fields:
|
||||
* `message` - make a plan, set a goal, or record your thoughts. Arguments:
|
||||
* `content` - the message to record
|
||||
* `add_task` - add a task to your plan. Arguments:
|
||||
* `parent` - the ID of the parent task
|
||||
* `parent` - the ID of the parent task (leave empty if it should go at the top level)
|
||||
* `goal` - the goal of the task
|
||||
* `subtasks` - a list of subtasks, each of which is a map with a `goal` key.
|
||||
* `modify_task` - close a task. Arguments:
|
||||
@ -110,4 +116,4 @@ actions are all `message` actions, you should consider taking a different action
|
||||
|
||||
What is your next thought or action? Again, you must reply with JSON, and only with JSON.
|
||||
|
||||
You just changed a file. You should think about how it affects your plan.
|
||||
You should think about the next action to take.
|
||||
|
||||
@ -9,23 +9,28 @@ browser, but you can read and write files, and you can run commands, and you can
|
||||
|
||||
You've been given the following task:
|
||||
|
||||
Fix typos in bad.txt. Do not ask me for confirmation at any point.
|
||||
Write a shell script 'hello.sh' that prints 'hello'. Do not ask me for confirmation at any point.
|
||||
|
||||
## Plan
|
||||
As you complete this task, you're building a plan and keeping
|
||||
track of your progress. Here's a JSON representation of your plan:
|
||||
|
||||
{
|
||||
"id": "0",
|
||||
"goal": "Fix typos in bad.txt. Do not ask me for confirmation at any point.",
|
||||
"state": "in_progress",
|
||||
"subtasks": []
|
||||
"id": "",
|
||||
"goal": "",
|
||||
"state": "open",
|
||||
"subtasks": [
|
||||
{
|
||||
"id": "0",
|
||||
"goal": "Create a shell script 'hello.sh' that prints 'hello'",
|
||||
"state": "open",
|
||||
"subtasks": []
|
||||
}
|
||||
]
|
||||
}
|
||||
|
||||
|
||||
You're currently working on this task:
|
||||
Fix typos in bad.txt. Do not ask me for confirmation at any point..
|
||||
If it's not achievable AND verifiable with a SINGLE action, you MUST break it down into subtasks NOW.
|
||||
You're not currently working on any tasks. Your next action MUST be to mark a task as in_progress.
|
||||
|
||||
You're responsible for managing this plan and the status of tasks in
|
||||
it, by using the `add_task` and `modify_task` actions described below.
|
||||
@ -54,35 +59,37 @@ as well as observations you've made. This only includes the MOST RECENT
|
||||
ten actions--more happened before that.
|
||||
|
||||
[
|
||||
{
|
||||
"action": "modify_task",
|
||||
"args": {
|
||||
"id": "0",
|
||||
"state": "in_progress",
|
||||
"thought": ""
|
||||
}
|
||||
},
|
||||
{
|
||||
"action": "message",
|
||||
"args": {
|
||||
"content": "To fix the typos in bad.txt, I need to first read the content of the file to understand the extent of the errors and determine the necessary corrections.",
|
||||
"content": "Write a shell script 'hello.sh' that prints 'hello'. Do not ask me for confirmation at any point.",
|
||||
"wait_for_response": false
|
||||
}
|
||||
},
|
||||
{
|
||||
"action": "read",
|
||||
"action": "add_task",
|
||||
"args": {
|
||||
"path": "bad.txt",
|
||||
"parent": "",
|
||||
"goal": "Create a shell script 'hello.sh' that prints 'hello'",
|
||||
"subtasks": [],
|
||||
"thought": ""
|
||||
}
|
||||
},
|
||||
{
|
||||
"action": "write",
|
||||
"args": {
|
||||
"path": "hello.sh",
|
||||
"content": "echo 'hello'",
|
||||
"start": 0,
|
||||
"end": -1,
|
||||
"thought": ""
|
||||
}
|
||||
},
|
||||
{
|
||||
"observation": "read",
|
||||
"content": "This is a stupid typoo.\nReally?\nNo mor typos!\nEnjoy!\n",
|
||||
"observation": "write",
|
||||
"content": "",
|
||||
"extras": {
|
||||
"path": "bad.txt"
|
||||
"path": "hello.sh"
|
||||
}
|
||||
}
|
||||
]
|
||||
@ -112,7 +119,7 @@ It must be an object, and it must contain two fields:
|
||||
* `message` - make a plan, set a goal, or record your thoughts. Arguments:
|
||||
* `content` - the message to record
|
||||
* `add_task` - add a task to your plan. Arguments:
|
||||
* `parent` - the ID of the parent task
|
||||
* `parent` - the ID of the parent task (leave empty if it should go at the top level)
|
||||
* `goal` - the goal of the task
|
||||
* `subtasks` - a list of subtasks, each of which is a map with a `goal` key.
|
||||
* `modify_task` - close a task. Arguments:
|
||||
@ -126,4 +133,4 @@ actions are all `message` actions, you should consider taking a different action
|
||||
|
||||
What is your next thought or action? Again, you must reply with JSON, and only with JSON.
|
||||
|
||||
You should think about the file you just read, what you learned from it, and how that affects your plan.
|
||||
You just changed a file. You should think about how it affects your plan.
|
||||
@ -1,9 +1,8 @@
|
||||
```json
|
||||
{
|
||||
"action": "write",
|
||||
"action": "add_task",
|
||||
"args": {
|
||||
"path": "hello.sh",
|
||||
"content": "#!/bin/bash\n\necho 'hello'"
|
||||
"goal": "Create a shell script 'hello.sh' that prints 'hello'",
|
||||
"parent": "",
|
||||
"subtasks": []
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
@ -1,7 +1,7 @@
|
||||
{
|
||||
"action": "modify_task",
|
||||
"action": "write",
|
||||
"args": {
|
||||
"id": "0",
|
||||
"state": "completed"
|
||||
"path": "hello.sh",
|
||||
"content": "echo 'hello'"
|
||||
}
|
||||
}
|
||||
|
||||
@ -0,0 +1,7 @@
|
||||
{
|
||||
"action": "modify_task",
|
||||
"args": {
|
||||
"id": "0",
|
||||
"state": "completed"
|
||||
}
|
||||
}
|
||||
@ -40,7 +40,7 @@ write <file> <changes> [<start_line>] [<end_line>] - Modifies a <file> by replac
|
||||
browse <url> - Returns the text version of any url, this can be useful to look up documentation or finding issues on github
|
||||
scroll_up - Takes no arguments. This will scroll up and show you the 100 lines above your current lines
|
||||
scroll_down - Takes no arguments. This will scroll down and show you the 100 lines below your current lines
|
||||
edit <start_line> <end_line> <changes> - This will modify lines in the currently open file. use start_line and end_line to designate which lines to change and then write the multiline changes
|
||||
edit <start_line> <end_line> <changes> - This will modify lines in the currently open file. use start_line and end_line to designate which lines to change and then write the multiline changes. Set end_line to -1 to denote the end of the file
|
||||
goto <line_num> - This will take you directly to a line and show you the 100 lines below it.
|
||||
<bash_command> <args> - You can use any bash command you need (cd, ls, rm, grep, dir, mv, wget, git, zip, etc.) with their arguments included
|
||||
pip install <package> - You can use this to import python packages. Make sure you include the correct package name when using this command.
|
||||
@ -56,6 +56,25 @@ when using write and edit do not surround the code with any "" just write the co
|
||||
|
||||
----------
|
||||
|
||||
These are your past 4 actions:
|
||||
===== Previous Actions =====
|
||||
|
||||
Memory 0:
|
||||
Previous Action:
|
||||
action: message
|
||||
args:
|
||||
wait_for_response: False
|
||||
|
||||
Output from Action:
|
||||
observation: null
|
||||
content:
|
||||
extras:
|
||||
======= End Actions =======
|
||||
Use these memories to provide additional context to the problem you are solving.
|
||||
Remember that you have already completed these steps so you do not need to perform them again.
|
||||
|
||||
----------
|
||||
|
||||
RESPONSE FORMAT:
|
||||
This is the format of the response you will make in order to solve the current issue.
|
||||
You will be given multiple iterations to complete this task so break it into steps and solve them one by one.
|
||||
|
||||
@ -40,7 +40,7 @@ write <file> <changes> [<start_line>] [<end_line>] - Modifies a <file> by replac
|
||||
browse <url> - Returns the text version of any url, this can be useful to look up documentation or finding issues on github
|
||||
scroll_up - Takes no arguments. This will scroll up and show you the 100 lines above your current lines
|
||||
scroll_down - Takes no arguments. This will scroll down and show you the 100 lines below your current lines
|
||||
edit <start_line> <end_line> <changes> - This will modify lines in the currently open file. use start_line and end_line to designate which lines to change and then write the multiline changes
|
||||
edit <start_line> <end_line> <changes> - This will modify lines in the currently open file. use start_line and end_line to designate which lines to change and then write the multiline changes. Set end_line to -1 to denote the end of the file
|
||||
goto <line_num> - This will take you directly to a line and show you the 100 lines below it.
|
||||
<bash_command> <args> - You can use any bash command you need (cd, ls, rm, grep, dir, mv, wget, git, zip, etc.) with their arguments included
|
||||
pip install <package> - You can use this to import python packages. Make sure you include the correct package name when using this command.
|
||||
@ -61,13 +61,24 @@ These are your past 4 actions:
|
||||
|
||||
Memory 0:
|
||||
Previous Action:
|
||||
action: message
|
||||
args:
|
||||
wait_for_response: False
|
||||
|
||||
Output from Action:
|
||||
observation: null
|
||||
content:
|
||||
extras:
|
||||
|
||||
Memory 1:
|
||||
Previous Action:
|
||||
action: write
|
||||
args:
|
||||
path: hello.sh
|
||||
start: 0
|
||||
end: -1
|
||||
thought: Thoughts:
|
||||
I need to create a shell script named 'hello.sh' that prints 'hello' without asking for confirmation. I will use the echo command to print 'hello' to the console.
|
||||
I need to create a shell script named 'hello.sh' that will print 'hello' when executed. I will need to ensure that the script does not prompt for any confirmation during execution.
|
||||
|
||||
Action:
|
||||
|
||||
|
||||
@ -40,7 +40,7 @@ write <file> <changes> [<start_line>] [<end_line>] - Modifies a <file> by replac
|
||||
browse <url> - Returns the text version of any url, this can be useful to look up documentation or finding issues on github
|
||||
scroll_up - Takes no arguments. This will scroll up and show you the 100 lines above your current lines
|
||||
scroll_down - Takes no arguments. This will scroll down and show you the 100 lines below your current lines
|
||||
edit <start_line> <end_line> <changes> - This will modify lines in the currently open file. use start_line and end_line to designate which lines to change and then write the multiline changes
|
||||
edit <start_line> <end_line> <changes> - This will modify lines in the currently open file. use start_line and end_line to designate which lines to change and then write the multiline changes. Set end_line to -1 to denote the end of the file
|
||||
goto <line_num> - This will take you directly to a line and show you the 100 lines below it.
|
||||
<bash_command> <args> - You can use any bash command you need (cd, ls, rm, grep, dir, mv, wget, git, zip, etc.) with their arguments included
|
||||
pip install <package> - You can use this to import python packages. Make sure you include the correct package name when using this command.
|
||||
@ -61,21 +61,14 @@ These are your past 4 actions:
|
||||
|
||||
Memory 0:
|
||||
Previous Action:
|
||||
action: write
|
||||
action: message
|
||||
args:
|
||||
path: hello.sh
|
||||
start: 0
|
||||
end: -1
|
||||
thought: Thoughts:
|
||||
I need to create a shell script named 'hello.sh' that prints 'hello' without asking for confirmation. I will use the echo command to print 'hello' to the console.
|
||||
|
||||
Action:
|
||||
wait_for_response: False
|
||||
|
||||
Output from Action:
|
||||
observation: write
|
||||
observation: null
|
||||
content:
|
||||
extras:
|
||||
path: hello.sh
|
||||
|
||||
Memory 1:
|
||||
Previous Action:
|
||||
@ -85,7 +78,25 @@ args:
|
||||
start: 0
|
||||
end: -1
|
||||
thought: Thoughts:
|
||||
I need to add the code to the 'hello.sh' script to print 'hello' without asking for confirmation. I will use the echo command to achieve this.
|
||||
I need to create a shell script named 'hello.sh' that will print 'hello' when executed. I will need to ensure that the script does not prompt for any confirmation during execution.
|
||||
|
||||
Action:
|
||||
|
||||
Output from Action:
|
||||
observation: write
|
||||
content:
|
||||
extras:
|
||||
path: hello.sh
|
||||
|
||||
Memory 2:
|
||||
Previous Action:
|
||||
action: write
|
||||
args:
|
||||
path: hello.sh
|
||||
start: 0
|
||||
end: -1
|
||||
thought: Thoughts:
|
||||
I need to add the code to the 'hello.sh' script that will print 'hello' when executed without any prompts for confirmation.
|
||||
|
||||
Action:
|
||||
|
||||
|
||||
@ -40,7 +40,7 @@ write <file> <changes> [<start_line>] [<end_line>] - Modifies a <file> by replac
|
||||
browse <url> - Returns the text version of any url, this can be useful to look up documentation or finding issues on github
|
||||
scroll_up - Takes no arguments. This will scroll up and show you the 100 lines above your current lines
|
||||
scroll_down - Takes no arguments. This will scroll down and show you the 100 lines below your current lines
|
||||
edit <start_line> <end_line> <changes> - This will modify lines in the currently open file. use start_line and end_line to designate which lines to change and then write the multiline changes
|
||||
edit <start_line> <end_line> <changes> - This will modify lines in the currently open file. use start_line and end_line to designate which lines to change and then write the multiline changes. Set end_line to -1 to denote the end of the file
|
||||
goto <line_num> - This will take you directly to a line and show you the 100 lines below it.
|
||||
<bash_command> <args> - You can use any bash command you need (cd, ls, rm, grep, dir, mv, wget, git, zip, etc.) with their arguments included
|
||||
pip install <package> - You can use this to import python packages. Make sure you include the correct package name when using this command.
|
||||
@ -61,21 +61,14 @@ These are your past 4 actions:
|
||||
|
||||
Memory 0:
|
||||
Previous Action:
|
||||
action: write
|
||||
action: message
|
||||
args:
|
||||
path: hello.sh
|
||||
start: 0
|
||||
end: -1
|
||||
thought: Thoughts:
|
||||
I need to create a shell script named 'hello.sh' that prints 'hello' without asking for confirmation. I will use the echo command to print 'hello' to the console.
|
||||
|
||||
Action:
|
||||
wait_for_response: False
|
||||
|
||||
Output from Action:
|
||||
observation: write
|
||||
observation: null
|
||||
content:
|
||||
extras:
|
||||
path: hello.sh
|
||||
|
||||
Memory 1:
|
||||
Previous Action:
|
||||
@ -85,7 +78,7 @@ args:
|
||||
start: 0
|
||||
end: -1
|
||||
thought: Thoughts:
|
||||
I need to add the code to the 'hello.sh' script to print 'hello' without asking for confirmation. I will use the echo command to achieve this.
|
||||
I need to create a shell script named 'hello.sh' that will print 'hello' when executed. I will need to ensure that the script does not prompt for any confirmation during execution.
|
||||
|
||||
Action:
|
||||
|
||||
@ -103,7 +96,25 @@ args:
|
||||
start: 0
|
||||
end: -1
|
||||
thought: Thoughts:
|
||||
I need to add the code to the 'hello.sh' script to print 'hello' without asking for confirmation. I will use the echo command to achieve this.
|
||||
I need to add the code to the 'hello.sh' script that will print 'hello' when executed without any prompts for confirmation.
|
||||
|
||||
Action:
|
||||
|
||||
Output from Action:
|
||||
observation: write
|
||||
content:
|
||||
extras:
|
||||
path: hello.sh
|
||||
|
||||
Memory 3:
|
||||
Previous Action:
|
||||
action: write
|
||||
args:
|
||||
path: hello.sh
|
||||
start: 0
|
||||
end: -1
|
||||
thought: Thoughts:
|
||||
I need to add the code to the 'hello.sh' script that will print 'hello' when executed without any prompts for confirmation. I will simply add the command to print 'hello' to the script.
|
||||
|
||||
Action:
|
||||
|
||||
|
||||
@ -40,7 +40,7 @@ write <file> <changes> [<start_line>] [<end_line>] - Modifies a <file> by replac
|
||||
browse <url> - Returns the text version of any url, this can be useful to look up documentation or finding issues on github
|
||||
scroll_up - Takes no arguments. This will scroll up and show you the 100 lines above your current lines
|
||||
scroll_down - Takes no arguments. This will scroll down and show you the 100 lines below your current lines
|
||||
edit <start_line> <end_line> <changes> - This will modify lines in the currently open file. use start_line and end_line to designate which lines to change and then write the multiline changes
|
||||
edit <start_line> <end_line> <changes> - This will modify lines in the currently open file. use start_line and end_line to designate which lines to change and then write the multiline changes. Set end_line to -1 to denote the end of the file
|
||||
goto <line_num> - This will take you directly to a line and show you the 100 lines below it.
|
||||
<bash_command> <args> - You can use any bash command you need (cd, ls, rm, grep, dir, mv, wget, git, zip, etc.) with their arguments included
|
||||
pip install <package> - You can use this to import python packages. Make sure you include the correct package name when using this command.
|
||||
@ -67,7 +67,7 @@ args:
|
||||
start: 0
|
||||
end: -1
|
||||
thought: Thoughts:
|
||||
I need to create a shell script named 'hello.sh' that prints 'hello' without asking for confirmation. I will use the echo command to print 'hello' to the console.
|
||||
I need to create a shell script named 'hello.sh' that will print 'hello' when executed. I will need to ensure that the script does not prompt for any confirmation during execution.
|
||||
|
||||
Action:
|
||||
|
||||
@ -85,7 +85,7 @@ args:
|
||||
start: 0
|
||||
end: -1
|
||||
thought: Thoughts:
|
||||
I need to add the code to the 'hello.sh' script to print 'hello' without asking for confirmation. I will use the echo command to achieve this.
|
||||
I need to add the code to the 'hello.sh' script that will print 'hello' when executed without any prompts for confirmation.
|
||||
|
||||
Action:
|
||||
|
||||
@ -103,7 +103,7 @@ args:
|
||||
start: 0
|
||||
end: -1
|
||||
thought: Thoughts:
|
||||
I need to add the code to the 'hello.sh' script to print 'hello' without asking for confirmation. I will use the echo command to achieve this.
|
||||
I need to add the code to the 'hello.sh' script that will print 'hello' when executed without any prompts for confirmation. I will simply add the command to print 'hello' to the script.
|
||||
|
||||
Action:
|
||||
|
||||
@ -121,7 +121,7 @@ args:
|
||||
start: 0
|
||||
end: -1
|
||||
thought: Thoughts:
|
||||
I need to add the code to the 'hello.sh' script to print 'hello' without asking for confirmation. I will use the echo command to achieve this.
|
||||
I need to add the command to print 'hello' in the 'hello.sh' script without any prompts for confirmation. Since the script is already created, I will simply edit the existing script to include the command to print 'hello'.
|
||||
|
||||
Action:
|
||||
|
||||
|
||||
@ -40,7 +40,7 @@ write <file> <changes> [<start_line>] [<end_line>] - Modifies a <file> by replac
|
||||
browse <url> - Returns the text version of any url, this can be useful to look up documentation or finding issues on github
|
||||
scroll_up - Takes no arguments. This will scroll up and show you the 100 lines above your current lines
|
||||
scroll_down - Takes no arguments. This will scroll down and show you the 100 lines below your current lines
|
||||
edit <start_line> <end_line> <changes> - This will modify lines in the currently open file. use start_line and end_line to designate which lines to change and then write the multiline changes
|
||||
edit <start_line> <end_line> <changes> - This will modify lines in the currently open file. use start_line and end_line to designate which lines to change and then write the multiline changes. Set end_line to -1 to denote the end of the file
|
||||
goto <line_num> - This will take you directly to a line and show you the 100 lines below it.
|
||||
<bash_command> <args> - You can use any bash command you need (cd, ls, rm, grep, dir, mv, wget, git, zip, etc.) with their arguments included
|
||||
pip install <package> - You can use this to import python packages. Make sure you include the correct package name when using this command.
|
||||
@ -67,7 +67,7 @@ args:
|
||||
start: 0
|
||||
end: -1
|
||||
thought: Thoughts:
|
||||
I need to add the code to the 'hello.sh' script to print 'hello' without asking for confirmation. I will use the echo command to achieve this.
|
||||
I need to add the code to the 'hello.sh' script that will print 'hello' when executed without any prompts for confirmation.
|
||||
|
||||
Action:
|
||||
|
||||
@ -85,7 +85,7 @@ args:
|
||||
start: 0
|
||||
end: -1
|
||||
thought: Thoughts:
|
||||
I need to add the code to the 'hello.sh' script to print 'hello' without asking for confirmation. I will use the echo command to achieve this.
|
||||
I need to add the code to the 'hello.sh' script that will print 'hello' when executed without any prompts for confirmation. I will simply add the command to print 'hello' to the script.
|
||||
|
||||
Action:
|
||||
|
||||
@ -103,7 +103,7 @@ args:
|
||||
start: 0
|
||||
end: -1
|
||||
thought: Thoughts:
|
||||
I need to add the code to the 'hello.sh' script to print 'hello' without asking for confirmation. I will use the echo command to achieve this.
|
||||
I need to add the command to print 'hello' in the 'hello.sh' script without any prompts for confirmation. Since the script is already created, I will simply edit the existing script to include the command to print 'hello'.
|
||||
|
||||
Action:
|
||||
|
||||
@ -121,7 +121,7 @@ args:
|
||||
start: 0
|
||||
end: -1
|
||||
thought: Thoughts:
|
||||
I need to add the code to the 'hello.sh' script to print 'hello' without asking for confirmation. I will use the echo command to achieve this.
|
||||
I need to add the command to print 'hello' in the 'hello.sh' script without any prompts for confirmation. Since the script is already created, I will simply edit the existing script to include the command to print 'hello'.
|
||||
|
||||
Action:
|
||||
|
||||
|
||||
@ -40,7 +40,7 @@ write <file> <changes> [<start_line>] [<end_line>] - Modifies a <file> by replac
|
||||
browse <url> - Returns the text version of any url, this can be useful to look up documentation or finding issues on github
|
||||
scroll_up - Takes no arguments. This will scroll up and show you the 100 lines above your current lines
|
||||
scroll_down - Takes no arguments. This will scroll down and show you the 100 lines below your current lines
|
||||
edit <start_line> <end_line> <changes> - This will modify lines in the currently open file. use start_line and end_line to designate which lines to change and then write the multiline changes
|
||||
edit <start_line> <end_line> <changes> - This will modify lines in the currently open file. use start_line and end_line to designate which lines to change and then write the multiline changes. Set end_line to -1 to denote the end of the file
|
||||
goto <line_num> - This will take you directly to a line and show you the 100 lines below it.
|
||||
<bash_command> <args> - You can use any bash command you need (cd, ls, rm, grep, dir, mv, wget, git, zip, etc.) with their arguments included
|
||||
pip install <package> - You can use this to import python packages. Make sure you include the correct package name when using this command.
|
||||
@ -67,7 +67,7 @@ args:
|
||||
start: 0
|
||||
end: -1
|
||||
thought: Thoughts:
|
||||
I need to add the code to the 'hello.sh' script to print 'hello' without asking for confirmation. I will use the echo command to achieve this.
|
||||
I need to add the code to the 'hello.sh' script that will print 'hello' when executed without any prompts for confirmation. I will simply add the command to print 'hello' to the script.
|
||||
|
||||
Action:
|
||||
|
||||
@ -85,7 +85,7 @@ args:
|
||||
start: 0
|
||||
end: -1
|
||||
thought: Thoughts:
|
||||
I need to add the code to the 'hello.sh' script to print 'hello' without asking for confirmation. I will use the echo command to achieve this.
|
||||
I need to add the command to print 'hello' in the 'hello.sh' script without any prompts for confirmation. Since the script is already created, I will simply edit the existing script to include the command to print 'hello'.
|
||||
|
||||
Action:
|
||||
|
||||
@ -103,7 +103,7 @@ args:
|
||||
start: 0
|
||||
end: -1
|
||||
thought: Thoughts:
|
||||
I need to add the code to the 'hello.sh' script to print 'hello' without asking for confirmation. I will use the echo command to achieve this.
|
||||
I need to add the command to print 'hello' in the 'hello.sh' script without any prompts for confirmation. Since the script is already created, I will simply edit the existing script to include the command to print 'hello'.
|
||||
|
||||
Action:
|
||||
|
||||
@ -121,7 +121,7 @@ args:
|
||||
start: 0
|
||||
end: -1
|
||||
thought: Thoughts:
|
||||
I need to add the code to the 'hello.sh' script to print 'hello' without asking for confirmation. I will use the echo command to achieve this.
|
||||
I need to add the command to print 'hello' in the 'hello.sh' script without any prompts for confirmation. Since the script is already open, I will simply write the command to print 'hello' in the script.
|
||||
|
||||
Action:
|
||||
|
||||
|
||||
@ -40,7 +40,7 @@ write <file> <changes> [<start_line>] [<end_line>] - Modifies a <file> by replac
|
||||
browse <url> - Returns the text version of any url, this can be useful to look up documentation or finding issues on github
|
||||
scroll_up - Takes no arguments. This will scroll up and show you the 100 lines above your current lines
|
||||
scroll_down - Takes no arguments. This will scroll down and show you the 100 lines below your current lines
|
||||
edit <start_line> <end_line> <changes> - This will modify lines in the currently open file. use start_line and end_line to designate which lines to change and then write the multiline changes
|
||||
edit <start_line> <end_line> <changes> - This will modify lines in the currently open file. use start_line and end_line to designate which lines to change and then write the multiline changes. Set end_line to -1 to denote the end of the file
|
||||
goto <line_num> - This will take you directly to a line and show you the 100 lines below it.
|
||||
<bash_command> <args> - You can use any bash command you need (cd, ls, rm, grep, dir, mv, wget, git, zip, etc.) with their arguments included
|
||||
pip install <package> - You can use this to import python packages. Make sure you include the correct package name when using this command.
|
||||
@ -67,7 +67,7 @@ args:
|
||||
start: 0
|
||||
end: -1
|
||||
thought: Thoughts:
|
||||
I need to add the code to the 'hello.sh' script to print 'hello' without asking for confirmation. I will use the echo command to achieve this.
|
||||
I need to add the command to print 'hello' in the 'hello.sh' script without any prompts for confirmation. Since the script is already created, I will simply edit the existing script to include the command to print 'hello'.
|
||||
|
||||
Action:
|
||||
|
||||
@ -85,7 +85,7 @@ args:
|
||||
start: 0
|
||||
end: -1
|
||||
thought: Thoughts:
|
||||
I need to add the code to the 'hello.sh' script to print 'hello' without asking for confirmation. I will use the echo command to achieve this.
|
||||
I need to add the command to print 'hello' in the 'hello.sh' script without any prompts for confirmation. Since the script is already created, I will simply edit the existing script to include the command to print 'hello'.
|
||||
|
||||
Action:
|
||||
|
||||
@ -103,7 +103,7 @@ args:
|
||||
start: 0
|
||||
end: -1
|
||||
thought: Thoughts:
|
||||
I need to add the code to the 'hello.sh' script to print 'hello' without asking for confirmation. I will use the echo command to achieve this.
|
||||
I need to add the command to print 'hello' in the 'hello.sh' script without any prompts for confirmation. Since the script is already open, I will simply write the command to print 'hello' in the script.
|
||||
|
||||
Action:
|
||||
|
||||
@ -115,20 +115,19 @@ extras:
|
||||
|
||||
Memory 3:
|
||||
Previous Action:
|
||||
action: read
|
||||
action: write
|
||||
args:
|
||||
path: hello.sh
|
||||
start: 0
|
||||
end: -1
|
||||
thought: Thoughts:
|
||||
I have already written the shell script 'hello.sh' to print 'hello' without asking for confirmation. I need to verify the content of the file to ensure that the script is correctly implemented.
|
||||
I need to add the command to print 'hello' in the 'hello.sh' script without any prompts for confirmation. Since the script is already open, I will write the command to print 'hello' directly into the script.
|
||||
|
||||
Action:
|
||||
|
||||
Output from Action:
|
||||
observation: read
|
||||
content: echo 'hello'
|
||||
|
||||
observation: write
|
||||
content:
|
||||
extras:
|
||||
path: hello.sh
|
||||
======= End Actions =======
|
||||
|
||||
@ -40,7 +40,7 @@ write <file> <changes> [<start_line>] [<end_line>] - Modifies a <file> by replac
|
||||
browse <url> - Returns the text version of any url, this can be useful to look up documentation or finding issues on github
|
||||
scroll_up - Takes no arguments. This will scroll up and show you the 100 lines above your current lines
|
||||
scroll_down - Takes no arguments. This will scroll down and show you the 100 lines below your current lines
|
||||
edit <start_line> <end_line> <changes> - This will modify lines in the currently open file. use start_line and end_line to designate which lines to change and then write the multiline changes
|
||||
edit <start_line> <end_line> <changes> - This will modify lines in the currently open file. use start_line and end_line to designate which lines to change and then write the multiline changes. Set end_line to -1 to denote the end of the file
|
||||
goto <line_num> - This will take you directly to a line and show you the 100 lines below it.
|
||||
<bash_command> <args> - You can use any bash command you need (cd, ls, rm, grep, dir, mv, wget, git, zip, etc.) with their arguments included
|
||||
pip install <package> - You can use this to import python packages. Make sure you include the correct package name when using this command.
|
||||
@ -67,7 +67,7 @@ args:
|
||||
start: 0
|
||||
end: -1
|
||||
thought: Thoughts:
|
||||
I need to add the code to the 'hello.sh' script to print 'hello' without asking for confirmation. I will use the echo command to achieve this.
|
||||
I need to add the command to print 'hello' in the 'hello.sh' script without any prompts for confirmation. Since the script is already created, I will simply edit the existing script to include the command to print 'hello'.
|
||||
|
||||
Action:
|
||||
|
||||
@ -85,7 +85,7 @@ args:
|
||||
start: 0
|
||||
end: -1
|
||||
thought: Thoughts:
|
||||
I need to add the code to the 'hello.sh' script to print 'hello' without asking for confirmation. I will use the echo command to achieve this.
|
||||
I need to add the command to print 'hello' in the 'hello.sh' script without any prompts for confirmation. Since the script is already open, I will simply write the command to print 'hello' in the script.
|
||||
|
||||
Action:
|
||||
|
||||
@ -97,38 +97,39 @@ extras:
|
||||
|
||||
Memory 2:
|
||||
Previous Action:
|
||||
action: read
|
||||
action: write
|
||||
args:
|
||||
path: hello.sh
|
||||
start: 0
|
||||
end: -1
|
||||
thought: Thoughts:
|
||||
I have already written the shell script 'hello.sh' to print 'hello' without asking for confirmation. I need to verify the content of the file to ensure that the script is correctly implemented.
|
||||
I need to add the command to print 'hello' in the 'hello.sh' script without any prompts for confirmation. Since the script is already open, I will write the command to print 'hello' directly into the script.
|
||||
|
||||
Action:
|
||||
|
||||
Output from Action:
|
||||
observation: read
|
||||
content: echo 'hello'
|
||||
|
||||
observation: write
|
||||
content:
|
||||
extras:
|
||||
path: hello.sh
|
||||
|
||||
Memory 3:
|
||||
Previous Action:
|
||||
action: run
|
||||
action: write
|
||||
args:
|
||||
command: bash chmod +x hello.sh
|
||||
background: False
|
||||
thought:
|
||||
path: hello.sh
|
||||
start: 0
|
||||
end: -1
|
||||
thought: Thoughts:
|
||||
I need to add the command to print 'hello' in the 'hello.sh' script without any prompts for confirmation. Since the script is already open, I will directly write the command to print 'hello' in the script.
|
||||
|
||||
Action:
|
||||
|
||||
Output from Action:
|
||||
observation: run
|
||||
content: /usr/bin/chmod: /usr/bin/chmod: cannot execute binary file
|
||||
observation: write
|
||||
content:
|
||||
extras:
|
||||
command_id: -1
|
||||
command: bash chmod +x hello.sh
|
||||
exit_code: 126
|
||||
path: hello.sh
|
||||
======= End Actions =======
|
||||
Use these memories to provide additional context to the problem you are solving.
|
||||
Remember that you have already completed these steps so you do not need to perform them again.
|
||||
|
||||
@ -40,7 +40,7 @@ write <file> <changes> [<start_line>] [<end_line>] - Modifies a <file> by replac
|
||||
browse <url> - Returns the text version of any url, this can be useful to look up documentation or finding issues on github
|
||||
scroll_up - Takes no arguments. This will scroll up and show you the 100 lines above your current lines
|
||||
scroll_down - Takes no arguments. This will scroll down and show you the 100 lines below your current lines
|
||||
edit <start_line> <end_line> <changes> - This will modify lines in the currently open file. use start_line and end_line to designate which lines to change and then write the multiline changes
|
||||
edit <start_line> <end_line> <changes> - This will modify lines in the currently open file. use start_line and end_line to designate which lines to change and then write the multiline changes. Set end_line to -1 to denote the end of the file
|
||||
goto <line_num> - This will take you directly to a line and show you the 100 lines below it.
|
||||
<bash_command> <args> - You can use any bash command you need (cd, ls, rm, grep, dir, mv, wget, git, zip, etc.) with their arguments included
|
||||
pip install <package> - You can use this to import python packages. Make sure you include the correct package name when using this command.
|
||||
@ -67,7 +67,7 @@ args:
|
||||
start: 0
|
||||
end: -1
|
||||
thought: Thoughts:
|
||||
I need to add the code to the 'hello.sh' script to print 'hello' without asking for confirmation. I will use the echo command to achieve this.
|
||||
I need to add the command to print 'hello' in the 'hello.sh' script without any prompts for confirmation. Since the script is already open, I will simply write the command to print 'hello' in the script.
|
||||
|
||||
Action:
|
||||
|
||||
@ -79,54 +79,57 @@ extras:
|
||||
|
||||
Memory 1:
|
||||
Previous Action:
|
||||
action: read
|
||||
action: write
|
||||
args:
|
||||
path: hello.sh
|
||||
start: 0
|
||||
end: -1
|
||||
thought: Thoughts:
|
||||
I have already written the shell script 'hello.sh' to print 'hello' without asking for confirmation. I need to verify the content of the file to ensure that the script is correctly implemented.
|
||||
I need to add the command to print 'hello' in the 'hello.sh' script without any prompts for confirmation. Since the script is already open, I will write the command to print 'hello' directly into the script.
|
||||
|
||||
Action:
|
||||
|
||||
Output from Action:
|
||||
observation: read
|
||||
content: echo 'hello'
|
||||
|
||||
observation: write
|
||||
content:
|
||||
extras:
|
||||
path: hello.sh
|
||||
|
||||
Memory 2:
|
||||
Previous Action:
|
||||
action: run
|
||||
action: write
|
||||
args:
|
||||
command: bash chmod +x hello.sh
|
||||
background: False
|
||||
thought:
|
||||
path: hello.sh
|
||||
start: 0
|
||||
end: -1
|
||||
thought: Thoughts:
|
||||
I need to add the command to print 'hello' in the 'hello.sh' script without any prompts for confirmation. Since the script is already open, I will directly write the command to print 'hello' in the script.
|
||||
|
||||
Action:
|
||||
|
||||
Output from Action:
|
||||
observation: run
|
||||
content: /usr/bin/chmod: /usr/bin/chmod: cannot execute binary file
|
||||
observation: write
|
||||
content:
|
||||
extras:
|
||||
command_id: -1
|
||||
command: bash chmod +x hello.sh
|
||||
exit_code: 126
|
||||
path: hello.sh
|
||||
|
||||
Memory 3:
|
||||
Previous Action:
|
||||
action: run
|
||||
action: write
|
||||
args:
|
||||
command: chmod +x hello.sh
|
||||
background: False
|
||||
thought:
|
||||
path: hello.sh
|
||||
start: 0
|
||||
end: -1
|
||||
thought: Thoughts:
|
||||
I need to add the command to print 'hello' in the 'hello.sh' script without any prompts for confirmation. Since the script is already open, I will directly write the command to print 'hello' in the script.
|
||||
|
||||
Action:
|
||||
|
||||
Output from Action:
|
||||
observation: run
|
||||
observation: write
|
||||
content:
|
||||
extras:
|
||||
command_id: -1
|
||||
command: chmod +x hello.sh
|
||||
exit_code: 0
|
||||
path: hello.sh
|
||||
======= End Actions =======
|
||||
Use these memories to provide additional context to the problem you are solving.
|
||||
Remember that you have already completed these steps so you do not need to perform them again.
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
Thoughts:
|
||||
I need to create a shell script named 'hello.sh' that prints 'hello' without asking for confirmation. I will use the echo command to print 'hello' to the console.
|
||||
I need to create a shell script named 'hello.sh' that will print 'hello' when executed. I will need to ensure that the script does not prompt for any confirmation during execution.
|
||||
|
||||
Action:
|
||||
```
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
Thoughts:
|
||||
I need to add the code to the 'hello.sh' script to print 'hello' without asking for confirmation. I will use the echo command to achieve this.
|
||||
I need to add the code to the 'hello.sh' script that will print 'hello' when executed without any prompts for confirmation.
|
||||
|
||||
Action:
|
||||
```
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
Thoughts:
|
||||
I need to add the code to the 'hello.sh' script to print 'hello' without asking for confirmation. I will use the echo command to achieve this.
|
||||
I need to add the code to the 'hello.sh' script that will print 'hello' when executed without any prompts for confirmation. I will simply add the command to print 'hello' to the script.
|
||||
|
||||
Action:
|
||||
```
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
Thoughts:
|
||||
I need to add the code to the 'hello.sh' script to print 'hello' without asking for confirmation. I will use the echo command to achieve this.
|
||||
I need to add the command to print 'hello' in the 'hello.sh' script without any prompts for confirmation. Since the script is already created, I will simply edit the existing script to include the command to print 'hello'.
|
||||
|
||||
Action:
|
||||
```
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
Thoughts:
|
||||
I need to add the code to the 'hello.sh' script to print 'hello' without asking for confirmation. I will use the echo command to achieve this.
|
||||
I need to add the command to print 'hello' in the 'hello.sh' script without any prompts for confirmation. Since the script is already created, I will simply edit the existing script to include the command to print 'hello'.
|
||||
|
||||
Action:
|
||||
```
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
Thoughts:
|
||||
I need to add the code to the 'hello.sh' script to print 'hello' without asking for confirmation. I will use the echo command to achieve this.
|
||||
I need to add the command to print 'hello' in the 'hello.sh' script without any prompts for confirmation. Since the script is already open, I will simply write the command to print 'hello' in the script.
|
||||
|
||||
Action:
|
||||
```
|
||||
|
||||
@ -1,7 +1,7 @@
|
||||
Thoughts:
|
||||
I have already written the shell script 'hello.sh' to print 'hello' without asking for confirmation. I need to verify the content of the file to ensure that the script is correctly implemented.
|
||||
I need to add the command to print 'hello' in the 'hello.sh' script without any prompts for confirmation. Since the script is already open, I will write the command to print 'hello' directly into the script.
|
||||
|
||||
Action:
|
||||
```
|
||||
read hello.sh
|
||||
edit 0 -1 "echo 'hello'"
|
||||
```
|
||||
|
||||
@ -1,7 +1,7 @@
|
||||
Thoughts:
|
||||
I need to ensure that the 'hello.sh' script is executable. This can be done by using the chmod command to add the execute permission to the file.
|
||||
I need to add the command to print 'hello' in the 'hello.sh' script without any prompts for confirmation. Since the script is already open, I will directly write the command to print 'hello' in the script.
|
||||
|
||||
Action:
|
||||
```
|
||||
bash chmod +x hello.sh
|
||||
edit 0 -1 "echo 'hello'"
|
||||
```
|
||||
|
||||
@ -1,7 +1,7 @@
|
||||
Thoughts:
|
||||
I need to make the 'hello.sh' script executable so that it can be run. The previous attempt to make it executable using the 'bash chmod +x hello.sh' command resulted in an error. I will use the 'chmod' command directly to make the script executable.
|
||||
I need to add the command to print 'hello' in the 'hello.sh' script without any prompts for confirmation. Since the script is already open, I will directly write the command to print 'hello' in the script.
|
||||
|
||||
Action:
|
||||
```
|
||||
chmod +x hello.sh
|
||||
edit 0 -1 "echo 'hello'"
|
||||
```
|
||||
|
||||
@ -1,7 +1,7 @@
|
||||
Thoughts:
|
||||
The shell script 'hello.sh' has been created to print 'hello' without asking for confirmation. The script content is currently set to "echo 'hello'". The next step is to make sure that the script is executable and then test it to ensure that it prints 'hello' without asking for confirmation.
|
||||
I have already opened the 'hello.sh' script and need to add the command to print 'hello' without any prompts for confirmation. I will use the `edit` command to insert the necessary code to achieve this.
|
||||
|
||||
Action:
|
||||
```
|
||||
chmod +x hello.sh
|
||||
edit 0 -1 "echo 'hello'"
|
||||
```
|
||||
|
||||
@ -6,8 +6,9 @@ import yaml
|
||||
|
||||
from agenthub.micro.registry import all_microagents
|
||||
from opendevin.controller.agent import Agent
|
||||
from opendevin.controller.state.plan import Plan
|
||||
from opendevin.controller.state.state import State
|
||||
from opendevin.events.action import MessageAction
|
||||
from opendevin.events.observation import NullObservation
|
||||
|
||||
|
||||
def test_all_agents_are_loaded():
|
||||
@ -33,10 +34,12 @@ def test_coder_agent_with_summary():
|
||||
|
||||
coder_agent = Agent.get_cls('CoderAgent')(llm=mock_llm)
|
||||
assert coder_agent is not None
|
||||
|
||||
task = 'This is a dummy task'
|
||||
plan = Plan(task)
|
||||
history = [(MessageAction(content=task), NullObservation(''))]
|
||||
history[0][0]._source = 'user'
|
||||
summary = 'This is a dummy summary about this repo'
|
||||
state = State(plan, inputs={'summary': summary})
|
||||
state = State(history=history, inputs={'summary': summary})
|
||||
coder_agent.step(state)
|
||||
|
||||
mock_llm.completion.assert_called_once()
|
||||
@ -58,9 +61,11 @@ def test_coder_agent_without_summary():
|
||||
|
||||
coder_agent = Agent.get_cls('CoderAgent')(llm=mock_llm)
|
||||
assert coder_agent is not None
|
||||
|
||||
task = 'This is a dummy task'
|
||||
plan = Plan(task)
|
||||
state = State(plan)
|
||||
history = [(MessageAction(content=task), NullObservation(''))]
|
||||
history[0][0]._source = 'user'
|
||||
state = State(history=history)
|
||||
coder_agent.step(state)
|
||||
|
||||
mock_llm.completion.assert_called_once()
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user