* feat: add all the new component docs to the site * fix(docs): relative links and markdown warnings * feat(docs): How to contribute to the docs as a docs section * fix(docs): missed docs page for developer setup * fix(docs): re-add configurations options * fix(docs): bad link to components fixed * fix(docs): bad link to components fixed * ref(docs): reorder some items to make more sense * fix(docs): bad indentation and duplicate block * fix(docs): warning about out of date markdown extension * fix(docs): broken links fixed * fix(docs): markdown formatter complaints
1.9 KiB
🤖 Agents
Agent is composed of 🧩 Components and responsible for executing pipelines and some additional logic. The base class for all agents is BaseAgent, it has the necessary logic to collect components and execute protocols.
Important methods
BaseAgent provides two abstract methods needed for any agent to work properly:
propose_action: This method is responsible for proposing an action based on the current state of the agent, it returnsThoughtProcessOutput.execute: This method is responsible for executing the proposed action, returnsActionResult.
AutoGPT Agent
Agent is the main agent provided by AutoGPT. It's a subclass of BaseAgent. It has all the Built-in Components. Agent implements the essential abstract methods from BaseAgent: propose_action and execute.
Building your own Agent
The easiest way to build your own agent is to extend the Agent class and add additional components. By doing this you can reuse the existing components and the default logic for executing ⚙️ Protocols.
class MyComponent(AgentComponent):
pass
class MyAgent(Agent):
def __init__(
self,
settings: AgentSettings,
llm_provider: ChatModelProvider,
file_storage: FileStorage,
legacy_config: Config,
):
# Call the parent constructor to bring in the default components
super().__init__(settings, llm_provider, file_storage, legacy_config)
# Add your custom component
self.my_component = MyComponent()
For more customization, you can override the propose_action and execute or even subclass BaseAgent directly. This way you can have full control over the agent's components and behavior. Have a look at the implementation of Agent for more details.