Files
OpenHands/agenthub
Josh Hendershot 197e7fb2c0 fix(agenthub): update initial thoughts (#281)
* fix(agenthub): update initial thoughts

* edit langchains_agent
2024-03-29 15:57:10 -04:00
..
2024-03-29 11:47:29 -04:00
2024-03-29 11:47:29 -04:00
2024-03-29 11:47:29 -04:00

Agent Framework Research

In this folder, there may exist multiple implementations of Agent that will be used by the

For example, agenthub/langchain_agent, agenthub/metagpt_agent, agenthub/codeact_agent, etc. Contributors from different backgrounds and interests can choose to contribute to any (or all!) of these directions.

Constructing an Agent

The abstraction for an agent can be found here.

On a high-level, at each step, an agent takes in a State object and outputs an Action.

Your 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.

We now have two main categories of actions:

  • ExecutableAction: will produces a corresponding Observation (source here) for the agent to take the next Action.
  • NotExecutableAction: will produces a NullObservation by the controller, which could means telling the agent to ignore this action.

For ExecutableAction, we currently have:

  • CmdRunAction and CmdKillAction for bash command (see source here).
  • FileReadAction and FileWriteAction for file operations (see source here).
  • BrowseURLAction to open a web page (see source here).
  • AgentThinkAction, AgentFinishAction: these are non-executable actions for agent to update its status to the user. For example, agent could use AgentThink to explain its though process to the user (see source here).
  • AgentEchoAction: the agent can produce some messages as its own Observation in the next .step, this will produces a AgentMessageObservation (see source here).
  • AgentRecallAction: recalls a past memory (see source here).

search_memory

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

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