|
|
hace 1 año | |
|---|---|---|
| .. | ||
| codeact_agent | hace 1 año | |
| langchains_agent | hace 1 año | |
| README.md | hace 1 año | |
| __init__.py | hace 1 año | |
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:
stepdef 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_memorydef 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.