|
|
@@ -16,14 +16,18 @@ Every agent also has a `self.llm` which it can use to interact with the LLM conf
|
|
|
See the [LiteLLM docs for `self.llm.completion`](https://docs.litellm.ai/docs/completion).
|
|
|
|
|
|
## State
|
|
|
+
|
|
|
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
|
|
|
- * The agent can add and modify subtasks through the `AddTaskAction` and `ModifyTaskAction`
|
|
|
+
|
|
|
+- 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
|
|
|
+ - The agent can add and modify subtasks through the `AddTaskAction` and `ModifyTaskAction`
|
|
|
|
|
|
## Actions
|
|
|
+
|
|
|
Here is a list of available Actions, which can be returned by `agent.step()`:
|
|
|
+
|
|
|
- [`CmdRunAction`](../opendevin/action/bash.py) - Runs a command inside a sandboxed terminal
|
|
|
- [`CmdKillAction`](../opendevin/action/bash.py) - Kills a background command
|
|
|
- [`IPythonRunCellAction`](../opendevin/action/bash.py) - Execute a block of Python code interactively (in Jupyter notebook) and receives `CmdOutputObservation`. Requires setting up `jupyter` [plugin](../opendevin/sandbox/plugins) as a requirement.
|
|
|
@@ -43,11 +47,13 @@ Here is a list of available Actions, which can be returned by `agent.step()`:
|
|
|
You can use `action.to_dict()` and `action_from_dict` to serialize and deserialize actions.
|
|
|
|
|
|
## Observations
|
|
|
+
|
|
|
There are also several types of Observations. These are typically available in the step following the corresponding Action.
|
|
|
But they may also appear as a result of asynchronous events (e.g. a message from the user, logs from a command running
|
|
|
in the background).
|
|
|
|
|
|
Here is a list of available Observations:
|
|
|
+
|
|
|
- [`CmdOutputObservation`](../opendevin/observation/run.py)
|
|
|
- [`BrowserOutputObservation`](../opendevin/observation/browse.py)
|
|
|
- [`FileReadObservation`](../opendevin/observation/files.py)
|
|
|
@@ -59,19 +65,24 @@ Here is a list of available Observations:
|
|
|
You can use `observation.to_dict()` and `observation_from_dict` to serialize and deserialize observations.
|
|
|
|
|
|
## Interface
|
|
|
+
|
|
|
Every agent must implement the following methods:
|
|
|
|
|
|
### `step`
|
|
|
+
|
|
|
```
|
|
|
def step(self, state: "State") -> "Action"
|
|
|
```
|
|
|
+
|
|
|
`step` moves the agent forward one step towards its goal. This probably means
|
|
|
sending a prompt to the LLM, then parsing the response into an `Action`.
|
|
|
|
|
|
### `search_memory`
|
|
|
+
|
|
|
```
|
|
|
-def search_memory(self, query: str) -> List[str]:
|
|
|
+def search_memory(self, query: str) -> list[str]:
|
|
|
```
|
|
|
+
|
|
|
`search_memory` should return a list of events that match the query. This will be used
|
|
|
for the `recall` action.
|
|
|
|