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.
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:
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 correspondingObservation
(source here) for the agent to take the nextAction
.NotExecutableAction
: will produces aNullObservation
by the controller, which could means telling the agent to ignore this action.
For ExecutableAction
, we currently have:
CmdRunAction
andCmdKillAction
for bash command (see source here).FileReadAction
andFileWriteAction
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 useAgentThink
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 aAgentMessageObservation
(see source here).AgentRecallAction
: recalls a past memory (see source here).
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.