Docs migration from mintlify
|
@ -0,0 +1,32 @@
|
|||
# Mintlify Starter Kit
|
||||
|
||||
Click on `Use this template` to copy the Mintlify starter kit. The starter kit contains examples including
|
||||
|
||||
- Guide pages
|
||||
- Navigation
|
||||
- Customizations
|
||||
- API Reference pages
|
||||
- Use of popular components
|
||||
|
||||
### Development
|
||||
|
||||
Install the [Mintlify CLI](https://www.npmjs.com/package/mintlify) to preview the documentation changes locally. To install, use the following command
|
||||
|
||||
```
|
||||
npm i -g mintlify
|
||||
```
|
||||
|
||||
Run the following command at the root of your documentation (where mint.json is)
|
||||
|
||||
```
|
||||
mintlify dev
|
||||
```
|
||||
|
||||
### Publishing Changes
|
||||
|
||||
Install our Github App to auto propagate changes from your repo to your deployment. Changes will be deployed to production automatically after pushing to the default branch. Find the link to install on your dashboard.
|
||||
|
||||
#### Troubleshooting
|
||||
|
||||
- Mintlify dev isn't running - Run `mintlify install` it'll re-install dependencies.
|
||||
- Page loads as a 404 - Make sure you are running in a folder with `mint.json`
|
|
@ -1,16 +0,0 @@
|
|||
window.MathJax = {
|
||||
tex: {
|
||||
inlineMath: [["\\(", "\\)"]],
|
||||
displayMath: [["\\[", "\\]"]],
|
||||
processEscapes: true,
|
||||
processEnvironments: true
|
||||
},
|
||||
options: {
|
||||
ignoreHtmlClass: ".*|",
|
||||
processHtmlClass: "arithmatex"
|
||||
}
|
||||
};
|
||||
|
||||
document$.subscribe(() => {
|
||||
MathJax.typesetPromise()
|
||||
})
|
|
@ -1,6 +0,0 @@
|
|||
document$.subscribe(function () {
|
||||
var tables = document.querySelectorAll("article table:not([class])")
|
||||
tables.forEach(function (table) {
|
||||
new Tablesort(table)
|
||||
})
|
||||
})
|
|
@ -0,0 +1,43 @@
|
|||
---
|
||||
title: Code of Conduct for AutoGPT
|
||||
sidebarTitle: Code of Conduct
|
||||
---
|
||||
|
||||
## 1\. Purpose
|
||||
|
||||
The purpose of this Code of Conduct is to provide guidelines for contributors to the AutoGPT projects on GitHub. We aim to create a positive and inclusive environment where all participants can contribute and collaborate effectively. By participating in this project, you agree to abide by this Code of Conduct.
|
||||
|
||||
## 2\. Scope
|
||||
|
||||
This Code of Conduct applies to all contributors, maintainers, and users of the AutoGPT project. It extends to all project spaces, including but not limited to issues, pull requests, code reviews, comments, and other forms of communication within the project.
|
||||
|
||||
## 3\. Our Standards
|
||||
|
||||
We encourage the following behavior:
|
||||
|
||||
* Being respectful and considerate to others
|
||||
* Actively seeking diverse perspectives
|
||||
* Providing constructive feedback and assistance
|
||||
* Demonstrating empathy and understanding
|
||||
|
||||
We discourage the following behavior:
|
||||
|
||||
* Harassment or discrimination of any kind
|
||||
* Disrespectful, offensive, or inappropriate language or content
|
||||
* Personal attacks or insults
|
||||
* Unwarranted criticism or negativity
|
||||
|
||||
## 4\. Reporting and Enforcement
|
||||
|
||||
If you witness or experience any violations of this Code of Conduct, please report them to the project maintainers by email or other appropriate means. The maintainers will investigate and take appropriate action, which may include warnings, temporary or permanent bans, or other measures as necessary.
|
||||
|
||||
Maintainers are responsible for ensuring compliance with this Code of Conduct and may take action to address any violations.
|
||||
|
||||
## 5\. Acknowledgements
|
||||
This Code of Conduct is adapted from the [Contributor Covenant](https://www.contributor-covenant.org/version/2/0/code_of_conduct.html).
|
||||
|
||||
## 6\. Contact
|
||||
|
||||
If you have any questions or concerns, please contact the project maintainers on Discord: https://discord.gg/autogpt
|
||||
|
||||
April 26, 2023 April 16, 2023
|
|
@ -1,6 +1,9 @@
|
|||
# Configuration
|
||||
---
|
||||
title: Configuration
|
||||
description: "Configuration of sensitive settings such as API credentials is done through environment variables."
|
||||
mode: wide
|
||||
---
|
||||
|
||||
Configuration of sensitive settings such as API credentials is done through environment variables.
|
||||
You can set configuration variables via the `.env` file. If you don't have a `.env` file, create a copy of `.env.template` in your `AutoGPT` folder and name it `.env`.
|
||||
|
||||
## Environment Variables
|
||||
|
@ -9,7 +12,7 @@ You can set configuration variables via the `.env` file. If you don't have a `.e
|
|||
- `ANTHROPIC_API_KEY`: Set this if you want to use Anthropic models with AutoGPT
|
||||
- `AZURE_CONFIG_FILE`: Location of the Azure Config file relative to the AutoGPT root directory. Default: azure.yaml
|
||||
- `COMPONENT_CONFIG_FILE`: Path to the component configuration file (json) for an agent. Optional
|
||||
- `DISABLED_COMMANDS`: Commands to disable. Use comma separated names of commands. See the list of commands from built-in components [here](../../forge/components/components.md). Default: None
|
||||
- `DISABLED_COMMANDS`: Commands to disable. Use comma separated names of commands. See the list of commands from built-in components [here](/classic/forge/components/components). Default: None
|
||||
- `ELEVENLABS_API_KEY`: ElevenLabs API Key. Optional.
|
||||
- `ELEVENLABS_VOICE_ID`: ElevenLabs Voice ID. Optional.
|
||||
- `EMBEDDING_MODEL`: LLM Model to use for embedding tasks. Default: `text-embedding-3-small`
|
|
@ -1,10 +1,16 @@
|
|||
## 🔍 Google API Keys Configuration
|
||||
---
|
||||
title: Google API Keys Configuration
|
||||
sidebarTitle: Search
|
||||
---
|
||||
|
||||
!!! note
|
||||
This section is optional. Use the official Google API if search attempts return
|
||||
error 429. To use the `google` command, you need to set up your
|
||||
Google API key in your environment variables or pass it with configuration to the [`WebSearchComponent`](../../forge/components/built-in-components.md).
|
||||
<Info>
|
||||
**Note**
|
||||
|
||||
This section is optional. Use the official Google API if search attempts return
|
||||
error 429. To use the `google` command, you need to set up your
|
||||
Google API key in your environment variables or pass it with configuration to the [`WebSearchComponent`](/classic/forge/components/built-in-components).
|
||||
|
||||
</Info>
|
||||
Create your project:
|
||||
|
||||
1. Go to the [Google Cloud Console](https://console.cloud.google.com/).
|
|
@ -1,5 +1,7 @@
|
|||
# Text to Speech
|
||||
|
||||
---
|
||||
title: Text to Speech
|
||||
sidebarTitle: Voice
|
||||
---
|
||||
Enter this command to use TTS _(Text-to-Speech)_ for AutoGPT
|
||||
|
||||
```shell
|
||||
|
@ -21,8 +23,11 @@ In the `.env` file set:
|
|||
|
||||
### List of available voices
|
||||
|
||||
!!! note
|
||||
You can use either the name or the voice ID to configure a voice
|
||||
<Info>
|
||||
**Note**
|
||||
|
||||
You can use either the name or the voice ID to configure a voice
|
||||
</Info>
|
||||
|
||||
| Name | Voice ID |
|
||||
| ------ | -------- |
|
|
@ -0,0 +1,29 @@
|
|||
---
|
||||
title: AutoGPT Contribution Guide
|
||||
---
|
||||
|
||||
If you are reading this, you are probably looking for the full **[contribution guide](https://github.com/Significant-Gravitas/AutoGPT/wiki/Contributing)**, which is part of our [wiki](https://github.com/Significant-Gravitas/AutoGPT/wiki).
|
||||
|
||||
Also check out our [Roadmap](https://github.com/Significant-Gravitas/AutoGPT/discussions/6971) for information about our priorities and associated tasks.
|
||||
|
||||
## Contributing to the AutoGPT Platform Folder
|
||||
|
||||
All contributions to [the autogpt_platform folder](https://github.com/Significant-Gravitas/AutoGPT/blob/master/autogpt_platform) will be under our [Contribution License Agreement](https://github.com/Significant-Gravitas/AutoGPT/blob/master/autogpt_platform/Contributor%20License%20Agreement%20(CLA).md). By making a pull request contributing to this folder, you agree to the terms of our CLA for your contribution. All contributions to other folders will be under the MIT license.
|
||||
|
||||
## In short
|
||||
|
||||
1. Avoid duplicate work, issues, PRs etc.
|
||||
2. We encourage you to collaborate with fellow community members on some of our bigger [todo's](https://github.com/Significant-Gravitas/AutoGPT/discussions/6971)!
|
||||
3. We highly recommend to post your idea and discuss it in the [dev channel](https://discord.com/channels/1092243196446249134/1095817829405704305).
|
||||
4. Create a draft PR when starting work on bigger changes.
|
||||
5. Adhere to the [Code Guidelines](https://github.com/Significant-Gravitas/AutoGPT/wiki/Contributing#code-guidelines)
|
||||
6. Clearly explain your changes when submitting a PR.
|
||||
7. Don't submit broken code: test/validate your changes.
|
||||
8. Avoid making unnecessary changes, especially if they're purely based on your personal preferences. Doing so is the maintainers' job. ;-)
|
||||
9. Please also consider contributing something other than code; see the [contribution guide](https://github.com/Significant-Gravitas/AutoGPT/wiki/Contributing) for options.
|
||||
|
||||
If you wish to involve with the project (beyond just contributing PRs), please read the wiki page about [Catalyzing](https://github.com/Significant-Gravitas/AutoGPT/wiki/Catalyzing).
|
||||
|
||||
In fact, why not just look through the whole wiki (it's only a few pages) and hop on our Discord. See you there! :-)
|
||||
|
||||
The team @ AutoGPT https://discord.gg/autogpt
|
|
@ -0,0 +1,37 @@
|
|||
---
|
||||
title: Agents
|
||||
---
|
||||
|
||||
Agent is composed of [<Icon icon="puzzle-piece" iconType="solid"/> Components](../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: 1. `propose_action`: This method is responsible for proposing an action based on the current state of the agent, it returns `ThoughtProcessOutput`. 2\. `execute`: This method is responsible for executing the proposed action, returns `ActionResult`.
|
||||
|
||||
## AutoGPT Agent
|
||||
|
||||
`Agent` is the main agent provided by AutoGPT. It's a subclass of `BaseAgent`. It has all the [Built-in Components](/classic/forge/components/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 [<Icon icon="gear" iconType="solid"/> Protocols](/classic/forge/components/protocols).
|
||||
|
||||
```py
|
||||
class MyComponent(AgentComponent):
|
||||
pass
|
||||
|
||||
class MyAgent(Agent):
|
||||
def __init__(
|
||||
self,
|
||||
settings: AgentSettings,
|
||||
llm_provider: MultiProvider
|
||||
file_storage: FileStorage,
|
||||
app_config: AppConfig,
|
||||
):
|
||||
# Call the parent constructor to bring in the default components
|
||||
super().__init__(settings, llm_provider, file_storage, app_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](https://github.com/Significant-Gravitas/AutoGPT/tree/master/classic/original_autogpt/agents/agent.py) for more details.
|
|
@ -0,0 +1,219 @@
|
|||
---
|
||||
title: Built-in Components
|
||||
---
|
||||
|
||||
This page lists all [<Icon icon="puzzle-piece" iconType="solid"/> Components](../components/) and [<Icon icon="gear" iconType="solid"/> Protocols](/classic/forge/components/protocols) they implement that are natively provided. They are used by the AutoGPT agent. Some components have additional configuration options listed in the table, see [Component configuration](../components/#component-configuration) to learn more.
|
||||
|
||||
<Info>
|
||||
**Note**
|
||||
|
||||
If a configuration field uses environment variable, it still can be passed using configuration model. ### Value from the configuration takes precedence over env var! Env var will be only applied if value in the configuration is not set.
|
||||
</Info>
|
||||
|
||||
## `SystemComponent`
|
||||
|
||||
Essential component to allow an agent to finish.
|
||||
|
||||
### DirectiveProvider
|
||||
|
||||
* Constraints about API budget
|
||||
|
||||
### MessageProvider
|
||||
|
||||
* Current time and date
|
||||
* Remaining API budget and warnings if budget is low
|
||||
|
||||
### CommandProvider
|
||||
|
||||
* `finish` used when task is completed
|
||||
|
||||
## `UserInteractionComponent`
|
||||
|
||||
Adds ability to interact with user in CLI.
|
||||
|
||||
### CommandProvider
|
||||
* `ask_user` used to ask user for input
|
||||
|
||||
## `FileManagerComponent`
|
||||
|
||||
Adds ability to read and write persistent files to local storage, Google Cloud Storage or Amazon's S3. Necessary for saving and loading agent's state (preserving session).
|
||||
|
||||
### `FileManagerConfiguration`
|
||||
|
||||
| Config variable | Details | Type | Default |
|
||||
| --- | --- | --- | --- |
|
||||
| `storage_path` | Path to agent files, e.g. state | `str` | `agents/{agent_id}/`\[^1\] |
|
||||
| `workspace_path` | Path to files that agent has access to | `str` | `agents/{agent_id}/workspace/`\[^1\] |
|
||||
|
||||
\[^1\] This option is set dynamically during component construction as opposed to by default inside the configuration model, `{agent_id}` is replaced with the agent's unique identifier.
|
||||
|
||||
### DirectiveProvider
|
||||
|
||||
* Resource information that it's possible to read and write files
|
||||
|
||||
### CommandProvider
|
||||
|
||||
* `read_file` used to read file
|
||||
* `write_file` used to write file
|
||||
* `list_folder` lists all files in a folder
|
||||
|
||||
## `CodeExecutorComponent`
|
||||
|
||||
Lets the agent execute non-interactive Shell commands and Python code. Python execution works only if Docker is available.
|
||||
|
||||
### `CodeExecutorConfiguration`
|
||||
|
||||
| Config variable | Details | Type | Default |
|
||||
| --- | --- | --- | --- |
|
||||
| `execute_local_commands` | Enable shell command execution | `bool` | `False` |
|
||||
| `shell_command_control` | Controls which list is used | `"allowlist" \\| "denylist"` | `"allowlist"` |
|
||||
| `shell_allowlist` | List of allowed shell commands | `List[str]` | `[]` |
|
||||
| `shell_denylist` | List of prohibited shell commands | `List[str]` | `[]` |
|
||||
| `docker_container_name` | Name of the Docker container used for code execution | `str` | `"agent_sandbox"` |
|
||||
|
||||
All shell command configurations are expected to be for convience only. This component is not secure and should not be used in production environments. It is recommended to use more appropriate sandboxing.
|
||||
|
||||
### CommandProvider
|
||||
|
||||
* `execute_shell` execute shell command
|
||||
* `execute_shell_popen` execute shell command with popen
|
||||
* `execute_python_code` execute Python code
|
||||
* `execute_python_file` execute Python file
|
||||
|
||||
## `ActionHistoryComponent`
|
||||
|
||||
Keeps track of agent's actions and their outcomes. Provides their summary to the prompt.
|
||||
|
||||
### `ActionHistoryConfiguration`
|
||||
|
||||
| Config variable | Details | Type | Default |
|
||||
| --- | --- | --- | --- |
|
||||
| `llm_name` | Name of the llm model used to compress the history | `ModelName` | `"gpt-3.5-turbo"` |
|
||||
| `max_tokens` | Maximum number of tokens to use for the history summary | `int` | `1024` |
|
||||
| `spacy_language_model` | Language model used for summary chunking using spacy | `str` | `"en_core_web_sm"` |
|
||||
| `full_message_count` | Number of cycles to include unsummarized in the prompt | `int` | `4` |
|
||||
|
||||
### MessageProvider
|
||||
|
||||
* Agent's progress summary
|
||||
|
||||
### AfterParse
|
||||
|
||||
* Register agent's action
|
||||
|
||||
### ExecutionFailure
|
||||
|
||||
* Rewinds the agent's action, so it isn't saved
|
||||
|
||||
### AfterExecute
|
||||
|
||||
* Saves the agent's action result in the history
|
||||
|
||||
## `GitOperationsComponent`
|
||||
|
||||
Adds ability to iteract with git repositories and GitHub.
|
||||
|
||||
### `GitOperationsConfiguration`
|
||||
|
||||
| Config variable | Details | Type | Default |
|
||||
| --- | --- | --- | --- |
|
||||
| `github_username` | GitHub username, _ENV:_ `GITHUB_USERNAME` | `str` | `None` |
|
||||
| `github_api_key` | GitHub API key, _ENV:_ `GITHUB_API_KEY` | `str` | `None` |
|
||||
|
||||
### CommandProvider
|
||||
|
||||
* `clone_repository` used to clone a git repository
|
||||
|
||||
## `ImageGeneratorComponent`
|
||||
|
||||
Adds ability to generate images using various providers.
|
||||
|
||||
### Hugging Face
|
||||
|
||||
To use text-to-image models from Hugging Face, you need a Hugging Face API token. Link to the appropriate settings page: [Hugging Face > Settings > Tokens](https://huggingface.co/settings/tokens)
|
||||
|
||||
### Stable Diffusion WebUI
|
||||
|
||||
It is possible to use your own self-hosted Stable Diffusion WebUI with AutoGPT. ### Make sure you are running WebUI with `--api` enabled.
|
||||
|
||||
### `ImageGeneratorConfiguration`
|
||||
|
||||
| Config variable | Details | Type | Default |
|
||||
| --- | --- | --- | --- |
|
||||
| `image_provider` | Image generation provider | `"dalle" \\| "huggingface" \\| "sdwebui"` | `"dalle"` |
|
||||
| `huggingface_image_model` | Hugging Face image model, see [available models](https://huggingface.co/models?pipeline_tag=text-to-image) | `str` | `"CompVis/stable-diffusion-v1-4"` |
|
||||
| `huggingface_api_token` | Hugging Face API token, _ENV:_ `HUGGINGFACE_API_TOKEN` | `str` | `None` |
|
||||
| `sd_webui_url` | URL to self-hosted Stable Diffusion WebUI | `str` | `"http://localhost:7860"` |
|
||||
| `sd_webui_auth` | Basic auth for Stable Diffusion WebUI, _ENV:_ `SD_WEBUI_AUTH` | `str` of format `{username}:{password}` | `None` |
|
||||
|
||||
### CommandProvider
|
||||
|
||||
* `generate_image` used to generate an image given a prompt
|
||||
|
||||
## `WebSearchComponent`
|
||||
|
||||
Allows agent to search the web. Google credentials aren't required for DuckDuckGo. [Instructions how to set up Google API key](../../../classic/configuration/search/)
|
||||
|
||||
### `WebSearchConfiguration`
|
||||
|
||||
| Config variable | Details | Type | Default |
|
||||
| --- | --- | --- | --- |
|
||||
| `google_api_key` | Google API key, _ENV:_ `GOOGLE_API_KEY` | `str` | `None` |
|
||||
| `google_custom_search_engine_id` | Google Custom Search Engine ID, _ENV:_ `GOOGLE_CUSTOM_SEARCH_ENGINE_ID` | `str` | `None` |
|
||||
| `duckduckgo_max_attempts` | Maximum number of attempts to search using DuckDuckGo | `int` | `3` |
|
||||
| `duckduckgo_backend` | Backend to be used for DDG sdk | `"api" \\| "html" \\| "lite"` | `"api"` |
|
||||
|
||||
### DirectiveProvider
|
||||
|
||||
* Resource information that it's possible to search the web
|
||||
|
||||
### CommandProvider
|
||||
|
||||
* `search_web` used to search the web using DuckDuckGo
|
||||
* `google` used to search the web using Google, requires API key
|
||||
|
||||
## `WebSeleniumComponent`
|
||||
|
||||
Allows agent to read websites using Selenium.
|
||||
|
||||
### `WebSeleniumConfiguration`
|
||||
|
||||
| Config variable | Details | Type | Default |
|
||||
| --- | --- | --- | --- |
|
||||
| `llm_name` | Name of the llm model used to read websites | `ModelName` | `"gpt-3.5-turbo"` |
|
||||
| `web_browser` | Web browser used by Selenium | `"chrome" \\| "firefox" \\| "safari" \\| "edge"` | `"chrome"` |
|
||||
| `headless` | Run browser in headless mode | `bool` | `True` |
|
||||
| `user_agent` | User agent used by the browser | `str` | `"Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_4) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/83.0.4103.97 Safari/537.36"` |
|
||||
| `browse_spacy_language_model` | Spacy language model used for chunking text | `str` | `"en_core_web_sm"` |
|
||||
| `selenium_proxy` | Http proxy to use with Selenium | `str` | `None` |
|
||||
|
||||
### DirectiveProvider
|
||||
* Resource information that it's possible to read websites
|
||||
|
||||
### CommandProvider
|
||||
|
||||
* `read_website` used to read a specific url and look for specific topics or answer a question
|
||||
|
||||
## `ContextComponent`
|
||||
|
||||
Adds ability to keep up-to-date file and folder content in the prompt.
|
||||
|
||||
### MessageProvider
|
||||
|
||||
* Content of elements in the context
|
||||
|
||||
### CommandProvider
|
||||
|
||||
* `open_file` used to open a file into context
|
||||
* `open_folder` used to open a folder into context
|
||||
* `close_context_item` remove an item from the context
|
||||
|
||||
## `WatchdogComponent`
|
||||
|
||||
Watches if agent is looping and switches to smart mode if necessary.
|
||||
|
||||
### AfterParse
|
||||
|
||||
* Investigates what happened and switches to smart mode if necessary
|
||||
|
||||
December 4, 2024 April 22, 2024
|
|
@ -1,6 +1,9 @@
|
|||
# 🛠️ Commands
|
||||
---
|
||||
title: Commands
|
||||
description: "Commands are a way for the agent to do anything; e.g. interact with the user or APIs and use tools."
|
||||
---
|
||||
|
||||
Commands are a way for the agent to do anything; e.g. interact with the user or APIs and use tools. They are provided by components that implement the `CommandProvider` [⚙️ Protocol](./protocols.md). Commands are functions that can be called by the agent, they can have parameters and return values that will be seen by the agent.
|
||||
They are provided by components that implement the `CommandProvider` [<Icon icon="gear" iconType="solid"/> Protocol](/classic/forge/components/protocols). Commands are functions that can be called by the agent, they can have parameters and return values that will be seen by the agent.
|
||||
|
||||
```py
|
||||
class CommandProvider(Protocol):
|
||||
|
@ -29,16 +32,16 @@ The easiest and recommended way to provide a command is to use `command` decorat
|
|||
required=True,
|
||||
)})
|
||||
def multiply(self, a: int, b: int) -> str:
|
||||
"""
|
||||
Multiplies two numbers.
|
||||
|
||||
Args:
|
||||
a: First number
|
||||
b: Second number
|
||||
"""
|
||||
Multiplies two numbers.
|
||||
|
||||
Returns:
|
||||
Result of multiplication
|
||||
"""
|
||||
Args:
|
||||
a: First number
|
||||
b: Second number
|
||||
|
||||
Returns:
|
||||
Result of multiplication
|
||||
"""
|
||||
return str(a * b)
|
||||
```
|
||||
|
||||
|
@ -77,7 +80,6 @@ def get_commands(self) -> Iterator[Command]:
|
|||
If you don't want to use the decorator, you can create a `Command` object directly.
|
||||
|
||||
```py
|
||||
|
||||
def multiply(self, a: int, b: int) -> str:
|
||||
return str(a * b)
|
||||
|
||||
|
@ -99,4 +101,4 @@ def get_commands(self) -> Iterator[Command]:
|
|||
)),
|
||||
],
|
||||
)
|
||||
```
|
||||
```
|
|
@ -0,0 +1,227 @@
|
|||
---
|
||||
title: Components
|
||||
description: "Components can be used to implement various functionalities like providing messages to the prompt, executing code, or interacting with external services. They can be enabled or disabled, ordered, and can rely on each other."
|
||||
---
|
||||
|
||||
|
||||
Components are the building blocks of [<Icon icon="robot" iconType="solid"/> Agents](/classic/forge/components/agents). They are classes inheriting `AgentComponent` or implementing one or more [<Icon icon="gear" iconType="solid"/> Protocols](/classic/forge/components/protocols) that give agent additional abilities or processing.
|
||||
|
||||
|
||||
Components assigned in the agent's `__init__` via `self` are automatically detected upon the agent's instantiation. For example inside `__init__`: `self.my_component = MyComponent()`. You can use any valid Python variable name, what matters for the component to be detected is its type (`AgentComponent` or any protocol inheriting from it).
|
||||
|
||||
Visit [Built-in Components](/classic/forge/components/built-in-components) to see what components are available out of the box.
|
||||
|
||||
```py
|
||||
from forge.agent import BaseAgent
|
||||
from forge.agent.components import AgentComponent
|
||||
|
||||
class HelloComponent(AgentComponent):
|
||||
pass
|
||||
|
||||
class SomeComponent(AgentComponent):
|
||||
def __init__(self, hello_component: HelloComponent):
|
||||
self.hello_component = hello_component
|
||||
|
||||
class MyAgent(BaseAgent):
|
||||
def __init__(self):
|
||||
# These components will be automatically discovered and used
|
||||
self.hello_component = HelloComponent()
|
||||
# We pass HelloComponent to SomeComponent
|
||||
self.some_component = SomeComponent(self.hello_component)
|
||||
```
|
||||
|
||||
## Component configuration
|
||||
|
||||
Each component can have its own configuration defined using a regular pydantic `BaseModel`. To ensure the configuration is loaded from the file correctly, the component must inherit from `ConfigurableComponent[BM]` where `BM` is the configuration model it uses. `ConfigurableComponent` provides a `config` attribute that holds the configuration instance. It's possible to either set the `config` attribute directly or pass the configuration instance to the component's constructor. Extra configuration (i.e. for components that are not part of the agent) can be passed and will be silently ignored. Extra config won't be applied even if the component is added later. To see the configuration of built-in components visit [Built-in Components](/classic/forge/components/built-in-components).
|
||||
|
||||
```py
|
||||
from pydantic import BaseModel
|
||||
from forge.agent.components import ConfigurableComponent
|
||||
|
||||
class MyConfig(BaseModel):
|
||||
some_value: str
|
||||
|
||||
class MyComponent(AgentComponent, ConfigurableComponent[MyConfig]):
|
||||
def __init__(self, config: MyConfig):
|
||||
super().__init__(config)
|
||||
# This has the same effect as above:
|
||||
# self.config = config
|
||||
|
||||
def get_some_value(self) -> str:
|
||||
# Access the configuration like a regular model
|
||||
return self.config.some_value
|
||||
```
|
||||
|
||||
### Sensitive information
|
||||
|
||||
While it's possible to pass sensitive data directly in code to the configuration it's recommended to use `UserConfigurable(from_env="ENV_VAR_NAME", exclude=True)` field for sensitive data like API keys. The data will be loaded from the environment variable but keep in mind that value passed in code takes precedence. All fields, even excluded ones (`exclude=True`) will be loaded when the configuration is loaded from the file. Exclusion allows you to skip them during _serialization_, non excluded `SecretStr` will be serialized literally as a `"**********"` string.
|
||||
|
||||
```py
|
||||
from pydantic import BaseModel, SecretStr
|
||||
from forge.models.config import UserConfigurable
|
||||
|
||||
class SensitiveConfig(BaseModel):
|
||||
api_key: SecretStr = UserConfigurable(from_env="API_KEY", exclude=True)
|
||||
```
|
||||
|
||||
### Configuration serialization
|
||||
`BaseAgent` provides two methods: 1. `dump_component_configs`: Serializes all components' configurations as json string. 1. `load_component_configs`: Deserializes json string to configuration and applies it.
|
||||
|
||||
### JSON configuration
|
||||
|
||||
You can specify a JSON file (e.g. `config.json`) to use for the configuration when launching an agent. This file contains settings for individual [Components](/classic/forge/components/introduction) that AutoGPT uses. To specify the file use `--component-config-file` CLI option, for example to use `config.json`:
|
||||
|
||||
```bash
|
||||
./autogpt.sh run --component-config-file config.json
|
||||
```
|
||||
|
||||
<Info>
|
||||
**Note**
|
||||
|
||||
If you're using Docker to run AutoGPT, you need to mount or copy the configuration file to the container. See [Docker Guide](/classic/setup/docker) for more information.
|
||||
</Info>
|
||||
|
||||
### Example JSON configuration
|
||||
|
||||
You can copy configuration you want to change, for example to `classic/original_autogpt/config.json` and modify it to your needs. _Most configuration has default values, it's better to set only values you want to modify._ You can see the available configuration fields and default values in [Build-in Components](/classic/forge/components/built-in-components). You can set sensitive variables in the `.json` file as well but it's recommended to use environment variables instead.
|
||||
|
||||
```json
|
||||
{
|
||||
"CodeExecutorConfiguration": {
|
||||
"execute_local_commands": false,
|
||||
"shell_command_control": "allowlist",
|
||||
"shell_allowlist": ["cat", "echo"],
|
||||
"shell_denylist": [],
|
||||
"docker_container_name": "agent_sandbox"
|
||||
},
|
||||
"FileManagerConfiguration": {
|
||||
"storage_path": "agents/AutoGPT/",
|
||||
"workspace_path": "agents/AutoGPT/workspace"
|
||||
},
|
||||
"GitOperationsConfiguration": {
|
||||
"github_username": null
|
||||
},
|
||||
"ActionHistoryConfiguration": {
|
||||
"llm_name": "gpt-3.5-turbo",
|
||||
"max_tokens": 1024,
|
||||
"spacy_language_model": "en_core_web_sm"
|
||||
},
|
||||
"ImageGeneratorConfiguration": {
|
||||
"image_provider": "dalle",
|
||||
"huggingface_image_model": "CompVis/stable-diffusion-v1-4",
|
||||
"sd_webui_url": "http://localhost:7860"
|
||||
},
|
||||
"WebSearchConfiguration": {
|
||||
"duckduckgo_max_attempts": 3
|
||||
},
|
||||
"WebSeleniumConfiguration": {
|
||||
"llm_name": "gpt-3.5-turbo",
|
||||
"web_browser": "chrome",
|
||||
"headless": true,
|
||||
"user_agent": "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_4) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/83.0.4103.97 Safari/537.36",
|
||||
"browse_spacy_language_model": "en_core_web_sm"
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
## Ordering components
|
||||
|
||||
The execution order of components is important because some may depend on the results of the previous ones. **By default, components are ordered alphabetically.**
|
||||
|
||||
### Ordering individual components
|
||||
|
||||
You can order a single component by passing other components (or their types) to the `run_after` method. This way you can ensure that the component will be executed after the specified one. The `run_after` method returns the component itself, so you can call it when assigning the component to a variable:
|
||||
|
||||
```js
|
||||
class MyAgent(Agent):
|
||||
def __init__(self):
|
||||
self.hello_component = HelloComponent()
|
||||
self.calculator_component = CalculatorComponent().run_after(self.hello_component)
|
||||
# This is equivalent to passing a type:
|
||||
# self.calculator_component = CalculatorComponent().run_after(HelloComponent)`
|
||||
```
|
||||
<Warning>
|
||||
**Warning**
|
||||
|
||||
Be sure not to make circular dependencies when ordering components!
|
||||
|
||||
</Warning>
|
||||
### Ordering all components
|
||||
|
||||
You can also order all components by setting `self.components` list in the agent's `__init__` method. This way ensures that there's no circular dependencies and any `run_after` calls are ignored.
|
||||
|
||||
<Warning>
|
||||
**Warning**
|
||||
|
||||
Be sure to include all components - by setting `self.components` list, you're overriding the default behavior of discovering components automatically. Since it's usually not intended agent will inform you in the terminal if some components were skipped.
|
||||
|
||||
</Warning>
|
||||
```py
|
||||
class MyAgent(Agent):
|
||||
def __init__(self):
|
||||
self.hello_component = HelloComponent()
|
||||
self.calculator_component = CalculatorComponent()
|
||||
# Explicitly set components list
|
||||
self.components = [self.hello_component, self.calculator_component]
|
||||
```
|
||||
|
||||
## Disabling components
|
||||
|
||||
You can control which components are enabled by setting their `_enabled` attribute. Components are _enabled_ by default. Either provide a `bool` value or a `Callable[[], bool]`, will be checked each time the component is about to be executed. This way you can dynamically enable or disable components based on some conditions. You can also provide a reason for disabling the component by setting `_disabled_reason`. The reason will be visible in the debug information.
|
||||
|
||||
```py
|
||||
class DisabledComponent(MessageProvider):
|
||||
def __init__(self):
|
||||
# Disable this component
|
||||
self._enabled = False
|
||||
self._disabled_reason = "This component is disabled because of reasons."
|
||||
|
||||
# Or disable based on some condition, either statically...:
|
||||
self._enabled = self.some_property is not None
|
||||
# ... or dynamically:
|
||||
self._enabled = lambda: self.some_property is not None
|
||||
|
||||
# This method will never be called
|
||||
def get_messages(self) -> Iterator[ChatMessage]:
|
||||
yield ChatMessage.user("This message won't be seen!")
|
||||
|
||||
def some_condition(self) -> bool:
|
||||
return False
|
||||
```
|
||||
If you don't want the component at all, you can just remove it from the agent's `__init__` method. If you want to remove components you inherit from the parent class you can set the relevant attribute to `None`:
|
||||
|
||||
<Warning>
|
||||
**Warning**
|
||||
|
||||
Be careful when removing components that are required by other components. This may lead to errors and unexpected behavior.
|
||||
|
||||
</Warning>
|
||||
```py
|
||||
class MyAgent(Agent):
|
||||
def __init__(self):
|
||||
super().__init__(...)
|
||||
# Disable WatchdogComponent that is in the parent class
|
||||
self.watchdog = None`
|
||||
```
|
||||
## Exceptions
|
||||
|
||||
Custom errors are provided which can be used to control the execution flow in case something went wrong. All those errors can be raised in protocol methods and will be caught by the agent.
|
||||
By default agent will retry three times and then re-raise an exception if it's still not resolved. All passed arguments are automatically handled and the values are reverted when needed. All errors accept an optional `str` message. There are following errors ordered by increasing broadness:
|
||||
|
||||
1. `ComponentEndpointError`: A single endpoint method failed to execute. Agent will retry the execution of this endpoint on the component.
|
||||
2. `EndpointPipelineError`: A pipeline failed to execute. Agent will retry the execution of the endpoint for all components.
|
||||
3. `ComponentSystemError`: Multiple pipelines failed.
|
||||
|
||||
**Example**
|
||||
|
||||
`from forge.agent.components import ComponentEndpointError
|
||||
from forge.agent.protocols import MessageProvider
|
||||
|
||||
#### Example of raising an error
|
||||
```py
|
||||
class MyComponent(MessageProvider):
|
||||
def get_messages(self) -> Iterator[ChatMessage]:
|
||||
# This will cause the component to always fail
|
||||
# and retry 3 times before re-raising the exception
|
||||
raise ComponentEndpointError("Endpoint error!")`
|
||||
```
|
|
@ -1,19 +1,21 @@
|
|||
# Creating Components
|
||||
---
|
||||
title: Creating Components
|
||||
---
|
||||
|
||||
## The minimal component
|
||||
|
||||
Components can be used to implement various functionalities like providing messages to the prompt, executing code, or interacting with external services.
|
||||
|
||||
*Component* is a class that inherits from `AgentComponent` OR implements one or more *protocols*. Every *protocol* inherits `AgentComponent`, so your class automatically becomes a *component* once you inherit any *protocol*.
|
||||
_Component_ is a class that inherits from `AgentComponent` OR implements one or more _protocols_. Every _protocol_ inherits `AgentComponent`, so your class automatically becomes a _component_ once you inherit any _protocol_.
|
||||
|
||||
```py
|
||||
class MyComponent(AgentComponent):
|
||||
pass
|
||||
```
|
||||
|
||||
This is already a valid component, but it doesn't do anything yet. To add some functionality to it, you need to implement one or more *protocols*.
|
||||
This is already a valid component, but it doesn't do anything yet. To add some functionality to it, you need to implement one or more _protocols_.
|
||||
|
||||
Let's create a simple component that adds "Hello World!" message to the agent's prompt. To do this we need to implement `MessageProvider` *protocol* in our component. `MessageProvider` is an interface with `get_messages` method:
|
||||
Let's create a simple component that adds "Hello World!" message to the agent's prompt. To do this we need to implement `MessageProvider` _protocol_ in our component. `MessageProvider` is an interface with `get_messages` method:
|
||||
|
||||
```py
|
||||
# No longer need to inherit AgentComponent, because MessageProvider already does it
|
||||
|
@ -29,12 +31,11 @@ class MyAgent(Agent):
|
|||
self.hello_component = HelloComponent()
|
||||
```
|
||||
|
||||
`get_messages` will called by the agent each time it needs to build a new prompt and the yielded messages will be added accordingly.
|
||||
`get_messages` will called by the agent each time it needs to build a new prompt and the yielded messages will be added accordingly.
|
||||
|
||||
## Passing data to and between components
|
||||
|
||||
Since components are regular classes you can pass data (including other components) to them via the `__init__` method.
|
||||
For example we can pass a config object and then retrieve an API key from it when needed:
|
||||
Since components are regular classes you can pass data (including other components) to them via the `__init__` method. For example we can pass a config object and then retrieve an API key from it when needed:
|
||||
|
||||
```py
|
||||
class DataComponent(MessageProvider):
|
||||
|
@ -48,16 +49,16 @@ class DataComponent(MessageProvider):
|
|||
yield ChatMessage.system("API key not found!")
|
||||
```
|
||||
|
||||
!!! note
|
||||
Component-specific configuration handling isn't implemented yet.
|
||||
<Info>
|
||||
**Note**
|
||||
|
||||
Component-specific configuration handling isn't implemented yet.
|
||||
|
||||
</Info>
|
||||
|
||||
## Configuring components
|
||||
|
||||
Components can be configured using a pydantic model.
|
||||
To make component configurable, it must inherit from `ConfigurableComponent[BM]` where `BM` is the configuration class inheriting from pydantic's `BaseModel`.
|
||||
You should pass the configuration instance to the `ConfigurableComponent`'s `__init__` or set its `config` property directly.
|
||||
Using configuration allows you to load confugration from a file, and also serialize and deserialize it easily for any agent.
|
||||
To learn more about configuration, including storing sensitive information and serialization see [Component Configuration](./components.md#component-configuration).
|
||||
Components can be configured using a pydantic model. To make component configurable, it must inherit from `ConfigurableComponent[BM]` where `BM` is the configuration class inheriting from pydantic's `BaseModel`. You should pass the configuration instance to the `ConfigurableComponent`'s `__init__` or set its `config` property directly. Using configuration allows you to load confugration from a file, and also serialize and deserialize it easily for any agent. To learn more about configuration, including storing sensitive information and serialization see [Component Configuration](../components/#component-configuration).
|
||||
|
||||
```py
|
||||
# Example component configuration
|
||||
|
@ -103,54 +104,51 @@ class MultiplicatorComponent(CommandProvider):
|
|||
required=True,
|
||||
)})
|
||||
def multiply(self, a: int, b: int) -> str:
|
||||
"""
|
||||
Multiplies two numbers.
|
||||
|
||||
Args:
|
||||
a: First number
|
||||
b: Second number
|
||||
"""
|
||||
Multiplies two numbers.
|
||||
|
||||
Returns:
|
||||
Result of multiplication
|
||||
"""
|
||||
Args:
|
||||
a: First number
|
||||
b: Second number
|
||||
|
||||
Returns:
|
||||
Result of multiplication
|
||||
"""
|
||||
return str(a * b)
|
||||
```
|
||||
|
||||
To learn more about commands see [🛠️ Commands](./commands.md).
|
||||
To learn more about commands see [<Icon icon="screwdriver-wrench" iconType="solid"/> Commands](/classic/forge/components/commands).
|
||||
|
||||
## Prompt structure
|
||||
|
||||
After components provided all necessary data, the agent needs to build the final prompt that will be send to a llm.
|
||||
Currently, `PromptStrategy` (*not* a protocol) is responsible for building the final prompt.
|
||||
After components provided all necessary data, the agent needs to build the final prompt that will be send to a llm. Currently, `PromptStrategy` (_not_ a protocol) is responsible for building the final prompt.
|
||||
|
||||
If you want to change the way the prompt is built, you need to create a new `PromptStrategy` class, and then call relevant methods in your agent class.
|
||||
You can have a look at the default strategy used by the AutoGPT Agent: [OneShotAgentPromptStrategy](https://github.com/Significant-Gravitas/AutoGPT/tree/master/classic/original_autogpt/agents/prompt_strategies/one_shot.py), and how it's used in the [Agent](https://github.com/Significant-Gravitas/AutoGPT/tree/master/classic/original_autogpt/agents/agent.py) (search for `self.prompt_strategy`).
|
||||
If you want to change the way the prompt is built, you need to create a new `PromptStrategy` class, and then call relevant methods in your agent class. You can have a look at the default strategy used by the AutoGPT Agent: [OneShotAgentPromptStrategy](https://github.com/Significant-Gravitas/AutoGPT/tree/master/classic/original_autogpt/agents/prompt_strategies/one_shot.py), and how it's used in the [Agent](https://github.com/Significant-Gravitas/AutoGPT/tree/master/classic/original_autogpt/agents/agent.py) (search for `self.prompt_strategy`).
|
||||
|
||||
## Example `UserInteractionComponent`
|
||||
|
||||
Let's create a slightly simplified version of the component that is used by the built-in agent.
|
||||
It gives an ability for the agent to ask user for input in the terminal.
|
||||
Let's create a slightly simplified version of the component that is used by the built-in agent. It gives an ability for the agent to ask user for input in the terminal.
|
||||
|
||||
1. Create a class for the component that inherits from `CommandProvider`.
|
||||
1. Create a class for the component that inherits from `CommandProvider`.
|
||||
|
||||
```py
|
||||
class MyUserInteractionComponent(CommandProvider):
|
||||
"""Provides commands to interact with the user."""
|
||||
"""Provides commands to interact with the user."""
|
||||
pass
|
||||
```
|
||||
|
||||
2. Implement command method that will ask user for input and return it.
|
||||
2. Implement command method that will ask user for input and return it.
|
||||
|
||||
```py
|
||||
def ask_user(self, question: str) -> str:
|
||||
"""If you need more details or information regarding the given goals,
|
||||
you can ask the user for input."""
|
||||
"""If you need more details or information regarding the given goals,
|
||||
you can ask the user for input."""
|
||||
print(f"\nQ: {question}")
|
||||
resp = input("A:")
|
||||
return f"The user's answer: '{resp}'"
|
||||
```
|
||||
|
||||
3. The command needs to be decorated with `@command`.
|
||||
3. The command needs to be decorated with `@command`.
|
||||
|
||||
```py
|
||||
@command(
|
||||
|
@ -163,21 +161,21 @@ It gives an ability for the agent to ask user for input in the terminal.
|
|||
},
|
||||
)
|
||||
def ask_user(self, question: str) -> str:
|
||||
"""If you need more details or information regarding the given goals,
|
||||
you can ask the user for input."""
|
||||
"""If you need more details or information regarding the given goals,
|
||||
you can ask the user for input."""
|
||||
print(f"\nQ: {question}")
|
||||
resp = input("A:")
|
||||
return f"The user's answer: '{resp}'"
|
||||
```
|
||||
|
||||
4. We need to implement `CommandProvider`'s `get_commands` method to yield the command.
|
||||
4. We need to implement `CommandProvider`'s `get_commands` method to yield the command.
|
||||
|
||||
```py
|
||||
def get_commands(self) -> Iterator[Command]:
|
||||
yield self.ask_user
|
||||
```
|
||||
|
||||
5. Since agent isn't always running in the terminal or interactive mode, we need to disable this component by setting `self._enabled=False` when it's not possible to ask for user input.
|
||||
5. Since agent isn't always running in the terminal or interactive mode, we need to disable this component by setting `self._enabled=False` when it's not possible to ask for user input.
|
||||
|
||||
```py
|
||||
def __init__(self, interactive_mode: bool):
|
||||
|
@ -185,12 +183,13 @@ It gives an ability for the agent to ask user for input in the terminal.
|
|||
self._enabled = interactive_mode
|
||||
```
|
||||
|
||||
|
||||
The final component should look like this:
|
||||
|
||||
```py
|
||||
# 1.
|
||||
class MyUserInteractionComponent(CommandProvider):
|
||||
"""Provides commands to interact with the user."""
|
||||
"""Provides commands to interact with the user."""
|
||||
|
||||
# We pass config to check if we're in noninteractive mode
|
||||
def __init__(self, interactive_mode: bool):
|
||||
|
@ -218,14 +217,13 @@ class MyUserInteractionComponent(CommandProvider):
|
|||
# 2.
|
||||
# Command name will be its method name and description will be its docstring
|
||||
def ask_user(self, question: str) -> str:
|
||||
"""If you need more details or information regarding the given goals,
|
||||
you can ask the user for input."""
|
||||
"""If you need more details or information regarding the given goals,
|
||||
you can ask the user for input."""
|
||||
print(f"\nQ: {question}")
|
||||
resp = input("A:")
|
||||
return f"The user's answer: '{resp}'"
|
||||
return f"The user's answer: '{resp}'"`
|
||||
```
|
||||
|
||||
Now if we want to use our user interaction *instead of* the default one we need to somehow remove the default one (if our agent inherits from `Agent` the default one is inherited) and add our own. We can simply override the `user_interaction` in `__init__` method:
|
||||
Now if we want to use our user interaction _instead of_ the default one we need to somehow remove the default one (if our agent inherits from `Agent` the default one is inherited) and add our own. We can simply override the `user_interaction` in `__init__` method:
|
||||
|
||||
```py
|
||||
class MyAgent(Agent):
|
||||
|
@ -241,7 +239,6 @@ class MyAgent(Agent):
|
|||
# Disable the default user interaction component by overriding it
|
||||
self.user_interaction = MyUserInteractionComponent()
|
||||
```
|
||||
|
||||
Alternatively we can disable the default component by setting it to `None`:
|
||||
|
||||
```py
|
||||
|
@ -258,13 +255,13 @@ class MyAgent(Agent):
|
|||
# Disable the default user interaction component
|
||||
self.user_interaction = None
|
||||
# Add our own component
|
||||
self.my_user_interaction = MyUserInteractionComponent(app_config)
|
||||
```
|
||||
self.my_user_interaction = MyUserInteractionComponent(app_config
|
||||
```
|
||||
|
||||
## Learn more
|
||||
|
||||
The best place to see more examples is to look at the built-in components in the [classic/original_autogpt/components](https://github.com/Significant-Gravitas/AutoGPT/tree/master/classic/original_autogpt/components/) and [classic/original_autogpt/commands](https://github.com/Significant-Gravitas/AutoGPT/tree/master/classic/original_autogpt/commands/) directories.
|
||||
|
||||
Guide on how to extend the built-in agent and build your own: [🤖 Agents](./agents.md)
|
||||
Order of some components matters, see [🧩 Components](./components.md) to learn more about components and how they can be customized.
|
||||
To see built-in protocols with accompanying examples visit [⚙️ Protocols](./protocols.md).
|
||||
Guide on how to extend the built-in agent and build your own: [<Icon icon="robot" iconType="solid"/> Agents](/classic/forge/components/agents)
|
||||
Order of some components matters, see [<Icon icon="puzzle-piece" iconType="solid"/> Components](../components/) to learn more about components and how they can be customized.
|
||||
To see built-in protocols with accompanying examples visit [<Icon icon="gear" iconType="solid"/> Protocols](/classic/forge/components/protocols).
|
|
@ -0,0 +1,25 @@
|
|||
---
|
||||
title: Component Agents
|
||||
---
|
||||
|
||||
<Note>
|
||||
**Important**
|
||||
|
||||
[Legacy plugins](https://github.com/Significant-Gravitas/Auto-GPT-Plugins) no longer work with AutoGPT. They have been replaced by components, although we're still working on a new system to load plug-in components.
|
||||
</Note>
|
||||
|
||||
This guide explains the component-based architecture of AutoGPT agents. It's a new way of building agents that is more flexible and easier to extend. Components replace some agent's logic and plugins with a more modular and composable system.
|
||||
|
||||
Agent is composed of _components_, and each _component_ implements a range of _protocols_ (interfaces), each one providing a specific functionality, e.g. additional commands or messages. Each _protocol_ is handled in a specific order, defined by the agent. This allows for a clear separation of concerns and a more modular design.
|
||||
|
||||
This system is simple, flexible, and doesn't hide any data - anything can still be passed or accessed directly from or between components.
|
||||
|
||||
### Definitions & Guides
|
||||
|
||||
See [Creating Components](/classic/forge/components/creating-components) to get started! Or you can explore the following topics in detail:
|
||||
|
||||
* [<Icon icon="puzzle-piece" iconType="solid"/> Component](../components/): a class that implements one or more _protocols_. It can be added to an agent to provide additional functionality. See what's already provided in [Built-in Components](/classic/forge/components/built-in-components).
|
||||
* [<Icon icon="gear" iconType="solid"/> Protocol](/classic/forge/components/protocols): an interface that defines a set of methods that a component must implement. Protocols are used to group related functionality.
|
||||
* [<Icon icon="screwdriver-wrench" iconType="solid"/> Command](/classic/forge/components/commands): enable _agent_ to interact with user and tools.
|
||||
* [<Icon icon="robot" iconType="solid"/> Agent](/classic/forge/components/agents): a class that is composed of components. It's responsible for executing pipelines and managing the components.
|
||||
* **Pipeline**: a sequence of method calls on components. Pipelines are used to execute a series of actions in a specific order. As of now there's no formal class for a pipeline, it's just a sequence of method calls on components. There are two default pipelines implemented in the default agent: `propose_action` and `execute`. See [<Icon icon="robot" iconType="solid"/> Agent](/classic/forge/components/agents) to learn more.
|
|
@ -1,6 +1,9 @@
|
|||
# ⚙️ Protocols
|
||||
---
|
||||
title: Protocols
|
||||
description: "Protocols are _interfaces_ implemented by [Components](../components/) used to group related functionality."
|
||||
---
|
||||
|
||||
Protocols are *interfaces* implemented by [Components](./components.md) used to group related functionality. Each protocol needs to be handled explicitly by the agent at some point of the execution. We provide a comprehensive list of built-in protocols that are already handled in the built-in `Agent`, so when you inherit from the base agent all built-in protocols will work!
|
||||
Each protocol needs to be handled explicitly by the agent at some point of the execution. We provide a comprehensive list of built-in protocols that are already handled in the built-in `Agent`, so when you inherit from the base agent all built-in protocols will work!
|
||||
|
||||
**Protocols are listed in the order of the default execution.**
|
||||
|
||||
|
@ -21,27 +24,23 @@ class DirectiveProvider(AgentComponent):
|
|||
return iter([])
|
||||
|
||||
def get_best_practices(self) -> Iterator[str]:
|
||||
return iter([])
|
||||
return iter([])`
|
||||
```
|
||||
|
||||
**Example** A web-search component can provide a resource information. Keep in mind that this actually doesn't allow the agent to access the internet. To do this a relevant `Command` needs to be provided.
|
||||
|
||||
```py
|
||||
class WebSearchComponent(DirectiveProvider):
|
||||
def get_resources(self) -> Iterator[str]:
|
||||
yield "Internet access for searches and information gathering."
|
||||
# We can skip "get_constraints" and "get_best_practices" if they aren't needed
|
||||
# We can skip "get_constraints" and "get_best_practices" if they aren't needed`
|
||||
```
|
||||
|
||||
### `CommandProvider`
|
||||
|
||||
Provides a command that can be executed by the agent.
|
||||
|
||||
```py
|
||||
class CommandProvider(AgentComponent):
|
||||
`class CommandProvider(AgentComponent):
|
||||
def get_commands(self) -> Iterator[Command]:
|
||||
...
|
||||
```
|
||||
...`
|
||||
|
||||
The easiest way to provide a command is to use `command` decorator on a component method and then yield the method. Each command needs a name, description and a parameter schema using `JSONSchema`. By default method name is used as a command name, and first part of docstring for the description (before `Args:` or `Returns:`) and schema can be provided in the decorator.
|
||||
|
||||
|
@ -52,7 +51,6 @@ from forge.agent import CommandProvider, Component
|
|||
from forge.command import command
|
||||
from forge.models.json_schema import JSONSchema
|
||||
|
||||
|
||||
class CalculatorComponent(CommandProvider):
|
||||
get_commands(self) -> Iterator[Command]:
|
||||
yield self.multiply
|
||||
|
@ -69,30 +67,27 @@ class CalculatorComponent(CommandProvider):
|
|||
required=True,
|
||||
)})
|
||||
def multiply(self, a: int, b: int) -> str:
|
||||
"""
|
||||
Multiplies two numbers.
|
||||
|
||||
Args:
|
||||
a: First number
|
||||
b: Second number
|
||||
"""
|
||||
Multiplies two numbers.
|
||||
|
||||
Returns:
|
||||
Result of multiplication
|
||||
"""
|
||||
return str(a * b)
|
||||
Args:
|
||||
a: First number
|
||||
b: Second number
|
||||
|
||||
Returns:
|
||||
Result of multiplication
|
||||
"""
|
||||
return str(a * b)`
|
||||
```
|
||||
|
||||
The agent will be able to call this command, named `multiply` with two arguments and will receive the result. The command description will be: `Multiplies two numbers.`
|
||||
|
||||
To learn more about commands see [🛠️ Commands](./commands.md).
|
||||
To learn more about commands see [<Icon icon="screwdriver-wrench" iconType="solid"/> Commands](/classic/forge/components/commands).
|
||||
|
||||
## Order-dependent protocols
|
||||
|
||||
The order of components implementing order-dependent protocols is important.
|
||||
Some components may depend on the results of components before them.
|
||||
The order of components implementing order-dependent protocols is important. Some components may depend on the results of components before them.
|
||||
|
||||
### `MessageProvider`
|
||||
|
||||
Yields messages that will be added to the agent's prompt. You can use either `ChatMessage.user()`: this will interpreted as a user-sent message or `ChatMessage.system()`: that will be more important.
|
||||
|
||||
```py
|
||||
|
@ -103,7 +98,7 @@ class MessageProvider(AgentComponent):
|
|||
|
||||
**Example** Component that provides a message to the agent's prompt.
|
||||
|
||||
```py
|
||||
```
|
||||
class HelloComponent(MessageProvider):
|
||||
def get_messages(self) -> Iterator[ChatMessage]:
|
||||
yield ChatMessage.user("Hello World!")
|
||||
|
@ -127,7 +122,7 @@ class LoggerComponent(AfterParse):
|
|||
logger.info(f"Response: {response}")
|
||||
```
|
||||
|
||||
### `ExecutionFailure`
|
||||
### `ExecutionFailure`
|
||||
|
||||
Protocol called when the execution of the command fails.
|
||||
|
|
@ -0,0 +1,39 @@
|
|||
---
|
||||
title: AutoGPT Forge
|
||||
---
|
||||
|
||||
## <Icon icon="screwdriver-wrench" iconType="solid" size="28"/> Build your own Agent <Icon icon="screwdriver-wrench" iconType="solid" size="28"/>
|
||||
Warning
|
||||
|
||||
<Warning>
|
||||
**warning**
|
||||
|
||||
If you are trying to use AutoGPT this is not the tutorial for you! You need to use [this one](/classic/setup/index)
|
||||
</Warning>
|
||||
|
||||
Forge is a ready-to-go template for _your_ agent application. All the boilerplate code is already handled, letting you channel all your creativity into the things that set _your_ agent apart.
|
||||
|
||||
### <Icon icon="screwdriver-wrench" iconType="solid" size="28"/> **Why AutoGPT Forge?
|
||||
|
||||
* <Icon icon ="snooze" iconType="solid"/> **No More Boilerplate!** \- Don't let the mundane tasks stop you. Fork and build without the headache of starting from scratch!
|
||||
* <Icon icon="brain" iconType="solid"/> **Brain-centric Development!** \- All the tools you need so you can spend 100% of your time on what matters - crafting the brain of your AI!
|
||||
* <Icon icon="screwdriver-wrench" iconType="solid"/> **Tooling ecosystem!** \- We work with the best in class tools to bring you the best experience possible!
|
||||
|
||||
|
||||
### <Icon icon="rocket" iconType="solid" size="28"/> **Get Started!**
|
||||
|
||||
The best way to get started is to fork or download the AutoGPT repository and look at the example agent in `classic/forge/agent/forge_agent.py`. This can work as a starting point for your own agent. Agents are built using _components_ which provide different functionality, see the [Component Introduction](../components/introduction/). You can find built-in components in `classic/forge/components/`.
|
||||
|
||||
<Warning>
|
||||
**Warning**
|
||||
|
||||
The tutorial series below is out of date.
|
||||
|
||||
</Warning>
|
||||
The getting started [tutorial series](https://aiedge.medium.com/autogpt-forge-e3de53cc58ec) will guide you through the process of setting up your project all the way through to building a generalist agent.
|
||||
|
||||
1. [AutoGPT Forge: A Comprehensive Guide to Your First Steps](https://aiedge.medium.com/autogpt-forge-a-comprehensive-guide-to-your-first-steps-a1dfdf46e3b4)
|
||||
2. [AutoGPT Forge: The Blueprint of an AI Agent](https://aiedge.medium.com/autogpt-forge-the-blueprint-of-an-ai-agent-75cd72ffde6)
|
||||
3. [AutoGPT Forge: Interacting with your Agent](https://aiedge.medium.com/autogpt-forge-interacting-with-your-agent-1214561b06b)
|
||||
4. [AutoGPT Forge: Crafting Intelligent Agent Logic](https://medium.com/@aiedge/autogpt-forge-crafting-intelligent-agent-logic-bc5197b14cb4)
|
||||
|
|
@ -0,0 +1,126 @@
|
|||
---
|
||||
title: AutoGPT Agent
|
||||
description: "AutoGPT was conceived when OpenAI published their GPT-4 model accompanied by a paper outlining the advanced reasoning and task-solving abilities of the model."
|
||||
sidebarTitle: Introduction
|
||||
---
|
||||
|
||||
<CardGroup cols={3}>
|
||||
<Card title="Setup" icon="wrench" href="/classic/setup/index" iconType="solid" horizontal/>
|
||||
<Card title="User guide" icon="laptop" href="/classic/usage" iconType="solid" horizontal/>
|
||||
<Card title="GitHub" icon="github" href="https://github.com/Significant-Gravitas/AutoGPT/tree/master/autogpt" iconType="solid" horizontal/>
|
||||
</CardGroup>
|
||||
|
||||
**Location:** `classic/original_autogpt/` in the GitHub repo
|
||||
|
||||
The concept was (and still is) fairly simple: let an LLM decide what to do over and over, while feeding the results of its actions back into the prompt. This allows the program to iteratively and incrementally work towards its objective.
|
||||
|
||||
The fact that this program is able to execute actions on behalf of its user makes it an **agent**. In the case of AutoGPT, the user still has to authorize every action, but as the project progresses we'll be able to give the agent more autonomy and only require consent for select actions.
|
||||
|
||||
AutoGPT is a **generalist agent**, meaning it is not designed with a specific task in mind. Instead, it is designed to be able to execute a wide range of tasks across many disciplines, as long as it can be done on a computer.
|
||||
|
||||
## Coming soon
|
||||
|
||||
* How does AutoGPT work?
|
||||
* What can I use AutoGPT for?
|
||||
* What does the future of AutoGPT look like?
|
||||
|
||||
## AutoGPT Classic Documentation
|
||||
|
||||
Welcome to the AutoGPT Classic Documentation.
|
||||
|
||||
The AutoGPT project consists of four main components:
|
||||
|
||||
* The [Agent](#agent) – also known as just "AutoGPT"
|
||||
* The [Benchmark](#benchmark) – AKA `agbenchmark`
|
||||
* The [Forge](#forge)
|
||||
* The [Frontend](#frontend)
|
||||
|
||||
To tie these together, we also have a [CLI](#cli) at the root of the project.
|
||||
|
||||
## <Icon icon="robot" iconType="solid" size="28"/> Agent
|
||||
<CardGroup cols={3}>
|
||||
<Card title="About AutoGPT" icon="book-open" href="#autogpt-agent" iconType="solid" horizontal/>
|
||||
<Card title="Setup" icon="wrench" href="/classic/setup/index" iconType="solid" horizontal/>
|
||||
<Card title="Usage" icon="laptop" href="/classic/usage" iconType="solid" horizontal/>
|
||||
</CardGroup>
|
||||
|
||||
The heart of AutoGPT, and the project that kicked it all off: a semi-autonomous agent powered by LLMs to execute any task for you*.
|
||||
|
||||
We continue to develop this project with the goal of providing access to AI assistance to the masses, and building the future transparently and together.
|
||||
|
||||
* <Icon icon="lightbulb" iconType="solid" /> **Explore** \- See what AI can do and be inspired by a glimpse of the future.
|
||||
|
||||
* <Icon icon="rocket" iconType="solid" /> **Build with us** \- We welcome any input, whether it's code or ideas for new features or improvements! Join us on [Discord](https://discord.gg/autogpt) and find out how you can join in on the action.
|
||||
|
||||
|
||||
\* it isn't quite there yet, but that is the ultimate goal that we are still pursuing
|
||||
|
||||
|
||||
## <Icon icon="bullseye" iconType="solid" size="28"/> Benchmark
|
||||
|
||||
**[<Icon icon="file" iconType="solid" /> Readme](https://github.com/Significant-Gravitas/AutoGPT/blob/master/classic/benchmark/README.md)**
|
||||
|
||||
Measure your agent's performance! The `agbenchmark` can be used with any agent that supports the agent protocol, and the integration with the project's [CLI](#cli) makes it even easier to use with AutoGPT and forge-based agents. The benchmark offers a stringent testing environment. Our framework allows for autonomous, objective performance evaluations, ensuring your agents are primed for real-world action.
|
||||
|
||||
* <Icon icon="box" iconType="solid" /> [**`agbenchmark`**](https://pypi.org/project/agbenchmark/) on Pypi
|
||||
|
||||
* <Icon icon="plug" iconType="solid" /> **Agent Protocol Standardization** \- AutoGPT uses the agent protocol from the AI Engineer Foundation to ensure compatibility with many agents, both from within and outside the project.
|
||||
|
||||
## <Icon icon="scale-unbalanced-flip" iconType="solid" size="28"/>Forge
|
||||
|
||||
<CardGroup cols={3}>
|
||||
<Card title="Introduction" icon="book-open" href="/classic/forge/getting-started/index" iconType="solid" horizontal/>
|
||||
<Card title="Quickstart" icon="rocket" href="https://github.com/Significant-Gravitas/AutoGPT/blob/master/QUICKSTART.md" iconType="solid" horizontal/>
|
||||
</CardGroup>
|
||||
|
||||
Forge your own agent! The Forge is a ready-to-go template for your agent application. All the boilerplate code is already handled, letting you channel all your creativity into the things that set _your_ agent apart.
|
||||
|
||||
* <Icon icon="screwdriver-wrench" iconType="solid" /> **Building with Ease** \- We've set the groundwork so you can focus on your agent's personality and capabilities. Comprehensive tutorials are available [here](https://aiedge.medium.com/autogpt-forge-e3de53cc58ec).
|
||||
|
||||
|
||||
## <Icon icon="laptop" iconType="solid" size="28"/> Frontend
|
||||
|
||||
**[<Icon icon="file" iconType="solid" /> Readme](https://github.com/Significant-Gravitas/AutoGPT/blob/master/classic/frontend/README.md)**
|
||||
|
||||
An easy-to-use and open source frontend for any Agent Protocol-compliant agent.
|
||||
|
||||
* <Icon icon="gamepad-modern" iconType="solid" />**User-Friendly Interface** \- Manage your agents effortlessly.
|
||||
|
||||
* <Icon icon="recycle" iconType="solid"/> **Seamless Integration** \- Smooth connectivity between your agent and our benchmarking system.
|
||||
|
||||
|
||||
## <Icon icon="wrench" iconType="solid" size="28"/> CLI
|
||||
|
||||
The project CLI makes it easy to use all of the components in the repo, separately or together. To install its dependencies, simply run `./run setup`, and you're ready to go!
|
||||
|
||||
```bash
|
||||
$ ./run
|
||||
Usage: cli.py [OPTIONS] COMMAND [ARGS]...
|
||||
|
||||
Options:
|
||||
--help Show this message and exit.
|
||||
|
||||
Commands:
|
||||
agent Commands to create, start and stop agents
|
||||
benchmark Commands to start the benchmark and list tests and categories
|
||||
setup Installs dependencies needed for your system.
|
||||
```
|
||||
Common commands:
|
||||
|
||||
* `./run agent start autogpt` – [runs](/classic/usage#serve-agent-protocol-mode-with-ui) the AutoGPT agent
|
||||
* `./run agent create <name>` – creates a new Forge-based agent project at `agents/<name>`
|
||||
* `./run benchmark start <agent>` – benchmarks the specified agent
|
||||
|
||||
* * *
|
||||
|
||||
Join the AutoGPT Discord server for any queries: [discord.gg/autogpt](https://discord.gg/autogpt)
|
||||
|
||||
### Glossary of Terms
|
||||
|
||||
* **Repository**: Space where your project resides.
|
||||
* **Forking**: Copying a repository under your account.
|
||||
* **Cloning**: Making a local copy of a repository.
|
||||
* **Agent**: The AutoGPT you'll create and develop.
|
||||
* **Benchmarking**: Testing your agent's skills in the Forge.
|
||||
* **Forge**: The template for building your AutoGPT agent.
|
||||
* **Frontend**: The UI for tasks, logs, and task history.
|
|
@ -0,0 +1,4 @@
|
|||
---
|
||||
title: Readme
|
||||
url: https://github.com/Significant-Gravitas/AutoGPT/blob/master/classic/frontend/README.md
|
||||
---
|
|
@ -0,0 +1,4 @@
|
|||
---
|
||||
title: Readme
|
||||
url: https://github.com/Significant-Gravitas/AutoGPT/blob/master/classic/benchmark/README.md
|
||||
---
|
|
@ -1,6 +1,12 @@
|
|||
# AutoGPT + Docker guide
|
||||
---
|
||||
title: "AutoGPT + Docker guide"
|
||||
sidebarTitle: Set up with Docker
|
||||
---
|
||||
|
||||
|
||||
<Note>
|
||||
**Important**
|
||||
|
||||
!!! important
|
||||
Docker Compose version 1.29.0 or later is required to use version 3.9 of the Compose file format.
|
||||
You can check the version of Docker Compose installed on your system by running the following command:
|
||||
|
||||
|
@ -11,7 +17,7 @@
|
|||
This will display the version of Docker Compose that is currently installed on your system.
|
||||
|
||||
If you need to upgrade Docker Compose to a newer version, you can follow the installation instructions in the Docker documentation: https://docs.docker.com/compose/install/
|
||||
|
||||
</Note>
|
||||
## Basic Setup
|
||||
|
||||
1. Make sure you have Docker installed, see [requirements](./index.md#requirements)
|
||||
|
@ -24,11 +30,7 @@
|
|||
|
||||
3. In the project directory, create a file called `docker-compose.yml`:
|
||||
|
||||
<details>
|
||||
<summary>
|
||||
<code>docker-compose.yml></code> for <= v0.4.7
|
||||
</summary>
|
||||
|
||||
<Accordion title="docker-compose.yml> for <= v0.4.7">
|
||||
```yaml
|
||||
version: "3.9"
|
||||
services:
|
||||
|
@ -48,14 +50,11 @@
|
|||
# source: ./azure.yaml
|
||||
# target: /app/azure.yaml
|
||||
```
|
||||
</details>
|
||||
|
||||
<details>
|
||||
<summary>
|
||||
<code>docker-compose.yml></code> for > v0.4.7 (including <code>master</code>)
|
||||
</summary>
|
||||
|
||||
```yaml
|
||||
</Accordion>
|
||||
<Accordion
|
||||
title="docker-compose.yml> for > v0.4.7 (including <code>master</code>)"
|
||||
>
|
||||
```yaml
|
||||
version: "3.9"
|
||||
services:
|
||||
auto-gpt:
|
||||
|
@ -76,8 +75,7 @@
|
|||
# source: ./config.json
|
||||
# target: /app/config.json
|
||||
```
|
||||
</details>
|
||||
|
||||
</Accordion>
|
||||
|
||||
1. Download [`.env.template`][.env.template] and save it as `.env` in the AutoGPT folder.
|
||||
2. Follow the standard [configuration instructions](./index.md#completing-the-setup),
|
||||
|
@ -89,20 +87,25 @@
|
|||
```
|
||||
4. _Optional: mount configuration file._
|
||||
If you have component configuration file, for example `config.json`, place it in `classic/original_autogpt/data/` directory. Or place it in `classic/original_autogpt/` and uncomment the line in `docker-compose.yml` that mounts it.
|
||||
To learn more about configuring, see [Component configuration](../../forge/components/components.md#json-configuration)
|
||||
To learn more about configuring, see [Component configuration](/classic/forge/components/components#json-configuration)
|
||||
|
||||
!!! note "Docker only supports headless browsing"
|
||||
AutoGPT uses a browser in headless mode by default: `HEADLESS_BROWSER=True`.
|
||||
Please do not change this setting in combination with Docker, or AutoGPT will crash.
|
||||
<Info>
|
||||
**Docker only supports headless browsing**
|
||||
|
||||
AutoGPT uses a browser in headless mode by default: `HEADLESS_BROWSER=True`.Please do not change this setting in combination with Docker, or AutoGPT will crash.
|
||||
|
||||
</Info>
|
||||
|
||||
[.env.template]: https://github.com/Significant-Gravitas/AutoGPT/tree/master/classic/original_autogpt/.env.template
|
||||
[Docker Hub]: https://hub.docker.com/r/significantgravitas/auto-gpt
|
||||
|
||||
## Developer Setup
|
||||
|
||||
!!! tip
|
||||
Use this setup if you have cloned the repository and have made (or want to make)
|
||||
changes to the codebase.
|
||||
<Tip>
|
||||
**Tip**
|
||||
|
||||
Use this setup if you have cloned the repository and have made (or want to make) changes to the codebase.
|
||||
</Tip>
|
||||
|
||||
1. Copy `.env.template` to `.env`.
|
||||
2. Follow the standard [configuration instructions](./index.md#completing-the-setup),
|
||||
|
@ -142,5 +145,3 @@ docker build -t autogpt .
|
|||
docker run -it --env-file=.env -v $PWD:/app autogpt
|
||||
docker run -it --env-file=.env -v $PWD:/app --rm autogpt --gpt3only --continuous
|
||||
```
|
||||
|
||||
[user guide]: ../usage.md/#command-line-interface
|
|
@ -0,0 +1,6 @@
|
|||
---
|
||||
title: For Developers
|
||||
---
|
||||
Coming soon...
|
||||
|
||||
TODO: - Running and developing AutoGPT with [VSCode + devcontainer](https://marketplace.visualstudio.com/items?itemName=ms-vscode-remote.remote-containers) - Resources - Prompt engineering guides - Related projects - Papers - Technical documentation
|
Before Width: | Height: | Size: 68 KiB After Width: | Height: | Size: 68 KiB |
|
@ -1,10 +1,13 @@
|
|||
# AutoGPT Agent setup
|
||||
---
|
||||
title: AutoGPT Agent setup
|
||||
---
|
||||
|
||||
[🐋 **Set up & Run with Docker**](./docker.md)
|
||||
 | 
|
||||
[👷🏼 **For Developers**](./for-developers.md)
|
||||
<CardGroup cols={2}>
|
||||
<Card title="Set up & Run with Docker" icon="docker" href="./docker.md" iconType="solid" horizontal/>
|
||||
<Card title="For Developers" icon="laptop" href="./for-developers.md" iconType="solid" horizontal/>
|
||||
</CardGroup>
|
||||
|
||||
## 📋 Requirements
|
||||
## <Icon icon="clipboard" iconType="solid" size="28"/> Requirements
|
||||
|
||||
### Linux / macOS
|
||||
|
||||
|
@ -19,9 +22,12 @@
|
|||
|
||||
### Windows
|
||||
|
||||
!!! attention
|
||||
We recommend setting up AutoGPT with WSL. Some things don't work exactly the same on
|
||||
Windows and we currently can't provide specialized instructions for all those cases.
|
||||
<Warning>
|
||||
**Attention**
|
||||
|
||||
We recommend setting up AutoGPT with WSL. Some things don't work exactly the same on
|
||||
Windows and we currently can't provide specialized instructions for all those cases.
|
||||
</Warning>
|
||||
|
||||
- Python 3.10 or later ([instructions](https://www.tutorialspoint.com/how-to-install-python-in-windows))
|
||||
- Poetry ([instructions](https://python-poetry.org/docs/#installation))
|
||||
|
@ -35,18 +41,25 @@
|
|||
Since we don't ship AutoGPT as a desktop application, you'll need to download the
|
||||
[project] from GitHub and give it a place on your computer.
|
||||
|
||||
![Screenshot of the dialog to clone or download the repo](get-repo-dialog.png)
|
||||
|
||||
<Frame>
|
||||
<img src="/classic/setup/get-repo-dialog.png"/>
|
||||
</Frame>
|
||||
- To get the latest bleeding edge version, use `master`.
|
||||
- If you're looking for more stability, check out the latest AutoGPT [release][releases].
|
||||
|
||||
[project]: https://github.com/Significant-Gravitas/AutoGPT
|
||||
[releases]: https://github.com/Significant-Gravitas/AutoGPT/releases
|
||||
|
||||
!!! note
|
||||
These instructions don't apply if you're looking to run AutoGPT as a docker image.
|
||||
Instead, check out the [Docker setup](./docker.md) guide.
|
||||
<CardGroup cols={2}>
|
||||
<Card title="project" icon="github" href="https://github.com/Significant-Gravitas/AutoGPT" iconType="solid" horizontal/>
|
||||
<Card title="releases" icon="laptop" href="https://github.com/Significant-Gravitas/AutoGPT/releases" iconType="solid" horizontal/>
|
||||
</CardGroup>
|
||||
|
||||
<Info>
|
||||
**NOTE**
|
||||
|
||||
These instructions don't apply if you're looking to run AutoGPT as a docker image.
|
||||
Instead, check out the [Docker setup](./docker.md) guide.
|
||||
|
||||
</Info>
|
||||
### Completing the Setup
|
||||
|
||||
Once you have cloned or downloaded the project, you can find the AutoGPT Agent in the
|
||||
|
@ -54,7 +67,7 @@ Once you have cloned or downloaded the project, you can find the AutoGPT Agent i
|
|||
Inside this folder you can configure the AutoGPT application with an `.env` file and (optionally) a JSON configuration file:
|
||||
|
||||
- `.env` for environment variables, which are mostly used for sensitive data like API keys
|
||||
- a JSON configuration file to customize certain features of AutoGPT's [Components](../../forge/components/introduction.md)
|
||||
- a JSON configuration file to customize certain features of AutoGPT's [Components](/classic/forge/components/introduction)
|
||||
|
||||
See the [Configuration](../configuration/options.md) reference for a list of available environment variables.
|
||||
|
||||
|
@ -71,22 +84,27 @@ See the [Configuration](../configuration/options.md) reference for a list of ava
|
|||
4. Set API keys for the LLM providers that you want to use: see [below](#setting-up-llm-providers).
|
||||
5. Enter any other API keys or tokens for services you would like to use.
|
||||
|
||||
!!! note
|
||||
To activate and adjust a setting, remove the `# ` prefix.
|
||||
<Info>
|
||||
**NOTE**
|
||||
|
||||
To activate and adjust a setting, remove the `# ` prefix.
|
||||
</Info>
|
||||
|
||||
6. Save and close the `.env` file.
|
||||
7. _Optional: run `poetry install` to install all required dependencies._ The
|
||||
application also checks for and installs any required dependencies when it starts.
|
||||
8. _Optional: configure the JSON file (e.g. `config.json`) with your desired settings._
|
||||
The application will use default settings if you don't provide a JSON configuration file.
|
||||
Learn how to [set up the JSON configuration file](../../forge/components/components.md#json-configuration)
|
||||
Learn how to [set up the JSON configuration file](/classic/forge/components/components#json-configuration)
|
||||
|
||||
You should now be able to explore the CLI (`./autogpt.sh --help`) and run the application.
|
||||
|
||||
See the [user guide](../usage.md) for further instructions.
|
||||
|
||||
[show hidden files/Windows]: https://support.microsoft.com/en-us/windows/view-hidden-files-and-folders-in-windows-97fbc472-c603-9d90-91d0-1166d1d9f4b5
|
||||
[show hidden files/macOS]: https://www.pcmag.com/how-to/how-to-access-your-macs-hidden-files
|
||||
<CardGroup cols={2}>
|
||||
<Card title="show hidden files/Windows" icon="windows" href="https://support.microsoft.com/en-us/windows/view-hidden-files-and-folders-in-windows-97fbc472-c603-9d90-91d0-1166d1d9f4b5" iconType="solid" horizontal/>
|
||||
<Card title="show hidden files/macOS" icon="apple" href="https://www.pcmag.com/how-to/how-to-access-your-macs-hidden-files" iconType="solid" horizontal/>
|
||||
</CardGroup>
|
||||
|
||||
## Setting up LLM providers
|
||||
|
||||
|
@ -101,10 +119,13 @@ If you don't know which to choose, you can safely go with OpenAI*.
|
|||
|
||||
### OpenAI
|
||||
|
||||
!!! attention
|
||||
To use AutoGPT with GPT-4 (recommended), you need to set up a paid OpenAI account
|
||||
<Info>
|
||||
**Attention**
|
||||
|
||||
To use AutoGPT with GPT-4 (recommended), you need to set up a paid OpenAI account
|
||||
with some money in it. Please refer to OpenAI for further instructions ([link][openai/help-gpt-4-access]).
|
||||
Free accounts are [limited][openai/api-limits] to GPT-3.5 with only 3 requests per minute.
|
||||
</Info>
|
||||
|
||||
1. Make sure you have a paid account with some credits set up: [Settings > Organization > Billing][openai/billing]
|
||||
1. Get your OpenAI API key from: [API keys][openai/api-keys]
|
||||
|
@ -115,31 +136,37 @@ If you don't know which to choose, you can safely go with OpenAI*.
|
|||
OPENAI_API_KEY=sk-proj-xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
|
||||
```
|
||||
|
||||
!!! info "Using a GPT Azure-instance"
|
||||
If you want to use GPT on an Azure instance, set `USE_AZURE` to `True` and
|
||||
make an Azure configuration file.
|
||||
<Info>
|
||||
**Using a GPT Azure-instance**
|
||||
|
||||
Rename `azure.yaml.template` to `azure.yaml` and provide the relevant
|
||||
`azure_api_base`, `azure_api_version` and deployment IDs for the models that you
|
||||
want to use.
|
||||
If you want to use GPT on an Azure instance, set `USE_AZURE` to `True` and
|
||||
make an Azure configuration file.
|
||||
|
||||
E.g. if you want to use `gpt-3.5-turbo` and `gpt-4-turbo`:
|
||||
Rename `azure.yaml.template` to `azure.yaml` and provide the relevant
|
||||
`azure_api_base`, `azure_api_version` and deployment IDs for the models that you
|
||||
want to use.
|
||||
|
||||
```yaml
|
||||
# Please specify all of these values as double-quoted strings
|
||||
# Replace string in angled brackets (<>) to your own deployment Name
|
||||
azure_model_map:
|
||||
gpt-3.5-turbo: "<gpt-35-turbo-deployment-id>"
|
||||
gpt-4-turbo: "<gpt-4-turbo-deployment-id>"
|
||||
...
|
||||
```
|
||||
E.g. if you want to use `gpt-3.5-turbo` and `gpt-4-turbo`:
|
||||
|
||||
Details can be found in the [openai/python-sdk/azure], and in the [Azure OpenAI docs] for the embedding model.
|
||||
If you're on Windows you may need to install an [MSVC library](https://learn.microsoft.com/en-us/cpp/windows/latest-supported-vc-redist?view=msvc-170).
|
||||
```yaml
|
||||
# Please specify all of these values as double-quoted strings
|
||||
# Replace string in angled brackets (<>) to your own deployment Name
|
||||
azure_model_map:
|
||||
gpt-3.5-turbo: "<gpt-35-turbo-deployment-id>"
|
||||
gpt-4-turbo: "<gpt-4-turbo-deployment-id>"
|
||||
...
|
||||
```
|
||||
|
||||
!!! important
|
||||
Keep an eye on your API costs on [the Usage page][openai/usage].
|
||||
Details can be found in the [openai/python-sdk/azure], and in the [Azure OpenAI docs] for the embedding model.
|
||||
If you're on Windows you may need to install an [MSVC library](https://learn.microsoft.com/en-us/cpp/windows/latest-supported-vc-redist?view=msvc-170).
|
||||
</Info>
|
||||
|
||||
<Note>
|
||||
**Important**
|
||||
|
||||
Keep an eye on your API costs on [the Usage page][openai/usage].
|
||||
|
||||
</Note>
|
||||
|
||||
[openai/api-keys]: https://platform.openai.com/account/api-keys
|
||||
[openai/billing]: https://platform.openai.com/account/billing/overview
|
||||
|
@ -166,21 +193,28 @@ If you don't know which to choose, you can safely go with OpenAI*.
|
|||
SMART_LLM=claude-3-opus-20240229
|
||||
```
|
||||
|
||||
!!! important
|
||||
Keep an eye on your API costs on [the Usage page][anthropic/usage].
|
||||
<Note>
|
||||
**Important**
|
||||
|
||||
Keep an eye on your API costs on [the Usage page][anthropic/usage].
|
||||
|
||||
[anthropic/api-keys]: https://console.anthropic.com/settings/keys
|
||||
[anthropic/billing]: https://console.anthropic.com/settings/plans
|
||||
[anthropic/usage]: https://console.anthropic.com/settings/usage
|
||||
[anthropic/models]: https://docs.anthropic.com/en/docs/models-overview
|
||||
|
||||
</Note>
|
||||
|
||||
### Groq
|
||||
|
||||
!!! note
|
||||
<Note>
|
||||
|
||||
**Note**
|
||||
|
||||
Although Groq is supported, its built-in function calling API isn't mature.
|
||||
Any features using this API may experience degraded performance.
|
||||
Let us know your experience!
|
||||
</Note>
|
||||
|
||||
1. Get your Groq API key from [Settings > API keys][groq/api-keys]
|
||||
2. Open `.env`
|
||||
|
@ -207,17 +241,19 @@ and guaranteed data privacy.
|
|||
|
||||
For more information and in-depth documentation, check out the [llamafile documentation].
|
||||
|
||||
!!! warning
|
||||
<Warning>
|
||||
**Warning**
|
||||
|
||||
At the moment, llamafile only serves one model at a time. This means you can not
|
||||
set `SMART_LLM` and `FAST_LLM` to two different llamafile models.
|
||||
|
||||
!!! warning
|
||||
</Warning>
|
||||
<Warning>
|
||||
**Warning**
|
||||
|
||||
Due to the issues linked below, llamafiles don't work on WSL. To use a llamafile
|
||||
with AutoGPT in WSL, you will have to run the llamafile in Windows (outside WSL).
|
||||
|
||||
<details>
|
||||
<summary>Instructions</summary>
|
||||
|
||||
<Accordion title="Instructions">
|
||||
1. Get the `llamafile/serve.py` script through one of these two ways:
|
||||
1. Clone the AutoGPT repo somewhere in your Windows environment,
|
||||
with the script located at `classic/original_autogpt/scripts/llamafile/serve.py`
|
||||
|
@ -232,18 +268,21 @@ For more information and in-depth documentation, check out the [llamafile docume
|
|||
6. Follow the rest of the regular instructions below.
|
||||
|
||||
[serve.py]: https://github.com/Significant-Gravitas/AutoGPT/blob/master/classic/original_autogpt/scripts/llamafile/serve.py
|
||||
</details>
|
||||
</Accordion>
|
||||
|
||||
* [Mozilla-Ocho/llamafile#356](https://github.com/Mozilla-Ocho/llamafile/issues/356)
|
||||
* [Mozilla-Ocho/llamafile#100](https://github.com/Mozilla-Ocho/llamafile/issues/100)
|
||||
</Warning>
|
||||
<Info>
|
||||
**Note**
|
||||
|
||||
!!! note
|
||||
These instructions will download and use `mistral-7b-instruct-v0.2.Q5_K_M.llamafile`.
|
||||
`mistral-7b-instruct-v0.2` is currently the only tested and supported model.
|
||||
If you want to try other models, you'll have to add them to `LlamafileModelName` in
|
||||
[`llamafile.py`][classic/forge/llamafile.py].
|
||||
For optimal results, you may also have to add some logic to adapt the message format,
|
||||
like `LlamafileProvider._adapt_chat_messages_for_mistral_instruct(..)` does.
|
||||
</Info>
|
||||
|
||||
1. Run the llamafile serve script:
|
||||
```shell
|
|
@ -1,6 +1,9 @@
|
|||
# Share your logs with us to help improve AutoGPT
|
||||
---
|
||||
title: Share your logs with us to help improve AutoGPT
|
||||
description: Do you notice weird behavior with your agent? Do you have an interesting use case? Do you have a bug you want to report?
|
||||
sidebarTitle: Share your logs with us
|
||||
---
|
||||
|
||||
Do you notice weird behavior with your agent? Do you have an interesting use case? Do you have a bug you want to report?
|
||||
Follow the steps below to enable your logs and upload them. You can include these logs when making an issue report or discussing an issue with us.
|
||||
|
||||
## Enable Debug Logs
|
||||
|
@ -20,14 +23,19 @@ docker compose run --rm auto-gpt --debug # in Docker
|
|||
## Inspect and share logs
|
||||
|
||||
You can inspect and share logs via [e2b](https://e2b.dev).
|
||||
![E2b logs dashboard](../imgs/e2b-dashboard.png)
|
||||
|
||||
<Frame>
|
||||
<img src="/images/e2b-dashboard.png"/>
|
||||
</Frame>
|
||||
|
||||
1. Go to [autogpt.e2b.dev](https://autogpt.e2b.dev) and sign in.
|
||||
2. You'll see logs from other members of the AutoGPT team that you can inspect.
|
||||
3. Or you upload your own logs. Click on the "Upload log folder" button and select the debug logs dir that you generated. Wait a 1-2 seconds and the page reloads.
|
||||
4. You can share logs via sharing the URL in your browser.
|
||||
![E2b log URL](../imgs/e2b-log-url.png)
|
||||
|
||||
<Frame>
|
||||
<img src="/images/e2b-log-url.png"/>
|
||||
</Frame>
|
||||
### Add tags to logs
|
||||
|
||||
You can add custom tags to logs for other members of your team. This is useful if you want to indicate that the agent is for example having issues with challenges.
|
||||
|
@ -44,10 +52,13 @@ You can name your tag any way you want.
|
|||
|
||||
1. Click on the "plus" button on the left from the logs folder name.
|
||||
|
||||
![E2b tag button](../imgs/e2b-tag-button.png)
|
||||
|
||||
<Frame>
|
||||
<img src="/images/e2b-tag-button.png"/>
|
||||
</Frame>
|
||||
1. Type the name of a new tag.
|
||||
|
||||
1. Select the severity.
|
||||
|
||||
![E2b new tag](../imgs/e2b-new-tag.png)
|
||||
<Frame>
|
||||
<img src="/images/e2b-new-tag.png"/>
|
||||
</Frame>
|
|
@ -1,4 +1,6 @@
|
|||
# Running tests
|
||||
---
|
||||
title: Running tests
|
||||
---
|
||||
|
||||
To run all tests, use the following command:
|
||||
|
|
@ -1,8 +1,13 @@
|
|||
# AutoGPT Agent User Guide
|
||||
---
|
||||
title: AutoGPT Agent User Guide
|
||||
sidebarTitle: Usage
|
||||
---
|
||||
|
||||
!!! note
|
||||
This guide assumes you are in the `autogpt` folder, where the AutoGPT Agent
|
||||
is located.
|
||||
<Info>
|
||||
Note
|
||||
|
||||
This guide assumes you are in the `autogpt` folder, where the AutoGPT Agent is located.
|
||||
</Info>
|
||||
|
||||
## Command Line Interface
|
||||
|
||||
|
@ -21,28 +26,31 @@ Commands:
|
|||
serve Starts an Agent Protocol compliant AutoGPT server, which creates...
|
||||
```
|
||||
|
||||
!!! important "For Windows users"
|
||||
On Windows, use `.\autogpt.bat` instead of `./autogpt.sh`.
|
||||
Everything else (subcommands, arguments) should work the same.
|
||||
<Note>
|
||||
**For Windows users**
|
||||
On Windows, use `.\autogpt.bat` instead of `./autogpt.sh`. Everything else (subcommands, arguments) should work the same.
|
||||
</Note>
|
||||
|
||||
!!! info "Usage with Docker"
|
||||
For use with Docker, replace the script in the examples with
|
||||
`docker compose run --rm auto-gpt`:
|
||||
<Info>
|
||||
**Usage with Docker**
|
||||
|
||||
```shell
|
||||
docker compose run --rm auto-gpt --ai-settings <filename>
|
||||
docker compose run --rm auto-gpt serve
|
||||
```
|
||||
For use with Docker, replace the script in the examples with
|
||||
`docker compose run --rm auto-gpt`:
|
||||
|
||||
```shell
|
||||
docker compose run --rm auto-gpt --ai-settings <filename>
|
||||
docker compose run --rm auto-gpt serve
|
||||
```
|
||||
|
||||
</Info>
|
||||
|
||||
### `run` – CLI mode
|
||||
|
||||
The `run` sub-command starts AutoGPT with the legacy CLI interface.
|
||||
|
||||
<details>
|
||||
<summary>
|
||||
<code>./autogpt.sh run --help</code>
|
||||
</summary>
|
||||
|
||||
<Accordion
|
||||
title="./autogpt.sh run --help"
|
||||
>
|
||||
```shell
|
||||
$ ./autogpt.sh run --help
|
||||
Usage: python -m autogpt run [OPTIONS]
|
||||
|
@ -81,17 +89,20 @@ Options:
|
|||
--component-config-file TEXT Path to the json configuration file.
|
||||
--help Show this message and exit.
|
||||
```
|
||||
</details>
|
||||
</Accordion>
|
||||
|
||||
This mode allows running a single agent, and saves the agent's state when terminated.
|
||||
This means you can *resume* agents at a later time. See also [agent state].
|
||||
|
||||
!!! note
|
||||
<Info>
|
||||
**Note**
|
||||
|
||||
For legacy reasons, the CLI will default to the `run` subcommand when none is
|
||||
specified: running `./autogpt.sh run [OPTIONS]` does the same as `./autogpt.sh [OPTIONS]`,
|
||||
but this may change in the future.
|
||||
</Info>
|
||||
|
||||
#### 💀 Continuous Mode ⚠️
|
||||
#### Continuous Mode
|
||||
|
||||
Run the AI **without** user authorization, 100% automated.
|
||||
Continuous mode is NOT recommended.
|
||||
|
@ -109,11 +120,9 @@ To exit the program, press ++ctrl+c++
|
|||
With `serve`, the application exposes an Agent Protocol compliant API and serves a
|
||||
frontend, by default on `http://localhost:8000`. You can configure the port it is served on with the `AP_SERVER_PORT` environment variable.
|
||||
|
||||
<details>
|
||||
<summary>
|
||||
<code>./autogpt.sh serve --help</code>
|
||||
</summary>
|
||||
|
||||
<Accordion
|
||||
title="./autogpt.sh serve --help"
|
||||
>
|
||||
```shell
|
||||
$ ./autogpt.sh serve --help
|
||||
Usage: python -m autogpt serve [OPTIONS]
|
||||
|
@ -129,20 +138,24 @@ Options:
|
|||
plugins.
|
||||
--help Show this message and exit.
|
||||
```
|
||||
</details>
|
||||
</Accordion>
|
||||
|
||||
For more information about the API of the application, see [agentprotocol.ai](https://agentprotocol.ai).
|
||||
|
||||
<!-- TODO: add guide/manual for frontend -->
|
||||
|
||||
### Arguments
|
||||
|
||||
!!! attention
|
||||
Most arguments are equivalent to configuration options. See [`.env.template`][.env.template]
|
||||
for all available configuration options.
|
||||
<Warning>
|
||||
**Attention**
|
||||
|
||||
!!! note
|
||||
Replace anything in angled brackets (<>) to a value you want to specify
|
||||
Most arguments are equivalent to configuration options. See [`.env.template`][.env.template] for all available configuration options.
|
||||
|
||||
</Warning>
|
||||
|
||||
<Info>
|
||||
**Note**
|
||||
|
||||
Replace anything in angled brackets (\<>) to a value you want to specify
|
||||
</Info>
|
||||
|
||||
Here are some common arguments you can use when running AutoGPT:
|
||||
|
||||
|
@ -158,10 +171,12 @@ Here are some common arguments you can use when running AutoGPT:
|
|||
./autogpt.sh --prompt-settings <filename>
|
||||
```
|
||||
|
||||
!!! note
|
||||
There are shorthands for some of these flags, for example `-P` for `--prompt-settings`.
|
||||
Use `./autogpt.sh --help` for more information.
|
||||
<Info>
|
||||
**Note**
|
||||
|
||||
There are shorthands for some of these flags, for example `-P` for `--prompt-settings`. Use `./autogpt.sh --help` for more information.
|
||||
|
||||
</Info>
|
||||
[.env.template]: https://github.com/Significant-Gravitas/AutoGPT/tree/master/classic/original_autogpt/.env.template
|
||||
|
||||
## Agent State
|
||||
|
@ -176,24 +191,27 @@ in various ways:
|
|||
* Share your agent!
|
||||
|
||||
## Workspace
|
||||
[workspace]: #workspace
|
||||
|
||||
Agents can read and write files. This happens in the `workspace` folder, which
|
||||
is in `data/agents/<agent_id>/`. Files outside of this folder can not be accessed by the
|
||||
agent *unless* `RESTRICT_TO_WORKSPACE` is set to `False`.
|
||||
|
||||
!!! warning
|
||||
We do not recommend disabling `RESTRICT_TO_WORKSPACE`, unless AutoGPT is running in
|
||||
a sandbox environment where it couldn't do any damage (e.g. Docker or a VM).
|
||||
<Warning>
|
||||
**Warning**
|
||||
|
||||
We do not recommend disabling `RESTRICT_TO_WORKSPACE`, unless AutoGPT is running in a sandbox environment where it couldn't do any damage (e.g. Docker or a VM).
|
||||
</Warning>
|
||||
|
||||
## Logs
|
||||
|
||||
Activity, Error, and Debug logs are located in `logs`.
|
||||
|
||||
!!! tip
|
||||
<Tip>
|
||||
**Tip**
|
||||
|
||||
Do you notice weird behavior with your agent? Do you have an interesting use case? Do you have a bug you want to report?
|
||||
Follow the step below to enable your logs. You can include these logs when making an issue report or discussing an issue with us.
|
||||
|
||||
</Tip>
|
||||
To print out debug logs:
|
||||
|
||||
```shell
|
||||
|
@ -212,6 +230,3 @@ For example, to disable python coding features, set it to the value below:
|
|||
```ini
|
||||
DISABLED_COMMANDS=execute_python_code,execute_python_file
|
||||
```
|
||||
|
||||
[components]: ../forge/components/components.md
|
||||
[commands]: ../forge/components/built-in-components.md
|
|
@ -1,11 +0,0 @@
|
|||
# Beat a Challenge
|
||||
|
||||
If you have a solution or idea to tackle an existing challenge, you can contribute by working on it and submitting your solution. Here's how to get started:
|
||||
|
||||
## Guidelines for Beating a Challenge
|
||||
|
||||
1. **Choose a challenge**: Browse the [List of Challenges](list.md) and choose one that interests you or aligns with your expertise.
|
||||
|
||||
2. **Understand the problem**: Make sure you thoroughly understand the problem at hand, its scope, and the desired outcome.
|
||||
|
||||
3. **Develop a solution**: Work on creating a solution for the challenge. This may/
|
|
@ -1,124 +0,0 @@
|
|||
# Creating Challenges for AutoGPT
|
||||
|
||||
🏹 We're on the hunt for talented Challenge Creators! 🎯
|
||||
|
||||
Join us in shaping the future of AutoGPT by designing challenges that test its limits. Your input will be invaluable in guiding our progress and ensuring that we're on the right track. We're seeking individuals with a diverse skill set, including:
|
||||
|
||||
🎨 UX Design: Your expertise will enhance the user experience for those attempting to conquer our challenges. With your help, we'll develop a dedicated section in our wiki, and potentially even launch a standalone website.
|
||||
|
||||
💻 Coding Skills: Proficiency in Python, pytest, and VCR (a library that records OpenAI calls and stores them) will be essential for creating engaging and robust challenges.
|
||||
|
||||
⚙️ DevOps Skills: Experience with CI pipelines in GitHub and possibly Google Cloud Platform will be instrumental in streamlining our operations.
|
||||
|
||||
Are you ready to play a pivotal role in AutoGPT's journey? Apply now to become a Challenge Creator by opening a PR! 🚀
|
||||
|
||||
|
||||
# Getting Started
|
||||
Clone the original AutoGPT repo and checkout to master branch
|
||||
|
||||
|
||||
The challenges are not written using a specific framework. They try to be very agnostic
|
||||
The challenges are acting like a user that wants something done:
|
||||
INPUT:
|
||||
- User desire
|
||||
- Files, other inputs
|
||||
|
||||
Output => Artifact (files, image, code, etc, etc...)
|
||||
|
||||
## Defining your Agent
|
||||
|
||||
Go to https://github.com/Significant-Gravitas/AutoGPT/blob/master/classic/original_autogpt/tests/integration/agent_factory.py
|
||||
|
||||
Create your agent fixture.
|
||||
|
||||
```python
|
||||
def kubernetes_agent(
|
||||
agent_test_config, workspace: Workspace
|
||||
):
|
||||
# Please choose the commands your agent will need to beat the challenges, the full list is available in the main.py
|
||||
# (we 're working on a better way to design this, for now you have to look at main.py)
|
||||
command_registry = CommandRegistry()
|
||||
command_registry.import_commands("autogpt.commands.file_operations")
|
||||
command_registry.import_commands("autogpt.app")
|
||||
|
||||
# Define all the settings of our challenged agent
|
||||
ai_profile = AIProfile(
|
||||
ai_name="Kubernetes",
|
||||
ai_role="an autonomous agent that specializes in creating Kubernetes deployment templates.",
|
||||
ai_goals=[
|
||||
"Write a simple kubernetes deployment file and save it as a kube.yaml.",
|
||||
],
|
||||
)
|
||||
ai_profile.command_registry = command_registry
|
||||
|
||||
system_prompt = ai_profile.construct_full_prompt()
|
||||
agent_test_config.set_continuous_mode(False)
|
||||
agent = Agent(
|
||||
command_registry=command_registry,
|
||||
config=ai_profile,
|
||||
next_action_count=0,
|
||||
triggering_prompt=DEFAULT_TRIGGERING_PROMPT,
|
||||
)
|
||||
|
||||
return agent
|
||||
```
|
||||
|
||||
## Creating your challenge
|
||||
Go to `tests/challenges`and create a file that is called `test_your_test_description.py` and add it to the appropriate folder. If no category exists you can create a new one.
|
||||
|
||||
Your test could look something like this
|
||||
|
||||
```python
|
||||
import contextlib
|
||||
from functools import wraps
|
||||
from typing import Generator
|
||||
|
||||
import pytest
|
||||
import yaml
|
||||
|
||||
from autogpt.commands.file_operations import read_file, write_to_file
|
||||
from tests.integration.agent_utils import run_interaction_loop
|
||||
from tests.challenges.utils import run_multiple_times
|
||||
|
||||
def input_generator(input_sequence: list) -> Generator[str, None, None]:
|
||||
"""
|
||||
Creates a generator that yields input strings from the given sequence.
|
||||
|
||||
:param input_sequence: A list of input strings.
|
||||
:return: A generator that yields input strings.
|
||||
"""
|
||||
yield from input_sequence
|
||||
|
||||
|
||||
@pytest.mark.skip("This challenge hasn't been beaten yet.")
|
||||
@pytest.mark.vcr
|
||||
@pytest.mark.requires_openai_api_key
|
||||
def test_information_retrieval_challenge_a(kubernetes_agent, monkeypatch) -> None:
|
||||
"""
|
||||
Test the challenge_a function in a given agent by mocking user inputs
|
||||
and checking the output file content.
|
||||
|
||||
:param get_company_revenue_agent: The agent to test.
|
||||
:param monkeypatch: pytest's monkeypatch utility for modifying builtins.
|
||||
"""
|
||||
input_sequence = ["s", "s", "s", "s", "s", "EXIT"]
|
||||
gen = input_generator(input_sequence)
|
||||
monkeypatch.setattr("autogpt.utils.session.prompt", lambda _: next(gen))
|
||||
|
||||
with contextlib.suppress(SystemExit):
|
||||
run_interaction_loop(kubernetes_agent, None)
|
||||
|
||||
# here we load the output file
|
||||
file_path = str(kubernetes_agent.workspace.get_path("kube.yaml"))
|
||||
content = read_file(file_path)
|
||||
|
||||
# then we check if it's including keywords from the kubernetes deployment config
|
||||
for word in ["apiVersion", "kind", "metadata", "spec"]:
|
||||
assert word in content, f"Expected the file to contain {word}"
|
||||
|
||||
content = yaml.safe_load(content)
|
||||
for word in ["Service", "Deployment", "Pod"]:
|
||||
assert word in content["kind"], f"Expected the file to contain {word}"
|
||||
|
||||
|
||||
```
|
|
@ -1,24 +0,0 @@
|
|||
# Challenge Title
|
||||
|
||||
## Description
|
||||
|
||||
Provide a clear and concise description of the challenge. Include any relevant examples or files to illustrate the problem.
|
||||
|
||||
## Input
|
||||
|
||||
If the challenge involves specific input files, describe them here. Provide the file names and their contents, if necessary. Use triple backticks (```) to format the content as a code block.
|
||||
|
||||
For example:
|
||||
|
||||
instructions_1.txt
|
||||
|
||||
The current task_id is 4563.\n[NOISE intended to confuse the agent]
|
||||
Read the file instructions_2.txt using the read_file command.
|
||||
|
||||
## Scope
|
||||
|
||||
Define the scope of the challenge, including any relevant constraints, requirements, or limitations.
|
||||
|
||||
## Success Evaluation
|
||||
|
||||
Explain how success will be measured or evaluated for the challenge. This helps others understand what the desired outcome is and how to work towards it.
|
|
@ -1,23 +0,0 @@
|
|||
# Information Retrieval Challenge A
|
||||
|
||||
**Status**: Current level to beat: level 2
|
||||
|
||||
**Command to try**:
|
||||
|
||||
```
|
||||
pytest -s tests/challenges/information_retrieval/test_information_retrieval_challenge_a.py --level=2
|
||||
```
|
||||
|
||||
## Description
|
||||
|
||||
The agent's goal is to find the revenue of Tesla:
|
||||
- level 1 asks the revenue of Tesla in 2022 and explicitly asks to search for 'tesla revenue 2022'
|
||||
- level 2 is identical but doesn't ask to search for 'tesla revenue 2022'
|
||||
- level 3 asks for tesla's revenue by year since its creation.
|
||||
|
||||
It should write the result in a file called output.txt.
|
||||
|
||||
The agent should be able to beat this test consistently (this is the hardest part).
|
||||
## Objective
|
||||
|
||||
The objective of this challenge is to test the agent's ability to retrieve information in a consistent way.
|
|
@ -1,22 +0,0 @@
|
|||
# Information Retrieval Challenge B
|
||||
|
||||
**Status**: Beaten
|
||||
|
||||
**Command to try**:
|
||||
|
||||
```
|
||||
pytest -s tests/challenges/information_retrieval/test_information_retrieval_challenge_b.py
|
||||
```
|
||||
|
||||
## Description
|
||||
|
||||
The agent's goal is to find the names, affiliated university, and discovery of the individuals who won the nobel prize for physics in 2010.
|
||||
|
||||
It should write the result in a file called 2010_nobel_prize_winners.txt.
|
||||
|
||||
The agent should be able to beat this test consistently (this is the hardest part).
|
||||
|
||||
## Objective
|
||||
|
||||
The objective of this challenge is to test the agent's ability to retrieve multiple pieces of related information in a consistent way.
|
||||
The agent should not use google to perform the task, because it should already know the answer. This why the task fails after 2 cycles (1 cycle to retrieve information, 1 cycle to write the file)
|
|
@ -1,3 +0,0 @@
|
|||
# Information Retrieval
|
||||
|
||||
Information retrieval challenges are designed to evaluate the proficiency of an AI agent, such as AutoGPT, in searching, extracting, and presenting relevant information from a vast array of sources. These challenges often encompass tasks such as interpreting user queries, browsing the web, and filtering through unstructured data.
|
|
@ -1,34 +0,0 @@
|
|||
# Introduction to Challenges
|
||||
|
||||
Welcome to the AutoGPT Challenges page! This is a space where we encourage community members to collaborate and contribute towards improving AutoGPT by identifying and solving challenges that AutoGPT is not yet able to achieve.
|
||||
|
||||
## What are challenges?
|
||||
|
||||
Challenges are tasks or problems that AutoGPT has difficulty solving or has not yet been able to accomplish. These may include improving specific functionalities, enhancing the model's understanding of specific domains, or even developing new features that the current version of AutoGPT lacks.
|
||||
|
||||
## Why are challenges important?
|
||||
|
||||
Addressing challenges helps us improve AutoGPT's performance, usability, and versatility. By working together to tackle these challenges, we can create a more powerful and efficient tool for everyone. It also allows the community to actively contribute to the project, making it a true open-source effort.
|
||||
|
||||
## How can you participate?
|
||||
|
||||
There are two main ways to get involved with challenges:
|
||||
|
||||
1. **Submit a Challenge**: If you have identified a task that AutoGPT struggles with, you can submit it as a challenge. This allows others to see the issue and collaborate on finding a solution.
|
||||
2. **Beat a Challenge**: If you have a solution or idea to tackle an existing challenge, you can contribute by working on the challenge and submitting your solution.
|
||||
|
||||
To learn more about submitting and beating challenges, please visit the [List of Challenges](list.md), [Submit a Challenge](submit.md), and [Beat a Challenge](beat.md) pages.
|
||||
|
||||
We look forward to your contributions and the exciting solutions that the community will develop together to make AutoGPT even better!
|
||||
|
||||
!!! warning
|
||||
|
||||
We're slowly transitioning to agbenchmark. agbenchmark is a simpler way to improve AutoGPT. Simply run:
|
||||
|
||||
```
|
||||
agbenchmark
|
||||
```
|
||||
|
||||
and beat as many challenges as possible.
|
||||
|
||||
For more agbenchmark options, look at the [readme](https://github.com/Significant-Gravitas/Auto-GPT-Benchmarks/tree/master/agbenchmark).
|
|
@ -1,5 +0,0 @@
|
|||
# List of Challenges
|
||||
|
||||
This page contains a curated list of challenges that AutoGPT currently faces. If you think you have a solution or idea to tackle any of these challenges, feel free to dive in and start working on them! New challenges can also be submitted by following the guidelines on the [Submit a Challenge](./submit.md) page.
|
||||
|
||||
Memory Challenges: [List of Challenges](memory/introduction.md)
|
|
@ -1,39 +0,0 @@
|
|||
# Memory Challenge A
|
||||
|
||||
**Status**: Challenge Completed
|
||||
|
||||
|
||||
## Description
|
||||
|
||||
The agent, Follow-Instructions-GPT, has the following goals:
|
||||
|
||||
- Use the command `read_file` to read the `instructions_1.txt` file.
|
||||
- Follow the instructions in the `instructions_1.txt` file.
|
||||
|
||||
The challenge involves a series of text files containing instructions. The agent must follow the instructions and keep track of the task ID as it progresses through the files.
|
||||
|
||||
## Files
|
||||
|
||||
- `instructions_1.txt`
|
||||
|
||||
The task_id is 1234
|
||||
Read the file instructions_1.txt
|
||||
|
||||
|
||||
|
||||
- `instructions_2.txt`
|
||||
|
||||
Read the file instructions_2.txt using the read_file command.
|
||||
|
||||
|
||||
...and so on.
|
||||
|
||||
- `instructions_n.txt`
|
||||
|
||||
Write the task_id into the file output.txt.
|
||||
|
||||
|
||||
## Objective
|
||||
|
||||
The objective of this challenge is to test the agent's ability to follow instructions and maintain memory of the task Id throughout the process. The agent successfully completed this challenge if it wrote the task id in a file.
|
||||
|
|
@ -1,44 +0,0 @@
|
|||
# Memory Challenge B
|
||||
|
||||
**Status**: Current level to beat: level 3
|
||||
|
||||
**Command to try**:
|
||||
|
||||
```shell
|
||||
pytest -s tests/challenges/memory/test_memory_challenge_b.py --level=3
|
||||
```
|
||||
|
||||
## Description
|
||||
|
||||
The agent, Follow-Instructions-GPT, has the following goals:
|
||||
|
||||
- Use the command `read_file` to read the `instructions_1.txt` file.
|
||||
- Follow the instructions in the `instructions_1.txt` file.
|
||||
|
||||
The challenge involves a series of text files containing instructions and task IDs. The agent must follow the instructions and keep track of the task IDs as it progresses through the files.
|
||||
|
||||
## Files
|
||||
|
||||
- `instructions_1.txt`
|
||||
|
||||
The current task_id is 4563.\n[NOISE intended to confuse the agent]
|
||||
Read the file instructions_2.txt using the read_file command.
|
||||
|
||||
|
||||
- `instructions_2.txt`
|
||||
|
||||
The current task_id is 6182.\n[NOISE intended to confuse the agent]
|
||||
Read the file instructions_3.txt using the read_file command.
|
||||
|
||||
|
||||
...and so on.
|
||||
|
||||
- `instructions_n.txt`
|
||||
|
||||
The current task_id is 8912.
|
||||
Write all the task_ids into the file output.txt. The file has not been created yet. After that, use the task_complete command.
|
||||
|
||||
|
||||
## Objective
|
||||
|
||||
The objective of this challenge is to test the agent's ability to follow instructions and maintain memory of the task IDs throughout the process. The agent successfully completed this challenge if it wrote the task ids in a file.
|
|
@ -1,61 +0,0 @@
|
|||
# Memory Challenge C
|
||||
|
||||
**Status**: Current level to beat: level 1
|
||||
|
||||
**Command to try**:
|
||||
|
||||
```shell
|
||||
pytest -s tests/challenges/memory/test_memory_challenge_c.py --level=2
|
||||
```
|
||||
|
||||
## Description
|
||||
|
||||
The agent, Follow-Instructions-GPT, has the following goals:
|
||||
|
||||
- Use the command `read_file` to read the `instructions_1.txt` file.
|
||||
- Follow the instructions in the `instructions_1.txt` file.
|
||||
|
||||
The challenge involves a series of text files containing instructions and silly phrases. The agent must follow the instructions and keep track of the task IDs as it progresses through the files.
|
||||
|
||||
## Files
|
||||
|
||||
- `instructions_1.txt`
|
||||
|
||||
The current phrase is
|
||||
|
||||
```
|
||||
The purple elephant danced on a rainbow while eating a taco.\n[NOISE intended to confuse the agent]
|
||||
```
|
||||
|
||||
Read the file `instructions_2.txt` using the read_file command.
|
||||
|
||||
|
||||
- `instructions_2.txt`
|
||||
|
||||
The current phrase is
|
||||
|
||||
```
|
||||
The sneaky toaster stole my socks and ran away to Hawaii.\n[NOISE intended to confuse the agent]
|
||||
```
|
||||
|
||||
Read the file instructions_3.txt using the read_file command.
|
||||
|
||||
|
||||
...and so on.
|
||||
|
||||
- `instructions_n.txt`
|
||||
|
||||
The current phrase is
|
||||
|
||||
```
|
||||
My pet rock sings better than Beyoncé on Tuesdays.
|
||||
```
|
||||
|
||||
Write all the phrases into the file output.txt. The file has not been created yet. After that, use the task_complete command.
|
||||
|
||||
|
||||
## Objective
|
||||
|
||||
The objective of this challenge is to test the agent's ability to follow instructions and maintain memory of the task IDs throughout the process. The agent successfully completed this challenge if it wrote the phrases in a file.
|
||||
|
||||
This is presumably harder than task ids as the phrases are longer and more likely to be compressed as the agent does more work.
|
|
@ -1,80 +0,0 @@
|
|||
# Memory Challenge D
|
||||
|
||||
**Status**: Current level to beat: level 1
|
||||
|
||||
**Command to try**:
|
||||
|
||||
```shell
|
||||
pytest -s tests/challenges/memory/test_memory_challenge_d.py --level=1
|
||||
```
|
||||
|
||||
## Description
|
||||
|
||||
The provided code is a unit test designed to validate an AI's ability to track events and beliefs of characters in a story involving moving objects, specifically marbles. This scenario is an advanced form of the classic "Sally-Anne test", a psychological test used to measure a child's social cognitive ability to understand that others' perspectives and beliefs may differ from their own.
|
||||
|
||||
Here is an explanation of the challenge:
|
||||
|
||||
The AI is given a series of events involving characters Sally, Anne, Bob, and Charlie, and the movements of different marbles. These events are designed as tests at increasing levels of complexity.
|
||||
|
||||
For each level, the AI is expected to keep track of the events and the resulting beliefs of each character about the locations of each marble. These beliefs are affected by whether the character was inside or outside the room when events occurred, as characters inside the room are aware of the actions, while characters outside the room aren't.
|
||||
|
||||
After the AI processes the events and generates the beliefs of each character, it writes these beliefs to an output file in JSON format.
|
||||
|
||||
The check_beliefs function then checks the AI's beliefs against the expected beliefs for that level. The expected beliefs are predefined and represent the correct interpretation of the events for each level.
|
||||
|
||||
If the AI's beliefs match the expected beliefs, it means the AI has correctly interpreted the events and the perspectives of each character. This would indicate that the AI has passed the test for that level.
|
||||
|
||||
The test runs for levels up to the maximum level that the AI has successfully beaten, or up to a user-selected level.
|
||||
|
||||
|
||||
## Files
|
||||
|
||||
- `instructions_1.txt`
|
||||
|
||||
```
|
||||
Sally has a marble (marble A) and she puts it in her basket (basket S), then leaves the room. Anne moves marble A from Sally's basket (basket S) to her own basket (basket A).
|
||||
```
|
||||
|
||||
|
||||
- `instructions_2.txt`
|
||||
|
||||
```
|
||||
Sally gives a new marble (marble B) to Bob who is outside with her. Bob goes into the room and places marble B into Anne's basket (basket A). Anne tells Bob to tell Sally that he lost the marble b. Bob leaves the room and speaks to Sally about the marble B. Meanwhile, after Bob left the room, Anne moves marble A into the green box, but tells Charlie to tell Sally that marble A is under the sofa. Charlie leaves the room and speak to Sally about the marble A as instructed by Anne.
|
||||
```
|
||||
|
||||
...and so on.
|
||||
|
||||
- `instructions_n.txt`
|
||||
|
||||
The expected believes of every characters are given in a list:
|
||||
|
||||
```json
|
||||
expected_beliefs = {
|
||||
1: {
|
||||
'Sally': {
|
||||
'marble A': 'basket S',
|
||||
},
|
||||
'Anne': {
|
||||
'marble A': 'basket A',
|
||||
}
|
||||
},
|
||||
2: {
|
||||
'Sally': {
|
||||
'marble A': 'sofa', # Because Charlie told her
|
||||
},
|
||||
'Anne': {
|
||||
'marble A': 'green box', # Because she moved it there
|
||||
'marble B': 'basket A', # Because Bob put it there and she was in the room
|
||||
},
|
||||
'Bob': {
|
||||
'B': 'basket A', # Last place he put it
|
||||
},
|
||||
'Charlie': {
|
||||
'A': 'sofa', # Because Anne told him to tell Sally so
|
||||
}
|
||||
},...
|
||||
```
|
||||
|
||||
## Objective
|
||||
|
||||
This test essentially checks if an AI can accurately model and track the beliefs of different characters based on their knowledge of events, which is a critical aspect of understanding and generating human-like narratives. This ability would be beneficial for tasks such as writing stories, dialogue systems, and more.
|
|
@ -1,5 +0,0 @@
|
|||
# Memory Challenges
|
||||
|
||||
Memory challenges are designed to test the ability of an AI agent, like AutoGPT, to remember and use information throughout a series of tasks. These challenges often involve following instructions, processing text files, and keeping track of important data.
|
||||
|
||||
The goal of memory challenges is to improve an agent's performance in tasks that require remembering and using information over time. By addressing these challenges, we can enhance AutoGPT's capabilities and make it more useful in real-world applications.
|
|
@ -1,14 +0,0 @@
|
|||
# Submit a Challenge
|
||||
|
||||
If you have identified a task or problem that AutoGPT struggles with, you can submit it as a challenge for the community to tackle. Here's how you can submit a new challenge:
|
||||
|
||||
## How to Submit a Challenge
|
||||
|
||||
1. Create a new `.md` file in the `challenges` directory in the AutoGPT GitHub repository. Make sure to pick the right category.
|
||||
2. Name the file with a descriptive title for the challenge, using hyphens instead of spaces (e.g., `improve-context-understanding.md`).
|
||||
3. In the file, follow the [challenge_template.md](challenge_template.md) to describe the problem, define the scope, and evaluate success.
|
||||
4. Commit the file and create a pull request.
|
||||
|
||||
Once submitted, the community can review and discuss the challenge. If deemed appropriate, it will be added to the [List of Challenges](list.md).
|
||||
|
||||
If you're looking to contribute by working on an existing challenge, check out [Beat a Challenge](beat.md) for guidelines on how to get started.
|
|
@ -1,144 +0,0 @@
|
|||
# AutoGPT Agent
|
||||
|
||||
[🔧 **Setup**](setup/index.md)
|
||||
 | 
|
||||
[💻 **User guide**](./usage.md)
|
||||
 | 
|
||||
[🐙 **GitHub**](https://github.com/Significant-Gravitas/AutoGPT/tree/master/autogpt)
|
||||
|
||||
**Location:** `classic/original_autogpt/` in the GitHub repo
|
||||
|
||||
**Maintance Notice:** AutoGPT Classic is not supported from a security perspective.
|
||||
Dependencies will not be updated, nor will issues be fixed. If someone wishes to
|
||||
contribute to novel development, we will give best effort merging to the changes that
|
||||
pass the existing CI.
|
||||
|
||||
AutoGPT Classic was conceived when OpenAI published their GPT-4 model accompanied by a paper
|
||||
outlining the advanced reasoning and task-solving abilities of the model. The concept
|
||||
was (and still is) fairly simple: let an LLM decide what to do over and over, while
|
||||
feeding the results of its actions back into the prompt. This allows the program to
|
||||
iteratively and incrementally work towards its objective.
|
||||
|
||||
The fact that this program is able to execute actions on behalf of its user makes
|
||||
it an **agent**. In the case of AutoGPT Classic, the user still has to authorize every action,
|
||||
but as the project progresses we'll be able to give the agent more autonomy and only
|
||||
require consent for select actions.
|
||||
|
||||
AutoGPT Classic is a **generalist agent**, meaning it is not designed with a specific task in
|
||||
mind. Instead, it is designed to be able to execute a wide range of tasks across many
|
||||
disciplines, as long as it can be done on a computer.
|
||||
|
||||
# AutoGPT Classic Documentation
|
||||
|
||||
Welcome to the AutoGPT Classic Documentation.
|
||||
|
||||
The AutoGPT Classic project consists of four main components:
|
||||
|
||||
- The [Agent](#agent) – also known as just "AutoGPT Classic"
|
||||
- The [Benchmark](#benchmark) – AKA `agbenchmark`
|
||||
- The [Forge](#forge)
|
||||
- The [Frontend](#frontend)
|
||||
|
||||
To tie these together, we also have a [CLI] at the root of the project.
|
||||
|
||||
## 🤖 Agent
|
||||
|
||||
**[📖 About AutoGPT Classic](#autogpt-agent)**
|
||||
 | 
|
||||
**[🔧 Setup](setup/index.md)**
|
||||
 | 
|
||||
**[💻 Usage](./usage.md)**
|
||||
|
||||
The former heart of AutoGPT, and the project that kicked it all off: a semi-autonomous agent powered by LLMs to execute any task for you*.
|
||||
|
||||
We continue to develop this project with the goal of providing access to AI assistance to the masses, and building the future transparently and together.
|
||||
|
||||
- 💡 **Explore** - See what AI can do and be inspired by a glimpse of the future.
|
||||
|
||||
- 🚀 **Build with us** - We welcome any input, whether it's code or ideas for new features or improvements! Join us on [Discord](https://discord.gg/autogpt) and find out how you can join in on the action.
|
||||
|
||||
If you'd like to see what's next, check out the [AutoGPT Platform](../index.md).
|
||||
|
||||
<small>* it isn't quite there yet, but that is the ultimate goal that we are still pursuing</small>
|
||||
|
||||
---
|
||||
|
||||
## 🎯 Benchmark
|
||||
|
||||
**[🗒️ Readme](https://github.com/Significant-Gravitas/AutoGPT/blob/master/classic/benchmark/README.md)**
|
||||
|
||||
Measure your agent's performance! The `agbenchmark` can be used with any agent that supports the agent protocol, and the integration with the project's [CLI] makes it even easier to use with AutoGPT Classic and forge-based agents. The benchmark offers a stringent testing environment. Our framework allows for autonomous, objective performance evaluations, ensuring your agents are primed for real-world action.
|
||||
|
||||
<!-- TODO: insert visual demonstrating the benchmark -->
|
||||
|
||||
- 📦 [**`agbenchmark`**](https://pypi.org/project/agbenchmark/) on Pypi
|
||||
|
||||
- 🔌 **Agent Protocol Standardization** - AutoGPT Classic uses the agent protocol from the AI Engineer Foundation to ensure compatibility with many agents, both from within and outside the project.
|
||||
|
||||
---
|
||||
|
||||
## 🏗️ Forge
|
||||
|
||||
**[📖 Introduction](../forge/get-started.md)**
|
||||
 | 
|
||||
**[🚀 Quickstart](https://github.com/Significant-Gravitas/AutoGPT/blob/master/QUICKSTART.md)**
|
||||
|
||||
<!-- TODO: have the guides all in one place -->
|
||||
|
||||
Forge your own agent! The Forge is a ready-to-go template for your agent application. All the boilerplate code is already handled, letting you channel all your creativity into the things that set *your* agent apart.
|
||||
|
||||
- 🛠️ **Building with Ease** - We've set the groundwork so you can focus on your agent's personality and capabilities. Comprehensive tutorials are available [here](https://aiedge.medium.com/autogpt-forge-e3de53cc58ec).
|
||||
|
||||
---
|
||||
|
||||
## 💻 Frontend
|
||||
|
||||
**[🗒️ Readme](https://github.com/Significant-Gravitas/AutoGPT/blob/master/classic/frontend/README.md)**
|
||||
|
||||
An easy-to-use and open source frontend for any Agent Protocol-compliant agent.
|
||||
|
||||
- 🎮 **User-Friendly Interface** - Manage your agents effortlessly.
|
||||
|
||||
- 🔄 **Seamless Integration** - Smooth connectivity between your agent and our benchmarking system.
|
||||
|
||||
---
|
||||
|
||||
## 🔧 CLI
|
||||
[CLI]: #cli
|
||||
|
||||
The project CLI makes it easy to use all of the components of AutoGPT Classic in the repo, separately or
|
||||
together. To install its dependencies, simply run `./run setup`, and you're ready to go!
|
||||
|
||||
```shell
|
||||
$ ./run
|
||||
Usage: cli.py [OPTIONS] COMMAND [ARGS]...
|
||||
|
||||
Options:
|
||||
--help Show this message and exit.
|
||||
|
||||
Commands:
|
||||
agent Commands to create, start and stop agents
|
||||
benchmark Commands to start the benchmark and list tests and categories
|
||||
setup Installs dependencies needed for your system.
|
||||
```
|
||||
|
||||
Common commands:
|
||||
|
||||
* `./run agent start autogpt` – [runs](./usage.md#serve-agent-protocol-mode-with-ui) the AutoGPT Classic agent
|
||||
* `./run agent create <name>` – creates a new Forge-based agent project at `agents/<name>`
|
||||
* `./run benchmark start <agent>` – benchmarks the specified agent
|
||||
|
||||
---
|
||||
|
||||
🤔 Join the AutoGPT Discord server for any queries:
|
||||
[discord.gg/autogpt](https://discord.gg/autogpt)
|
||||
|
||||
### Glossary of Terms
|
||||
|
||||
- **Repository**: Space where your project resides.
|
||||
- **Forking**: Copying a repository under your account.
|
||||
- **Cloning**: Making a local copy of a repository.
|
||||
- **Agent**: The AutoGPT you'll create and develop.
|
||||
- **Benchmarking**: Testing your agent's skills in the Forge.
|
||||
- **Forge**: The template for building your AutoGPT agent.
|
||||
- **Frontend**: The UI for tasks, logs, and task history.
|
|
@ -1,9 +0,0 @@
|
|||
Coming soon...
|
||||
|
||||
TODO:
|
||||
- Running and developing AutoGPT with [VSCode + devcontainer](https://marketplace.visualstudio.com/items?itemName=ms-vscode-remote.remote-containers)
|
||||
- Resources
|
||||
- Prompt engineering guides
|
||||
- Related projects
|
||||
- Papers
|
||||
- Technical documentation
|
|
@ -1 +0,0 @@
|
|||
../../CODE_OF_CONDUCT.md
|
|
@ -1,48 +0,0 @@
|
|||
# Contributing to the Docs
|
||||
|
||||
We welcome contributions to our documentation! If you would like to contribute, please follow the steps below.
|
||||
|
||||
## Setting up the Docs
|
||||
|
||||
1. Clone the repository:
|
||||
|
||||
```shell
|
||||
git clone github.com/Significant-Gravitas/AutoGPT.git
|
||||
```
|
||||
|
||||
1. Install the dependencies:
|
||||
|
||||
```shell
|
||||
python -m pip install -r docs/requirements.txt
|
||||
```
|
||||
|
||||
or
|
||||
|
||||
```shell
|
||||
python3 -m pip install -r docs/requirements.txt
|
||||
```
|
||||
|
||||
1. Start iterating using mkdocs' live server:
|
||||
|
||||
```shell
|
||||
mkdocs serve
|
||||
```
|
||||
|
||||
1. Open your browser and navigate to `http://127.0.0.1:8000`.
|
||||
|
||||
1. The server will automatically reload the docs when you save your changes.
|
||||
|
||||
## Adding a new page
|
||||
|
||||
1. Create a new markdown file in the `docs/content` directory.
|
||||
1. Add the new page to the `nav` section in the `mkdocs.yml` file.
|
||||
1. Add the content to the new markdown file.
|
||||
1. Run `mkdocs serve` to see your changes.
|
||||
|
||||
## Checking links
|
||||
|
||||
To check for broken links in the documentation, run `mkdocs build` and look for warnings in the console output.
|
||||
|
||||
## Submitting a Pull Request
|
||||
|
||||
When you're ready to submit your changes, please create a pull request. We will review your changes and merge them if they are appropriate.
|
|
@ -1 +0,0 @@
|
|||
../../CONTRIBUTING.md
|
|
@ -1 +0,0 @@
|
|||
../../../../classic/original_autogpt/autogpt/agents/README.md
|
|
@ -1,219 +0,0 @@
|
|||
# Built-in Components
|
||||
|
||||
This page lists all [🧩 Components](./components.md) and [⚙️ Protocols](./protocols.md) they implement that are natively provided. They are used by the AutoGPT agent.
|
||||
Some components have additional configuration options listed in the table, see [Component configuration](./components.md/#component-configuration) to learn more.
|
||||
|
||||
!!! note
|
||||
If a configuration field uses environment variable, it still can be passed using configuration model. ### Value from the configuration takes precedence over env var! Env var will be only applied if value in the configuration is not set.
|
||||
|
||||
## `SystemComponent`
|
||||
|
||||
Essential component to allow an agent to finish.
|
||||
|
||||
### DirectiveProvider
|
||||
|
||||
- Constraints about API budget
|
||||
|
||||
### MessageProvider
|
||||
|
||||
- Current time and date
|
||||
- Remaining API budget and warnings if budget is low
|
||||
|
||||
### CommandProvider
|
||||
|
||||
- `finish` used when task is completed
|
||||
|
||||
## `UserInteractionComponent`
|
||||
|
||||
Adds ability to interact with user in CLI.
|
||||
|
||||
### CommandProvider
|
||||
|
||||
- `ask_user` used to ask user for input
|
||||
|
||||
## `FileManagerComponent`
|
||||
|
||||
Adds ability to read and write persistent files to local storage, Google Cloud Storage or Amazon's S3.
|
||||
Necessary for saving and loading agent's state (preserving session).
|
||||
|
||||
### `FileManagerConfiguration`
|
||||
|
||||
| Config variable | Details | Type | Default |
|
||||
| ---------------- | -------------------------------------- | ----- | ---------------------------------- |
|
||||
| `storage_path` | Path to agent files, e.g. state | `str` | `agents/{agent_id}/`[^1] |
|
||||
| `workspace_path` | Path to files that agent has access to | `str` | `agents/{agent_id}/workspace/`[^1] |
|
||||
|
||||
[^1] This option is set dynamically during component construction as opposed to by default inside the configuration model, `{agent_id}` is replaced with the agent's unique identifier.
|
||||
|
||||
### DirectiveProvider
|
||||
|
||||
- Resource information that it's possible to read and write files
|
||||
|
||||
### CommandProvider
|
||||
|
||||
- `read_file` used to read file
|
||||
- `write_file` used to write file
|
||||
- `list_folder` lists all files in a folder
|
||||
|
||||
## `CodeExecutorComponent`
|
||||
|
||||
Lets the agent execute non-interactive Shell commands and Python code. Python execution works only if Docker is available.
|
||||
|
||||
### `CodeExecutorConfiguration`
|
||||
|
||||
| Config variable | Details | Type | Default |
|
||||
| ------------------------ | ---------------------------------------------------- | --------------------------- | ----------------- |
|
||||
| `execute_local_commands` | Enable shell command execution | `bool` | `False` |
|
||||
| `shell_command_control` | Controls which list is used | `"allowlist" \| "denylist"` | `"allowlist"` |
|
||||
| `shell_allowlist` | List of allowed shell commands | `List[str]` | `[]` |
|
||||
| `shell_denylist` | List of prohibited shell commands | `List[str]` | `[]` |
|
||||
| `docker_container_name` | Name of the Docker container used for code execution | `str` | `"agent_sandbox"` |
|
||||
|
||||
All shell command configurations are expected to be for convience only. This component is not secure and should not be used in production environments. It is recommended to use more appropriate sandboxing.
|
||||
|
||||
### CommandProvider
|
||||
|
||||
- `execute_shell` execute shell command
|
||||
- `execute_shell_popen` execute shell command with popen
|
||||
- `execute_python_code` execute Python code
|
||||
- `execute_python_file` execute Python file
|
||||
|
||||
## `ActionHistoryComponent`
|
||||
|
||||
Keeps track of agent's actions and their outcomes. Provides their summary to the prompt.
|
||||
|
||||
### `ActionHistoryConfiguration`
|
||||
|
||||
| Config variable | Details | Type | Default |
|
||||
| ---------------------- | ------------------------------------------------------- | ----------- | ------------------ |
|
||||
| `llm_name` | Name of the llm model used to compress the history | `ModelName` | `"gpt-3.5-turbo"` |
|
||||
| `max_tokens` | Maximum number of tokens to use for the history summary | `int` | `1024` |
|
||||
| `spacy_language_model` | Language model used for summary chunking using spacy | `str` | `"en_core_web_sm"` |
|
||||
| `full_message_count` | Number of cycles to include unsummarized in the prompt | `int` | `4` |
|
||||
|
||||
### MessageProvider
|
||||
|
||||
- Agent's progress summary
|
||||
|
||||
### AfterParse
|
||||
|
||||
- Register agent's action
|
||||
|
||||
### ExecutionFailure
|
||||
|
||||
- Rewinds the agent's action, so it isn't saved
|
||||
|
||||
### AfterExecute
|
||||
|
||||
- Saves the agent's action result in the history
|
||||
|
||||
## `GitOperationsComponent`
|
||||
|
||||
Adds ability to iteract with git repositories and GitHub.
|
||||
|
||||
### `GitOperationsConfiguration`
|
||||
|
||||
| Config variable | Details | Type | Default |
|
||||
| ----------------- | ----------------------------------------- | ----- | ------- |
|
||||
| `github_username` | GitHub username, *ENV:* `GITHUB_USERNAME` | `str` | `None` |
|
||||
| `github_api_key` | GitHub API key, *ENV:* `GITHUB_API_KEY` | `str` | `None` |
|
||||
|
||||
### CommandProvider
|
||||
|
||||
- `clone_repository` used to clone a git repository
|
||||
|
||||
## `ImageGeneratorComponent`
|
||||
|
||||
Adds ability to generate images using various providers.
|
||||
|
||||
### Hugging Face
|
||||
|
||||
To use text-to-image models from Hugging Face, you need a Hugging Face API token.
|
||||
Link to the appropriate settings page: [Hugging Face > Settings > Tokens](https://huggingface.co/settings/tokens)
|
||||
|
||||
### Stable Diffusion WebUI
|
||||
|
||||
It is possible to use your own self-hosted Stable Diffusion WebUI with AutoGPT. ### Make sure you are running WebUI with `--api` enabled.
|
||||
|
||||
### `ImageGeneratorConfiguration`
|
||||
|
||||
| Config variable | Details | Type | Default |
|
||||
| ------------------------- | ------------------------------------------------------------- | --------------------------------------- | --------------------------------- |
|
||||
| `image_provider` | Image generation provider | `"dalle" \| "huggingface" \| "sdwebui"` | `"dalle"` |
|
||||
| `huggingface_image_model` | Hugging Face image model, see [available models] | `str` | `"CompVis/stable-diffusion-v1-4"` |
|
||||
| `huggingface_api_token` | Hugging Face API token, *ENV:* `HUGGINGFACE_API_TOKEN` | `str` | `None` |
|
||||
| `sd_webui_url` | URL to self-hosted Stable Diffusion WebUI | `str` | `"http://localhost:7860"` |
|
||||
| `sd_webui_auth` | Basic auth for Stable Diffusion WebUI, *ENV:* `SD_WEBUI_AUTH` | `str` of format `{username}:{password}` | `None` |
|
||||
|
||||
[available models]: https://huggingface.co/models?pipeline_tag=text-to-image
|
||||
|
||||
### CommandProvider
|
||||
|
||||
- `generate_image` used to generate an image given a prompt
|
||||
|
||||
## `WebSearchComponent`
|
||||
|
||||
Allows agent to search the web. Google credentials aren't required for DuckDuckGo. [Instructions how to set up Google API key](../../classic/configuration/search.md)
|
||||
|
||||
### `WebSearchConfiguration`
|
||||
|
||||
| Config variable | Details | Type | Default |
|
||||
| -------------------------------- | ----------------------------------------------------------------------- | --------------------------- | ------- |
|
||||
| `google_api_key` | Google API key, *ENV:* `GOOGLE_API_KEY` | `str` | `None` |
|
||||
| `google_custom_search_engine_id` | Google Custom Search Engine ID, *ENV:* `GOOGLE_CUSTOM_SEARCH_ENGINE_ID` | `str` | `None` |
|
||||
| `duckduckgo_max_attempts` | Maximum number of attempts to search using DuckDuckGo | `int` | `3` |
|
||||
| `duckduckgo_backend` | Backend to be used for DDG sdk | `"api" \| "html" \| "lite"` | `"api"` |
|
||||
|
||||
### DirectiveProvider
|
||||
|
||||
- Resource information that it's possible to search the web
|
||||
|
||||
### CommandProvider
|
||||
|
||||
- `search_web` used to search the web using DuckDuckGo
|
||||
- `google` used to search the web using Google, requires API key
|
||||
|
||||
## `WebSeleniumComponent`
|
||||
|
||||
Allows agent to read websites using Selenium.
|
||||
|
||||
### `WebSeleniumConfiguration`
|
||||
|
||||
| Config variable | Details | Type | Default |
|
||||
| ----------------------------- | ------------------------------------------- | --------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------- |
|
||||
| `llm_name` | Name of the llm model used to read websites | `ModelName` | `"gpt-3.5-turbo"` |
|
||||
| `web_browser` | Web browser used by Selenium | `"chrome" \| "firefox" \| "safari" \| "edge"` | `"chrome"` |
|
||||
| `headless` | Run browser in headless mode | `bool` | `True` |
|
||||
| `user_agent` | User agent used by the browser | `str` | `"Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_4) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/83.0.4103.97 Safari/537.36"` |
|
||||
| `browse_spacy_language_model` | Spacy language model used for chunking text | `str` | `"en_core_web_sm"` |
|
||||
| `selenium_proxy` | Http proxy to use with Selenium | `str` | `None` |
|
||||
|
||||
### DirectiveProvider
|
||||
|
||||
- Resource information that it's possible to read websites
|
||||
|
||||
### CommandProvider
|
||||
|
||||
- `read_website` used to read a specific url and look for specific topics or answer a question
|
||||
|
||||
## `ContextComponent`
|
||||
|
||||
Adds ability to keep up-to-date file and folder content in the prompt.
|
||||
|
||||
### MessageProvider
|
||||
|
||||
- Content of elements in the context
|
||||
|
||||
### CommandProvider
|
||||
|
||||
- `open_file` used to open a file into context
|
||||
- `open_folder` used to open a folder into context
|
||||
- `close_context_item` remove an item from the context
|
||||
|
||||
## `WatchdogComponent`
|
||||
|
||||
Watches if agent is looping and switches to smart mode if necessary.
|
||||
|
||||
### AfterParse
|
||||
|
||||
- Investigates what happened and switches to smart mode if necessary
|
|
@ -1 +0,0 @@
|
|||
../../../../classic/forge/forge/components/README.md
|
|
@ -1,23 +0,0 @@
|
|||
# Component Agents
|
||||
|
||||
!!! important
|
||||
[Legacy plugins] no longer work with AutoGPT. They have been replaced by components,
|
||||
although we're still working on a new system to load plug-in components.
|
||||
|
||||
[Legacy plugins]: https://github.com/Significant-Gravitas/Auto-GPT-Plugins
|
||||
|
||||
This guide explains the component-based architecture of AutoGPT agents. It's a new way of building agents that is more flexible and easier to extend. Components replace some agent's logic and plugins with a more modular and composable system.
|
||||
|
||||
Agent is composed of *components*, and each *component* implements a range of *protocols* (interfaces), each one providing a specific functionality, e.g. additional commands or messages. Each *protocol* is handled in a specific order, defined by the agent. This allows for a clear separation of concerns and a more modular design.
|
||||
|
||||
This system is simple, flexible, and doesn't hide any data - anything can still be passed or accessed directly from or between components.
|
||||
|
||||
### Definitions & Guides
|
||||
|
||||
See [Creating Components](./creating-components.md) to get started! Or you can explore the following topics in detail:
|
||||
|
||||
- [🧩 Component](./components.md): a class that implements one or more *protocols*. It can be added to an agent to provide additional functionality. See what's already provided in [Built-in Components](./built-in-components.md).
|
||||
- [⚙️ Protocol](./protocols.md): an interface that defines a set of methods that a component must implement. Protocols are used to group related functionality.
|
||||
- [🛠️ Command](./commands.md): enable *agent* to interact with user and tools.
|
||||
- [🤖 Agent](./agents.md): a class that is composed of components. It's responsible for executing pipelines and managing the components.
|
||||
- **Pipeline**: a sequence of method calls on components. Pipelines are used to execute a series of actions in a specific order. As of now there's no formal class for a pipeline, it's just a sequence of method calls on components. There are two default pipelines implemented in the default agent: `propose_action` and `execute`. See [🤖 Agent](./agents.md) to learn more.
|
|
@ -1,34 +0,0 @@
|
|||
# AutoGPT Forge
|
||||
|
||||
## 🛠️ Build your own Agent 🛠️
|
||||
|
||||
!!! warning
|
||||
If you are trying to use AutoGPT this is not the tutorial for you! You need to use [this one](../classic/setup/index.md)
|
||||
|
||||
Forge is a ready-to-go template for *your* agent application. All the boilerplate code is already handled, letting you channel all your creativity into the things that set *your* agent apart.
|
||||
|
||||
---
|
||||
|
||||
### 🛠️ **Why AutoGPT Forge?**
|
||||
|
||||
- 💤 **No More Boilerplate!** - Don't let the mundane tasks stop you. Fork and build without the headache of starting from scratch!
|
||||
- 🧠 **Brain-centric Development!** - All the tools you need so you can spend 100% of your time on what matters - crafting the brain of your AI!
|
||||
- 🛠️ **Tooling ecosystem!** - We work with the best in class tools to bring you the best experience possible!
|
||||
|
||||
---
|
||||
|
||||
### 🚀 **Get Started!**
|
||||
|
||||
The best way to get started is to fork or download the AutoGPT repository and look at the example agent in `classic/forge/agent/forge_agent.py`.
|
||||
This can work as a starting point for your own agent.
|
||||
Agents are built using *components* which provide different functionality, see the [Component Introduction](./components/introduction.md). You can find built-in components in `classic/forge/components/`.
|
||||
|
||||
!!! warning
|
||||
The tutorial series below is out of date.
|
||||
|
||||
The getting started [tutorial series](https://aiedge.medium.com/autogpt-forge-e3de53cc58ec) will guide you through the process of setting up your project all the way through to building a generalist agent.
|
||||
|
||||
1. [AutoGPT Forge: A Comprehensive Guide to Your First Steps](https://aiedge.medium.com/autogpt-forge-a-comprehensive-guide-to-your-first-steps-a1dfdf46e3b4)
|
||||
2. [AutoGPT Forge: The Blueprint of an AI Agent](https://aiedge.medium.com/autogpt-forge-the-blueprint-of-an-ai-agent-75cd72ffde6)
|
||||
3. [AutoGPT Forge: Interacting with your Agent](https://aiedge.medium.com/autogpt-forge-interacting-with-your-agent-1214561b06b)
|
||||
4. [AutoGPT Forge: Crafting Intelligent Agent Logic](https://medium.com/@aiedge/autogpt-forge-crafting-intelligent-agent-logic-bc5197b14cb4)
|
Before Width: | Height: | Size: 504 KiB |
Before Width: | Height: | Size: 43 KiB |
Before Width: | Height: | Size: 47 KiB |
Before Width: | Height: | Size: 20 KiB |
Before Width: | Height: | Size: 17 KiB |
Before Width: | Height: | Size: 115 KiB |
Before Width: | Height: | Size: 88 KiB |
Before Width: | Height: | Size: 105 KiB |
Before Width: | Height: | Size: 29 KiB |
Before Width: | Height: | Size: 6.0 KiB |
Before Width: | Height: | Size: 81 KiB |
Before Width: | Height: | Size: 116 KiB |
Before Width: | Height: | Size: 309 KiB |
Before Width: | Height: | Size: 1.5 MiB |
Before Width: | Height: | Size: 109 KiB |
Before Width: | Height: | Size: 82 KiB |
Before Width: | Height: | Size: 113 KiB |
Before Width: | Height: | Size: 31 KiB |
Before Width: | Height: | Size: 184 KiB |
Before Width: | Height: | Size: 60 KiB |
Before Width: | Height: | Size: 35 KiB |
Before Width: | Height: | Size: 19 KiB |
Before Width: | Height: | Size: 110 KiB |
Before Width: | Height: | Size: 42 KiB |
Before Width: | Height: | Size: 12 KiB |
Before Width: | Height: | Size: 67 KiB |
Before Width: | Height: | Size: 59 KiB |
Before Width: | Height: | Size: 1.7 MiB |
Before Width: | Height: | Size: 1.6 MiB |
Before Width: | Height: | Size: 240 KiB |
Before Width: | Height: | Size: 560 KiB |
Before Width: | Height: | Size: 184 KiB |
Before Width: | Height: | Size: 1.2 MiB |
Before Width: | Height: | Size: 1.3 MiB |
Before Width: | Height: | Size: 436 KiB |
Before Width: | Height: | Size: 1.4 MiB |
Before Width: | Height: | Size: 202 KiB |
|
@ -1,85 +0,0 @@
|
|||
# AutoGPT Documentation
|
||||
|
||||
Welcome to the AutoGPT Documentation.
|
||||
|
||||
## What is the AutoGPT Platform?
|
||||
|
||||
The AutoGPT Platform is a groundbreaking system that revolutionizes AI utilization for businesses and individuals. It enables the creation, deployment, and management of continuous agents that work tirelessly on your behalf, bringing unprecedented efficiency and innovation to your workflows.
|
||||
|
||||
### Key Features
|
||||
|
||||
- **Seamless Integration and Low-Code Workflows**: Rapidly create complex workflows without extensive coding knowledge.
|
||||
- **Autonomous Operation and Continuous Agents**: Deploy cloud-based assistants that run indefinitely, activating on relevant triggers.
|
||||
- **Intelligent Automation and Maximum Efficiency**: Streamline workflows by automating repetitive processes.
|
||||
- **Reliable Performance and Predictable Execution**: Enjoy consistent and dependable long-running processes.
|
||||
|
||||
## Platform Architecture
|
||||
|
||||
The AutoGPT Platform consists of two main components:
|
||||
|
||||
### 1. AutoGPT Server
|
||||
|
||||
The powerhouse of our platform, containing:
|
||||
|
||||
- **Source Code**: Core logic driving agents and automation processes.
|
||||
- **Infrastructure**: Robust systems ensuring reliable and scalable performance.
|
||||
- **Marketplace**: A comprehensive marketplace for pre-built agents.
|
||||
|
||||
### 2. AutoGPT Frontend
|
||||
|
||||
The user interface where you interact with the platform:
|
||||
|
||||
- **Agent Builder**: Design and configure your own AI agents.
|
||||
- **Workflow Management**: Build, modify, and optimize automation workflows.
|
||||
- **Deployment Controls**: Manage the lifecycle of your agents.
|
||||
- **Ready-to-Use Agents**: Select from pre-configured agents.
|
||||
- **Agent Interaction**: Run and interact with agents through a user-friendly interface.
|
||||
- **Monitoring and Analytics**: Track agent performance and gain insights.
|
||||
|
||||
## Platform Components
|
||||
|
||||
### Agents and Workflows
|
||||
|
||||
In the platform, you can create highly customized workflows to build agents. An agent is essentially an automated workflow that you design to perform specific tasks or processes. Create customized workflows to build agents for various tasks, including:
|
||||
|
||||
- Data processing and analysis
|
||||
- Task scheduling and management
|
||||
- Communication and notification systems
|
||||
- Integration between different software tools
|
||||
- AI-powered decision making and content generation
|
||||
|
||||
### Blocks as Integrations
|
||||
|
||||
Blocks represent actions and are the building blocks of your workflows, including:
|
||||
|
||||
- Connections to external services
|
||||
- Data processing tools
|
||||
- AI models for various tasks
|
||||
- Custom scripts or functions
|
||||
- Conditional logic and decision-making components
|
||||
|
||||
You can learn more under: [Build your own Blocks](platform/new_blocks.md)
|
||||
|
||||
## Available Language Models
|
||||
|
||||
The platform comes pre-integrated with cutting-edge LLM providers:
|
||||
|
||||
- OpenAI
|
||||
- Anthropic
|
||||
- Groq
|
||||
- Llama
|
||||
|
||||
## License Overview
|
||||
|
||||
We've adopted a dual-license approach to balance open collaboration with sustainable development:
|
||||
|
||||
- **MIT License**: The majority of the AutoGPT repository remains under this license.
|
||||
- **Polyform Shield License**: Applies to the new `autogpt_platform` folder.
|
||||
|
||||
This strategy allows us to share previously closed-source components, fostering a vibrant ecosystem of developers and users.
|
||||
|
||||
## Ready to Get Started?
|
||||
|
||||
- Read the [Getting Started docs](https://docs.agpt.co/platform/getting-started/) to self-host
|
||||
- [Join the waitlist](https://agpt.co/waitlist) for the cloud-hosted beta
|
||||
- [Contribute](contribute/index.md)
|
|
@ -1,170 +0,0 @@
|
|||
# AutoGPT Blocks Overview
|
||||
|
||||
AutoGPT uses a modular approach with various "blocks" to handle different tasks. These blocks are the building blocks of AutoGPT workflows, allowing users to create complex automations by combining simple, specialized components.
|
||||
|
||||
Below is a comprehensive list of all available blocks, categorized by their primary function. Click on any block name to view its detailed documentation.
|
||||
|
||||
## Basic Operations
|
||||
| Block Name | Description |
|
||||
|------------|-------------|
|
||||
| [Store Value](basic.md#store-value) | Stores and forwards a value |
|
||||
| [Print to Console](basic.md#print-to-console) | Outputs text to the console for debugging |
|
||||
| [Find in Dictionary](basic.md#find-in-dictionary) | Looks up a value in a dictionary or list |
|
||||
| [Agent Input](basic.md#agent-input) | Accepts user input in a workflow |
|
||||
| [Agent Output](basic.md#agent-output) | Records and formats workflow results |
|
||||
| [Add to Dictionary](basic.md#add-to-dictionary) | Adds a new key-value pair to a dictionary |
|
||||
| [Add to List](basic.md#add-to-list) | Adds a new entry to a list |
|
||||
| [Note](basic.md#note) | Displays a sticky note in the workflow |
|
||||
|
||||
## Data Processing
|
||||
| Block Name | Description |
|
||||
|------------|-------------|
|
||||
| [Read CSV](csv.md#read-csv) | Processes and extracts data from CSV files |
|
||||
| [Data Sampling](sampling.md#data-sampling) | Selects a subset of data using various sampling methods |
|
||||
|
||||
## Text Processing
|
||||
| Block Name | Description |
|
||||
|------------|-------------|
|
||||
| [Match Text Pattern](text.md#match-text-pattern) | Checks if text matches a specified pattern |
|
||||
| [Extract Text Information](text.md#extract-text-information) | Extracts specific information from text using patterns |
|
||||
| [Fill Text Template](text.md#fill-text-template) | Populates a template with provided values |
|
||||
| [Combine Texts](text.md#combine-texts) | Merges multiple text inputs into one |
|
||||
| [Text Decoder](decoder_block.md#text-decoder) | Converts encoded text into readable format |
|
||||
|
||||
## AI and Language Models
|
||||
| Block Name | Description |
|
||||
|------------|-------------|
|
||||
| [AI Structured Response Generator](llm.md#ai-structured-response-generator) | Generates structured responses using LLMs |
|
||||
| [AI Text Generator](llm.md#ai-text-generator) | Produces text responses using LLMs |
|
||||
| [AI Text Summarizer](llm.md#ai-text-summarizer) | Summarizes long texts using LLMs |
|
||||
| [AI Conversation](llm.md#ai-conversation) | Facilitates multi-turn conversations with LLMs |
|
||||
| [AI List Generator](llm.md#ai-list-generator) | Creates lists based on prompts using LLMs |
|
||||
|
||||
## Web and API Interactions
|
||||
| Block Name | Description |
|
||||
|------------|-------------|
|
||||
| [Send Web Request](http.md#send-web-request) | Makes HTTP requests to specified web addresses |
|
||||
| [Read RSS Feed](rss.md#read-rss-feed) | Retrieves and processes entries from RSS feeds |
|
||||
| [Get Weather Information](search.md#get-weather-information) | Fetches current weather data for a location |
|
||||
| [Google Maps Search](google_maps.md#google-maps-search) | Searches for local businesses using Google Maps API |
|
||||
|
||||
## Social Media and Content
|
||||
| Block Name | Description |
|
||||
|------------|-------------|
|
||||
| [Get Reddit Posts](reddit.md#get-reddit-posts) | Retrieves posts from specified subreddits |
|
||||
| [Post Reddit Comment](reddit.md#post-reddit-comment) | Posts comments on Reddit |
|
||||
| [Publish to Medium](medium.md#publish-to-medium) | Publishes content directly to Medium |
|
||||
| [Read Discord Messages](discord.md#read-discord-messages) | Retrieves messages from Discord channels |
|
||||
| [Send Discord Message](discord.md#send-discord-message) | Sends messages to Discord channels |
|
||||
|
||||
## Search and Information Retrieval
|
||||
| Block Name | Description |
|
||||
|------------|-------------|
|
||||
| [Get Wikipedia Summary](search.md#get-wikipedia-summary) | Fetches summaries of topics from Wikipedia |
|
||||
| [Search The Web](search.md#search-the-web) | Performs web searches and returns results |
|
||||
| [Extract Website Content](search.md#extract-website-content) | Retrieves and extracts content from websites |
|
||||
|
||||
## Time and Date
|
||||
| Block Name | Description |
|
||||
|------------|-------------|
|
||||
| [Get Current Time](time_blocks.md#get-current-time) | Provides the current time |
|
||||
| [Get Current Date](time_blocks.md#get-current-date) | Provides the current date |
|
||||
| [Get Current Date and Time](time_blocks.md#get-current-date-and-time) | Provides both current date and time |
|
||||
| [Countdown Timer](time_blocks.md#countdown-timer) | Acts as a countdown timer |
|
||||
|
||||
## Math and Calculations
|
||||
| Block Name | Description |
|
||||
|------------|-------------|
|
||||
| [Calculator](maths.md#calculator) | Performs basic mathematical operations |
|
||||
| [Count Items](maths.md#count-items) | Counts items in a collection |
|
||||
|
||||
## Media Generation
|
||||
| Block Name | Description |
|
||||
|------------|-------------|
|
||||
| [Ideogram Model](ideogram.md#ideogram-model) | Generates images based on text prompts |
|
||||
| [Create Talking Avatar Video](talking_head.md#create-talking-avatar-video) | Creates videos with talking avatars |
|
||||
| [Unreal Text to Speech](text_to_speech_block.md#unreal-text-to-speech) | Converts text to speech using Unreal Speech API |
|
||||
| [AI Shortform Video Creator](ai_shortform_video_block.md#ai-shortform-video-creator) | Generates short-form videos using AI |
|
||||
| [Replicate Flux Advanced Model](replicate_flux_advanced.md#replicate-flux-advanced-model) | Creates images using Replicate's Flux models |
|
||||
|
||||
## Miscellaneous
|
||||
| Block Name | Description |
|
||||
|------------|-------------|
|
||||
| [Transcribe YouTube Video](youtube.md#transcribe-youtube-video) | Transcribes audio from YouTube videos |
|
||||
| [Send Email](email_block.md#send-email) | Sends emails using SMTP |
|
||||
| [Condition Block](branching.md#condition-block) | Evaluates conditions for workflow branching |
|
||||
| [Step Through Items](iteration.md#step-through-items) | Iterates through lists or dictionaries |
|
||||
|
||||
## Google Services
|
||||
| Block Name | Description |
|
||||
|------------|-------------|
|
||||
| [Gmail Read](google/gmail.md#gmail-read) | Retrieves and reads emails from a Gmail account |
|
||||
| [Gmail Send](google/gmail.md#gmail-send) | Sends emails using a Gmail account |
|
||||
| [Gmail List Labels](google/gmail.md#gmail-list-labels) | Retrieves all labels from a Gmail account |
|
||||
| [Gmail Add Label](google/gmail.md#gmail-add-label) | Adds a label to a specific email in a Gmail account |
|
||||
| [Gmail Remove Label](google/gmail.md#gmail-remove-label) | Removes a label from a specific email in a Gmail account |
|
||||
| [Google Sheets Read](google/sheet.md#google-sheets-read) | Reads data from a Google Sheets spreadsheet |
|
||||
| [Google Sheets Write](google/sheet.md#google-sheets-write) | Writes data to a Google Sheets spreadsheet |
|
||||
| [Google Maps Search](google_maps.md#google-maps-search) | Searches for local businesses using the Google Maps API |
|
||||
|
||||
## GitHub Integration
|
||||
| Block Name | Description |
|
||||
|------------|-------------|
|
||||
| [GitHub Comment](github/issues.md#github-comment) | Posts comments on GitHub issues or pull requests |
|
||||
| [GitHub Make Issue](github/issues.md#github-make-issue) | Creates new issues on GitHub repositories |
|
||||
| [GitHub Read Issue](github/issues.md#github-read-issue) | Retrieves information about a specific GitHub issue |
|
||||
| [GitHub List Issues](github/issues.md#github-list-issues) | Retrieves a list of issues from a GitHub repository |
|
||||
| [GitHub Add Label](github/issues.md#github-add-label) | Adds a label to a GitHub issue or pull request |
|
||||
| [GitHub Remove Label](github/issues.md#github-remove-label) | Removes a label from a GitHub issue or pull request |
|
||||
| [GitHub Assign Issue](github/issues.md#github-assign-issue) | Assigns a user to a GitHub issue |
|
||||
| [GitHub List Tags](github/repo.md#github-list-tags) | Retrieves and lists all tags for a specified GitHub repository |
|
||||
| [GitHub List Branches](github/repo.md#github-list-branches) | Retrieves and lists all branches for a specified GitHub repository |
|
||||
| [GitHub List Discussions](github/repo.md#github-list-discussions) | Retrieves and lists recent discussions for a specified GitHub repository |
|
||||
| [GitHub Make Branch](github/repo.md#github-make-branch) | Creates a new branch in a GitHub repository |
|
||||
| [GitHub Delete Branch](github/repo.md#github-delete-branch) | Deletes a specified branch from a GitHub repository |
|
||||
| [GitHub List Pull Requests](github/pull_requests.md#github-list-pull-requests) | Retrieves a list of pull requests from a specified GitHub repository |
|
||||
| [GitHub Make Pull Request](github/pull_requests.md#github-make-pull-request) | Creates a new pull request in a specified GitHub repository |
|
||||
| [GitHub Read Pull Request](github/pull_requests.md#github-read-pull-request) | Retrieves detailed information about a specific GitHub pull request |
|
||||
| [GitHub Assign PR Reviewer](github/pull_requests.md#github-assign-pr-reviewer) | Assigns a reviewer to a specific GitHub pull request |
|
||||
| [GitHub Unassign PR Reviewer](github/pull_requests.md#github-unassign-pr-reviewer) | Removes an assigned reviewer from a specific GitHub pull request |
|
||||
| [GitHub List PR Reviewers](github/pull_requests.md#github-list-pr-reviewers) | Retrieves a list of all assigned reviewers for a specific GitHub pull request |
|
||||
|
||||
## Twitter Integration
|
||||
| Block Name | Description |
|
||||
|------------|-------------|
|
||||
| [Twitter Post Tweet](twitter/twitter.md#twitter-post-tweet-block) | Creates a tweet on Twitter with text content and optional attachments including media, polls, quotes, or deep links |
|
||||
| [Twitter Delete Tweet](twitter/twitter.md#twitter-delete-tweet-block) | Deletes a specified tweet using its tweet ID |
|
||||
| [Twitter Search Recent](twitter/twitter.md#twitter-search-recent-block) | Searches for tweets matching specified criteria with options for filtering and pagination |
|
||||
| [Twitter Get Quote Tweets](twitter/twitter.md#twitter-get-quote-tweets-block) | Gets tweets that quote a specified tweet ID with options for pagination and filtering |
|
||||
| [Twitter Retweet](twitter/twitter.md#twitter-retweet-block) | Creates a retweet of a specified tweet using its tweet ID |
|
||||
| [Twitter Remove Retweet](twitter/twitter.md#twitter-remove-retweet-block) | Removes an existing retweet of a specified tweet |
|
||||
| [Twitter Get Retweeters](twitter/twitter.md#twitter-get-retweeters-block) | Gets list of users who have retweeted a specified tweet with pagination and filtering options |
|
||||
| [Twitter Get User Mentions](twitter/twitter.md#twitter-get-user-mentions-block) | Gets tweets where a specific user is mentioned using their user ID |
|
||||
| [Twitter Get Home Timeline](twitter/twitter.md#twitter-get-home-timeline-block) | Gets recent tweets and retweets from authenticated user and followed accounts |
|
||||
| [Twitter Get User](twitter/twitter.md#twitter-get-user-block) | Gets detailed profile information for a single Twitter user |
|
||||
| [Twitter Get Users](twitter/twitter.md#twitter-get-users-block) | Gets profile information for multiple Twitter users (up to 100) |
|
||||
| [Twitter Search Spaces](twitter/twitter.md#twitter-search-spaces-block) | Searches for Twitter Spaces matching title keywords with state filtering |
|
||||
| [Twitter Get Spaces](twitter/twitter.md#twitter-get-spaces-block) | Gets information about multiple Twitter Spaces by Space IDs or creator IDs |
|
||||
| [Twitter Get Space By Id](twitter/twitter.md#twitter-get-space-by-id-block) | Gets detailed information about a single Twitter Space |
|
||||
| [Twitter Get Space Tweets](twitter/twitter.md#twitter-get-space-tweets-block) | Gets tweets that were shared during a Twitter Space session |
|
||||
| [Twitter Follow List](twitter/twitter.md#twitter-follow-list-block) | Follows a Twitter List using its List ID |
|
||||
| [Twitter Unfollow List](twitter/twitter.md#twitter-unfollow-list-block) | Unfollows a previously followed Twitter List |
|
||||
| [Twitter Get List](twitter/twitter.md#twitter-get-list-block) | Gets detailed information about a specific Twitter List |
|
||||
| [Twitter Get Owned Lists](twitter/twitter.md#twitter-get-owned-lists-block) | Gets all Twitter Lists owned by a specified user |
|
||||
| [Twitter Get List Members](twitter/twitter.md#twitter-get-list-members-block) | Gets information about members of a specified Twitter List |
|
||||
| [Twitter Add List Member](twitter/twitter.md#twitter-add-list-member-block) | Adds a specified user as a member to a Twitter List |
|
||||
| [Twitter Remove List Member](twitter/twitter.md#twitter-remove-list-member-block) | Removes a specified user from a Twitter List |
|
||||
| [Twitter Get List Tweets](twitter/twitter.md#twitter-get-list-tweets-block) | Gets tweets posted within a specified Twitter List |
|
||||
| [Twitter Create List](twitter/twitter.md#twitter-create-list-block) | Creates a new Twitter List with specified name and settings |
|
||||
| [Twitter Update List](twitter/twitter.md#twitter-update-list-block) | Updates name and/or description of an existing Twitter List |
|
||||
| [Twitter Delete List](twitter/twitter.md#twitter-delete-list-block) | Deletes a specified Twitter List |
|
||||
| [Twitter Pin List](twitter/twitter.md#twitter-pin-list-block) | Pins a Twitter List to appear at top of Lists |
|
||||
| [Twitter Unpin List](twitter/twitter.md#twitter-unpin-list-block) | Removes a Twitter List from pinned Lists |
|
||||
| [Twitter Get Pinned Lists](twitter/twitter.md#twitter-get-pinned-lists-block) | Gets all Twitter Lists that are currently pinned |
|
||||
| Twitter List Get Followers | Working... Gets all followers of a specified Twitter List |
|
||||
| Twitter Get Followed Lists | Working... Gets all Lists that a user follows |
|
||||
| Twitter Get DM Events | Working... Retrieves direct message events for a user |
|
||||
| Twitter Send Direct Message | Working... Sends a direct message to a specified user |
|
||||
| Twitter Create DM Conversation | Working... Creates a new direct message conversation |
|
||||
|
||||
This comprehensive list covers all the blocks available in AutoGPT. Each block is designed to perform a specific task, and they can be combined to create powerful, automated workflows. For more detailed information on each block, click on its name to view the full documentation.
|
|
@ -1,148 +0,0 @@
|
|||
# Getting Started with AutoGPT: Self-Hosting Guide
|
||||
|
||||
This tutorial will walk you through the process of setting up AutoGPT locally on your machine.
|
||||
|
||||
<center><iframe width="560" height="315" src="https://www.youtube.com/embed/4Bycr6_YAMI?si=dXGhFeWrCK2UkKgj" title="YouTube video player" frameborder="0" allow="accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture; web-share" referrerpolicy="strict-origin-when-cross-origin" allowfullscreen></iframe></center>
|
||||
|
||||
## Introduction
|
||||
|
||||
This guide will help you setup the server and builder for the project.
|
||||
|
||||
<!-- The video is listed in the root Readme.md of the repo -->
|
||||
|
||||
We also offer this in video format. You can check it out [here](https://github.com/Significant-Gravitas/AutoGPT?tab=readme-ov-file#how-to-setup-for-self-hosting).
|
||||
|
||||
!!! warning
|
||||
**DO NOT FOLLOW ANY OUTSIDE TUTORIALS AS THEY WILL LIKELY BE OUT OF DATE**
|
||||
|
||||
## Prerequisites
|
||||
|
||||
To setup the server, you need to have the following installed:
|
||||
|
||||
- [Node.js](https://nodejs.org/en/)
|
||||
- [Docker](https://docs.docker.com/get-docker/)
|
||||
- [Git](https://git-scm.com/downloads)
|
||||
|
||||
#### Checking if you have Node.js & NPM installed
|
||||
|
||||
We use Node.js to run our frontend application.
|
||||
|
||||
If you need assistance installing Node.js:
|
||||
https://nodejs.org/en/download/
|
||||
|
||||
NPM is included with Node.js, but if you need assistance installing NPM:
|
||||
https://docs.npmjs.com/downloading-and-installing-node-js-and-npm
|
||||
|
||||
You can check if you have Node.js & NPM installed by running the following command:
|
||||
|
||||
```bash
|
||||
node -v
|
||||
npm -v
|
||||
```
|
||||
|
||||
Once you have Node.js installed, you can proceed to the next step.
|
||||
|
||||
#### Checking if you have Docker & Docker Compose installed
|
||||
|
||||
Docker containerizes applications, while Docker Compose orchestrates multi-container Docker applications.
|
||||
|
||||
If you need assistance installing docker:
|
||||
https://docs.docker.com/desktop/
|
||||
|
||||
Docker-compose is included in Docker Desktop, but if you need assistance installing docker compose:
|
||||
https://docs.docker.com/compose/install/
|
||||
|
||||
You can check if you have Docker installed by running the following command:
|
||||
|
||||
```bash
|
||||
docker -v
|
||||
docker compose -v
|
||||
```
|
||||
|
||||
Once you have Docker and Docker Compose installed, you can proceed to the next step.
|
||||
|
||||
### Cloning the Repository
|
||||
The first step is cloning the AutoGPT repository to your computer.
|
||||
To do this, open a terminal window in a folder on your computer and run:
|
||||
```
|
||||
git clone https://github.com/Significant-Gravitas/AutoGPT.git
|
||||
```
|
||||
If you get stuck, follow [this guide](https://docs.github.com/en/repositories/creating-and-managing-repositories/cloning-a-repository).
|
||||
|
||||
Once that's complete you can close this terminal window.
|
||||
|
||||
### Running the backend services
|
||||
|
||||
To run the backend services, follow these steps:
|
||||
|
||||
* Within the repository, clone the submodules and navigate to the `autogpt_platform` directory:
|
||||
```bash
|
||||
git submodule update --init --recursive
|
||||
cd autogpt_platform
|
||||
```
|
||||
This command will initialize and update the submodules in the repository. The `supabase` folder will be cloned to the root directory.
|
||||
|
||||
* Copy the `.env.example` file available in the `supabase/docker` directory to `.env` in `autogpt_platform`:
|
||||
```
|
||||
cp supabase/docker/.env.example .env
|
||||
```
|
||||
This command will copy the `.env.example` file to `.env` in the `supabase/docker` directory. You can modify the `.env` file to add your own environment variables.
|
||||
|
||||
* Run the backend services:
|
||||
```
|
||||
docker compose up -d --build
|
||||
```
|
||||
This command will start all the necessary backend services defined in the `docker-compose.combined.yml` file in detached mode.
|
||||
|
||||
|
||||
### Running the frontend application
|
||||
|
||||
To run the frontend application, follow these steps:
|
||||
|
||||
* Navigate to `frontend` folder within the `autogpt_platform` directory:
|
||||
```
|
||||
cd frontend
|
||||
```
|
||||
|
||||
* Copy the `.env.example` file available in the `frontend` directory to `.env` in the same directory:
|
||||
```
|
||||
cp .env.example .env
|
||||
```
|
||||
You can modify the `.env` within this folder to add your own environment variables for the frontend application.
|
||||
|
||||
* Run the following command:
|
||||
```
|
||||
npm install
|
||||
npm run dev
|
||||
```
|
||||
This command will install the necessary dependencies and start the frontend application in development mode.
|
||||
|
||||
### Checking if the application is running
|
||||
|
||||
You can check if the server is running by visiting [http://localhost:3000](http://localhost:3000) in your browser.
|
||||
|
||||
**Notes:**
|
||||
|
||||
By default the application for different services run on the following ports:
|
||||
|
||||
Frontend UI Server: 3000
|
||||
Backend Websocket Server: 8001
|
||||
Execution API Rest Server: 8006
|
||||
|
||||
#### Additional Notes
|
||||
|
||||
You may want to change your encryption key in the `.env` file in the `autogpt_platform/backend` directory.
|
||||
|
||||
To generate a new encryption key, run the following command in python:
|
||||
|
||||
```python
|
||||
from cryptography.fernet import Fernet;Fernet.generate_key().decode()
|
||||
```
|
||||
|
||||
Or run the following command in the `autogpt_platform/backend` directory:
|
||||
|
||||
```bash
|
||||
poetry run cli gen-encrypt-key
|
||||
```
|
||||
|
||||
Then, replace the existing key in the `autogpt_platform/backend/.env` file with the new one.
|
|
@ -1,687 +0,0 @@
|
|||
# Contributing to AutoGPT Agent Server: Creating and Testing Blocks
|
||||
|
||||
This guide will walk you through the process of creating and testing a new block for the AutoGPT Agent Server, using the WikipediaSummaryBlock as an example.
|
||||
|
||||
## Understanding Blocks and Testing
|
||||
|
||||
Blocks are reusable components that can be connected to form a graph representing an agent's behavior. Each block has inputs, outputs, and a specific function. Proper testing is crucial to ensure blocks work correctly and consistently.
|
||||
|
||||
## Creating and Testing a New Block
|
||||
|
||||
Follow these steps to create and test a new block:
|
||||
|
||||
1. **Create a new Python file** for your block in the `autogpt_platform/backend/backend/blocks` directory. Name it descriptively and use snake_case. For example: `get_wikipedia_summary.py`.
|
||||
|
||||
2. **Import necessary modules and create a class that inherits from `Block`**. Make sure to include all necessary imports for your block.
|
||||
|
||||
Every block should contain the following:
|
||||
|
||||
```python
|
||||
from backend.data.block import Block, BlockSchema, BlockOutput
|
||||
```
|
||||
|
||||
Example for the Wikipedia summary block:
|
||||
|
||||
```python
|
||||
from backend.data.block import Block, BlockSchema, BlockOutput
|
||||
from backend.utils.get_request import GetRequest
|
||||
import requests
|
||||
|
||||
class WikipediaSummaryBlock(Block, GetRequest):
|
||||
# Block implementation will go here
|
||||
```
|
||||
|
||||
3. **Define the input and output schemas** using `BlockSchema`. These schemas specify the data structure that the block expects to receive (input) and produce (output).
|
||||
|
||||
- The input schema defines the structure of the data the block will process. Each field in the schema represents a required piece of input data.
|
||||
- The output schema defines the structure of the data the block will return after processing. Each field in the schema represents a piece of output data.
|
||||
|
||||
Example:
|
||||
|
||||
```python
|
||||
class Input(BlockSchema):
|
||||
topic: str # The topic to get the Wikipedia summary for
|
||||
|
||||
class Output(BlockSchema):
|
||||
summary: str # The summary of the topic from Wikipedia
|
||||
error: str # Any error message if the request fails, error field needs to be named `error`.
|
||||
```
|
||||
|
||||
4. **Implement the `__init__` method, including test data and mocks:**
|
||||
|
||||
!!! important
|
||||
Use UUID generator (e.g. https://www.uuidgenerator.net/) for every new block `id` and *do not* make up your own. Alternatively, you can run this python code to generate an uuid: `print(__import__('uuid').uuid4())`
|
||||
|
||||
```python
|
||||
def __init__(self):
|
||||
super().__init__(
|
||||
# Unique ID for the block, used across users for templates
|
||||
# If you are an AI leave it as is or change to "generate-proper-uuid"
|
||||
id="xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx",
|
||||
input_schema=WikipediaSummaryBlock.Input, # Assign input schema
|
||||
output_schema=WikipediaSummaryBlock.Output, # Assign output schema
|
||||
|
||||
# Provide sample input, output and test mock for testing the block
|
||||
|
||||
test_input={"topic": "Artificial Intelligence"},
|
||||
test_output=("summary", "summary content"),
|
||||
test_mock={"get_request": lambda url, json: {"extract": "summary content"}},
|
||||
)
|
||||
```
|
||||
|
||||
- `id`: A unique identifier for the block.
|
||||
|
||||
- `input_schema` and `output_schema`: Define the structure of the input and output data.
|
||||
|
||||
Let's break down the testing components:
|
||||
|
||||
- `test_input`: This is a sample input that will be used to test the block. It should be a valid input according to your Input schema.
|
||||
|
||||
- `test_output`: This is the expected output when running the block with the `test_input`. It should match your Output schema. For non-deterministic outputs or when you only want to assert the type, you can use Python types instead of specific values. In this example, `("summary", str)` asserts that the output key is "summary" and its value is a string.
|
||||
|
||||
- `test_mock`: This is crucial for blocks that make network calls. It provides a mock function that replaces the actual network call during testing.
|
||||
|
||||
In this case, we're mocking the `get_request` method to always return a dictionary with an 'extract' key, simulating a successful API response. This allows us to test the block's logic without making actual network requests, which could be slow, unreliable, or rate-limited.
|
||||
|
||||
5. **Implement the `run` method with error handling.** This should contain the main logic of the block:
|
||||
|
||||
```python
|
||||
def run(self, input_data: Input, **kwargs) -> BlockOutput:
|
||||
try:
|
||||
topic = input_data.topic
|
||||
url = f"https://en.wikipedia.org/api/rest_v1/page/summary/{topic}"
|
||||
|
||||
response = self.get_request(url, json=True)
|
||||
yield "summary", response['extract']
|
||||
|
||||
except requests.exceptions.HTTPError as http_err:
|
||||
raise RuntimeError(f"HTTP error occurred: {http_err}")
|
||||
```
|
||||
|
||||
- **Try block**: Contains the main logic to fetch and process the Wikipedia summary.
|
||||
- **API request**: Send a GET request to the Wikipedia API.
|
||||
- **Error handling**: Handle various exceptions that might occur during the API request and data processing. We don't need to catch all exceptions, only the ones we expect and can handle. The uncaught exceptions will be automatically yielded as `error` in the output. Any block that raises an exception (or yields an `error` output) will be marked as failed. Prefer raising exceptions over yielding `error`, as it will stop the execution immediately.
|
||||
- **Yield**: Use `yield` to output the results. Prefer to output one result object at a time. If you are calling a function that returns a list, you can yield each item in the list separately. You can also yield the whole list as well, but do both rather than yielding the list. For example: If you were writing a block that outputs emails, you'd yield each email as a separate result object, but you could also yield the whole list as an additional single result object. Yielding output named `error` will break the execution right away and mark the block execution as failed.
|
||||
- **kwargs**: The `kwargs` parameter is used to pass additional arguments to the block. It is not used in the example above, but it is available to the block. You can also have args as inline signatures in the run method ala `def run(self, input_data: Input, *, user_id: str, **kwargs) -> BlockOutput:`.
|
||||
Available kwargs are:
|
||||
- `user_id`: The ID of the user running the block.
|
||||
- `graph_id`: The ID of the agent that is executing the block. This is the same for every version of the agent
|
||||
- `graph_exec_id`: The ID of the execution of the agent. This changes every time the agent has a new "run"
|
||||
- `node_exec_id`: The ID of the execution of the node. This changes every time the node is executed
|
||||
- `node_id`: The ID of the node that is being executed. It changes every version of the graph, but not every time the node is executed.
|
||||
|
||||
### Field Types
|
||||
|
||||
#### oneOf fields
|
||||
`oneOf` allows you to specify that a field must be exactly one of several possible options. This is useful when you want your block to accept different types of inputs that are mutually exclusive.
|
||||
|
||||
Example:
|
||||
```python
|
||||
attachment: Union[Media, DeepLink, Poll, Place, Quote] = SchemaField(
|
||||
discriminator='discriminator',
|
||||
description="Attach either media, deep link, poll, place or quote - only one can be used"
|
||||
)
|
||||
```
|
||||
|
||||
The `discriminator` parameter tells AutoGPT which field to look at in the input to determine which type it is.
|
||||
|
||||
In each model, you need to define the discriminator value:
|
||||
```python
|
||||
class Media(BaseModel):
|
||||
discriminator: Literal['media']
|
||||
media_ids: List[str]
|
||||
|
||||
class DeepLink(BaseModel):
|
||||
discriminator: Literal['deep_link']
|
||||
direct_message_deep_link: str
|
||||
```
|
||||
|
||||
#### OptionalOneOf fields
|
||||
`OptionalOneOf` is similar to `oneOf` but allows the field to be optional (None). This means the field can be either one of the specified types or None.
|
||||
|
||||
Example:
|
||||
```python
|
||||
attachment: Union[Media, DeepLink, Poll, Place, Quote] | None = SchemaField(
|
||||
discriminator='discriminator',
|
||||
description="Optional attachment - can be media, deep link, poll, place, quote or None"
|
||||
)
|
||||
```
|
||||
|
||||
The key difference is the `| None` which makes the entire field optional.
|
||||
|
||||
### Blocks with authentication
|
||||
|
||||
Our system supports auth offloading for API keys and OAuth2 authorization flows.
|
||||
Adding a block with API key authentication is straight-forward, as is adding a block
|
||||
for a service that we already have OAuth2 support for.
|
||||
|
||||
Implementing the block itself is relatively simple. On top of the instructions above,
|
||||
you're going to add a `credentials` parameter to the `Input` model and the `run` method:
|
||||
|
||||
```python
|
||||
from backend.data.model import (
|
||||
APIKeyCredentials,
|
||||
OAuth2Credentials,
|
||||
Credentials,
|
||||
)
|
||||
|
||||
from backend.data.block import Block, BlockOutput, BlockSchema
|
||||
from backend.data.model import CredentialsField
|
||||
from backend.integrations.providers import ProviderName
|
||||
|
||||
|
||||
# API Key auth:
|
||||
class BlockWithAPIKeyAuth(Block):
|
||||
class Input(BlockSchema):
|
||||
# Note that the type hint below is require or you will get a type error.
|
||||
# The first argument is the provider name, the second is the credential type.
|
||||
credentials: CredentialsMetaInput[
|
||||
Literal[ProviderName.GITHUB], Literal["api_key"]
|
||||
] = CredentialsField(
|
||||
description="The GitHub integration can be used with "
|
||||
"any API key with sufficient permissions for the blocks it is used on.",
|
||||
)
|
||||
|
||||
# ...
|
||||
|
||||
def run(
|
||||
self,
|
||||
input_data: Input,
|
||||
*,
|
||||
credentials: APIKeyCredentials,
|
||||
**kwargs,
|
||||
) -> BlockOutput:
|
||||
...
|
||||
|
||||
# OAuth:
|
||||
class BlockWithOAuth(Block):
|
||||
class Input(BlockSchema):
|
||||
# Note that the type hint below is require or you will get a type error.
|
||||
# The first argument is the provider name, the second is the credential type.
|
||||
credentials: CredentialsMetaInput[
|
||||
Literal[ProviderName.GITHUB], Literal["oauth2"]
|
||||
] = CredentialsField(
|
||||
required_scopes={"repo"},
|
||||
description="The GitHub integration can be used with OAuth.",
|
||||
)
|
||||
|
||||
# ...
|
||||
|
||||
def run(
|
||||
self,
|
||||
input_data: Input,
|
||||
*,
|
||||
credentials: OAuth2Credentials,
|
||||
**kwargs,
|
||||
) -> BlockOutput:
|
||||
...
|
||||
|
||||
# API Key auth + OAuth:
|
||||
class BlockWithAPIKeyAndOAuth(Block):
|
||||
class Input(BlockSchema):
|
||||
# Note that the type hint below is require or you will get a type error.
|
||||
# The first argument is the provider name, the second is the credential type.
|
||||
credentials: CredentialsMetaInput[
|
||||
Literal[ProviderName.GITHUB], Literal["api_key", "oauth2"]
|
||||
] = CredentialsField(
|
||||
required_scopes={"repo"},
|
||||
description="The GitHub integration can be used with OAuth, "
|
||||
"or any API key with sufficient permissions for the blocks it is used on.",
|
||||
)
|
||||
|
||||
# ...
|
||||
|
||||
def run(
|
||||
self,
|
||||
input_data: Input,
|
||||
*,
|
||||
credentials: Credentials,
|
||||
**kwargs,
|
||||
) -> BlockOutput:
|
||||
...
|
||||
```
|
||||
|
||||
The credentials will be automagically injected by the executor in the back end.
|
||||
|
||||
The `APIKeyCredentials` and `OAuth2Credentials` models are defined [here](https://github.com/Significant-Gravitas/AutoGPT/blob/master/autogpt_platform/autogpt_libs/autogpt_libs/supabase_integration_credentials_store/types.py).
|
||||
To use them in e.g. an API request, you can either access the token directly:
|
||||
|
||||
```python
|
||||
# credentials: APIKeyCredentials
|
||||
response = requests.post(
|
||||
url,
|
||||
headers={
|
||||
"Authorization": f"Bearer {credentials.api_key.get_secret_value()})",
|
||||
},
|
||||
)
|
||||
|
||||
# credentials: OAuth2Credentials
|
||||
response = requests.post(
|
||||
url,
|
||||
headers={
|
||||
"Authorization": f"Bearer {credentials.access_token.get_secret_value()})",
|
||||
},
|
||||
)
|
||||
```
|
||||
|
||||
or use the shortcut `credentials.auth_header()`:
|
||||
|
||||
```python
|
||||
# credentials: APIKeyCredentials | OAuth2Credentials
|
||||
response = requests.post(
|
||||
url,
|
||||
headers={"Authorization": credentials.auth_header()},
|
||||
)
|
||||
```
|
||||
|
||||
The `ProviderName` enum is the single source of truth for which providers exist in our system.
|
||||
Naturally, to add an authenticated block for a new provider, you'll have to add it here too.
|
||||
<details>
|
||||
<summary><code>ProviderName</code> definition</summary>
|
||||
|
||||
```python title="backend/integrations/providers.py"
|
||||
--8<-- "autogpt_platform/backend/backend/integrations/providers.py:ProviderName"
|
||||
```
|
||||
</details>
|
||||
|
||||
#### Multiple credentials inputs
|
||||
Multiple credentials inputs are supported, under the following conditions:
|
||||
- The name of each of the credentials input fields must end with `_credentials`.
|
||||
- The names of the credentials input fields must match the names of the corresponding
|
||||
parameters on the `run(..)` method of the block.
|
||||
- If more than one of the credentials parameters are required, `test_credentials`
|
||||
is a `dict[str, Credentials]`, with for each required credentials input the
|
||||
parameter name as the key and suitable test credentials as the value.
|
||||
|
||||
|
||||
#### Adding an OAuth2 service integration
|
||||
|
||||
To add support for a new OAuth2-authenticated service, you'll need to add an `OAuthHandler`.
|
||||
All our existing handlers and the base class can be found [here][OAuth2 handlers].
|
||||
|
||||
Every handler must implement the following parts of the [`BaseOAuthHandler`] interface:
|
||||
|
||||
```python title="backend/integrations/oauth/base.py"
|
||||
--8<-- "autogpt_platform/backend/backend/integrations/oauth/base.py:BaseOAuthHandler1"
|
||||
--8<-- "autogpt_platform/backend/backend/integrations/oauth/base.py:BaseOAuthHandler2"
|
||||
--8<-- "autogpt_platform/backend/backend/integrations/oauth/base.py:BaseOAuthHandler3"
|
||||
--8<-- "autogpt_platform/backend/backend/integrations/oauth/base.py:BaseOAuthHandler4"
|
||||
--8<-- "autogpt_platform/backend/backend/integrations/oauth/base.py:BaseOAuthHandler5"
|
||||
--8<-- "autogpt_platform/backend/backend/integrations/oauth/base.py:BaseOAuthHandler6"
|
||||
```
|
||||
|
||||
As you can see, this is modeled after the standard OAuth2 flow.
|
||||
|
||||
Aside from implementing the `OAuthHandler` itself, adding a handler into the system requires two more things:
|
||||
|
||||
- Adding the handler class to `HANDLERS_BY_NAME` under [`integrations/oauth/__init__.py`](https://github.com/Significant-Gravitas/AutoGPT/blob/master/autogpt_platform/backend/backend/integrations/oauth/__init__.py)
|
||||
|
||||
```python title="backend/integrations/oauth/__init__.py"
|
||||
--8<-- "autogpt_platform/backend/backend/integrations/oauth/__init__.py:HANDLERS_BY_NAMEExample"
|
||||
```
|
||||
|
||||
- Adding `{provider}_client_id` and `{provider}_client_secret` to the application's `Secrets` under [`util/settings.py`](https://github.com/Significant-Gravitas/AutoGPT/blob/master/autogpt_platform/backend/backend/util/settings.py)
|
||||
|
||||
```python title="backend/util/settings.py"
|
||||
--8<-- "autogpt_platform/backend/backend/util/settings.py:OAuthServerCredentialsExample"
|
||||
```
|
||||
|
||||
[OAuth2 handlers]: https://github.com/Significant-Gravitas/AutoGPT/tree/master/autogpt_platform/backend/backend/integrations/oauth
|
||||
[`BaseOAuthHandler`]: https://github.com/Significant-Gravitas/AutoGPT/blob/master/autogpt_platform/backend/backend/integrations/oauth/base.py
|
||||
|
||||
#### Adding to the frontend
|
||||
|
||||
You will need to add the provider (api or oauth) to the `CredentialsInput` component in [`frontend/src/components/integrations/credentials-input.tsx`](https://github.com/Significant-Gravitas/AutoGPT/blob/master/autogpt_platform/frontend/src/components/integrations/credentials-input.tsx).
|
||||
|
||||
```ts title="frontend/src/components/integrations/credentials-input.tsx"
|
||||
--8<-- "autogpt_platform/frontend/src/components/integrations/credentials-input.tsx:ProviderIconsEmbed"
|
||||
```
|
||||
|
||||
You will also need to add the provider to the `CredentialsProvider` component in [`frontend/src/components/integrations/credentials-provider.tsx`](https://github.com/Significant-Gravitas/AutoGPT/blob/master/autogpt_platform/frontend/src/components/integrations/credentials-provider.tsx).
|
||||
|
||||
```ts title="frontend/src/components/integrations/credentials-provider.tsx"
|
||||
--8<-- "autogpt_platform/frontend/src/components/integrations/credentials-provider.tsx:CredentialsProviderNames"
|
||||
```
|
||||
|
||||
Finally you will need to add the provider to the `CredentialsType` enum in [`frontend/src/lib/autogpt-server-api/types.ts`](https://github.com/Significant-Gravitas/AutoGPT/blob/master/autogpt_platform/frontend/src/lib/autogpt-server-api/types.ts).
|
||||
|
||||
```ts title="frontend/src/lib/autogpt-server-api/types.ts"
|
||||
--8<-- "autogpt_platform/frontend/src/lib/autogpt-server-api/types.ts:BlockIOCredentialsSubSchema"
|
||||
```
|
||||
|
||||
#### Example: GitHub integration
|
||||
|
||||
- GitHub blocks with API key + OAuth2 support: [`blocks/github`](https://github.com/Significant-Gravitas/AutoGPT/tree/master/autogpt_platform/backend/backend/blocks/github/)
|
||||
|
||||
```python title="backend/blocks/github/issues.py"
|
||||
--8<-- "autogpt_platform/backend/backend/blocks/github/issues.py:GithubCommentBlockExample"
|
||||
```
|
||||
|
||||
- GitHub OAuth2 handler: [`integrations/oauth/github.py`](https://github.com/Significant-Gravitas/AutoGPT/blob/master/autogpt_platform/backend/backend/integrations/oauth/github.py)
|
||||
|
||||
```python title="backend/integrations/oauth/github.py"
|
||||
--8<-- "autogpt_platform/backend/backend/integrations/oauth/github.py:GithubOAuthHandlerExample"
|
||||
```
|
||||
|
||||
#### Example: Google integration
|
||||
|
||||
- Google OAuth2 handler: [`integrations/oauth/google.py`](https://github.com/Significant-Gravitas/AutoGPT/blob/master/autogpt_platform/backend/backend/integrations/oauth/google.py)
|
||||
|
||||
```python title="backend/integrations/oauth/google.py"
|
||||
--8<-- "autogpt_platform/backend/backend/integrations/oauth/google.py:GoogleOAuthHandlerExample"
|
||||
```
|
||||
|
||||
You can see that google has defined a `DEFAULT_SCOPES` variable, this is used to set the scopes that are requested no matter what the user asks for.
|
||||
|
||||
```python title="backend/blocks/google/_auth.py"
|
||||
--8<-- "autogpt_platform/backend/backend/blocks/google/_auth.py:GoogleOAuthIsConfigured"
|
||||
```
|
||||
|
||||
You can also see that `GOOGLE_OAUTH_IS_CONFIGURED` is used to disable the blocks that require OAuth if the oauth is not configured. This is in the `__init__` method of each block. This is because there is no api key fallback for google blocks so we need to make sure that the oauth is configured before we allow the user to use the blocks.
|
||||
|
||||
### Webhook-triggered Blocks
|
||||
|
||||
Webhook-triggered blocks allow your agent to respond to external events in real-time.
|
||||
These blocks are triggered by incoming webhooks from third-party services
|
||||
rather than being executed manually.
|
||||
|
||||
Creating and running a webhook-triggered block involves three main components:
|
||||
|
||||
- The block itself, which specifies:
|
||||
- Inputs for the user to select a resource and events to subscribe to
|
||||
- A `credentials` input with the scopes needed to manage webhooks
|
||||
- Logic to turn the webhook payload into outputs for the webhook block
|
||||
- The `WebhooksManager` for the corresponding webhook service provider, which handles:
|
||||
- (De)registering webhooks with the provider
|
||||
- Parsing and validating incoming webhook payloads
|
||||
- The credentials system for the corresponding service provider, which may include an `OAuthHandler`
|
||||
|
||||
There is more going on under the hood, e.g. to store and retrieve webhooks and their
|
||||
links to nodes, but to add a webhook-triggered block you shouldn't need to make changes
|
||||
to those parts of the system.
|
||||
|
||||
#### Creating a Webhook-triggered Block
|
||||
|
||||
To create a webhook-triggered block, follow these additional steps on top of the basic block creation process:
|
||||
|
||||
1. **Define `webhook_config`** in your block's `__init__` method.
|
||||
|
||||
<details>
|
||||
<summary>Example: <code>GitHubPullRequestTriggerBlock</code></summary>
|
||||
|
||||
```python title="backend/blocks/github/triggers.py"
|
||||
--8<-- "autogpt_platform/backend/backend/blocks/github/triggers.py:example-webhook_config"
|
||||
```
|
||||
</details>
|
||||
|
||||
<details>
|
||||
<summary><code>BlockWebhookConfig</code> definition</summary>
|
||||
|
||||
```python title="backend/data/block.py"
|
||||
--8<-- "autogpt_platform/backend/backend/data/block.py:BlockWebhookConfig"
|
||||
```
|
||||
</details>
|
||||
|
||||
2. **Define event filter input** in your block's Input schema.
|
||||
This allows the user to select which specific types of events will trigger the block in their agent.
|
||||
|
||||
<details>
|
||||
<summary>Example: <code>GitHubPullRequestTriggerBlock</code></summary>
|
||||
|
||||
```python title="backend/blocks/github/triggers.py"
|
||||
--8<-- "autogpt_platform/backend/backend/blocks/github/triggers.py:example-event-filter"
|
||||
```
|
||||
</details>
|
||||
|
||||
- The name of the input field (`events` in this case) must match `webhook_config.event_filter_input`.
|
||||
- The event filter itself must be a Pydantic model with only boolean fields.
|
||||
|
||||
4. **Include payload field** in your block's Input schema.
|
||||
|
||||
<details>
|
||||
<summary>Example: <code>GitHubTriggerBase</code></summary>
|
||||
|
||||
```python title="backend/blocks/github/triggers.py"
|
||||
--8<-- "autogpt_platform/backend/backend/blocks/github/triggers.py:example-payload-field"
|
||||
```
|
||||
</details>
|
||||
|
||||
5. **Define `credentials` input** in your block's Input schema.
|
||||
- Its scopes must be sufficient to manage a user's webhooks through the provider's API
|
||||
- See [Blocks with authentication](#blocks-with-authentication) for further details
|
||||
|
||||
6. **Process webhook payload** and output relevant parts of it in your block's `run` method.
|
||||
|
||||
<details>
|
||||
<summary>Example: <code>GitHubPullRequestTriggerBlock</code></summary>
|
||||
|
||||
```python
|
||||
def run(self, input_data: Input, **kwargs) -> BlockOutput:
|
||||
yield "payload", input_data.payload
|
||||
yield "sender", input_data.payload["sender"]
|
||||
yield "event", input_data.payload["action"]
|
||||
yield "number", input_data.payload["number"]
|
||||
yield "pull_request", input_data.payload["pull_request"]
|
||||
```
|
||||
|
||||
Note that the `credentials` parameter can be omitted if the credentials
|
||||
aren't used at block runtime, like in the example.
|
||||
</details>
|
||||
|
||||
#### Adding a Webhooks Manager
|
||||
|
||||
To add support for a new webhook provider, you'll need to create a WebhooksManager that implements the `BaseWebhooksManager` interface:
|
||||
|
||||
```python title="backend/integrations/webhooks/_base.py"
|
||||
--8<-- "autogpt_platform/backend/backend/integrations/webhooks/_base.py:BaseWebhooksManager1"
|
||||
|
||||
--8<-- "autogpt_platform/backend/backend/integrations/webhooks/_base.py:BaseWebhooksManager2"
|
||||
--8<-- "autogpt_platform/backend/backend/integrations/webhooks/_base.py:BaseWebhooksManager3"
|
||||
--8<-- "autogpt_platform/backend/backend/integrations/webhooks/_base.py:BaseWebhooksManager4"
|
||||
--8<-- "autogpt_platform/backend/backend/integrations/webhooks/_base.py:BaseWebhooksManager5"
|
||||
```
|
||||
|
||||
And add a reference to your `WebhooksManager` class in `WEBHOOK_MANAGERS_BY_NAME`:
|
||||
|
||||
```python title="backend/integrations/webhooks/__init__.py"
|
||||
--8<-- "autogpt_platform/backend/backend/integrations/webhooks/__init__.py:WEBHOOK_MANAGERS_BY_NAME"
|
||||
```
|
||||
|
||||
#### Example: GitHub Webhook Integration
|
||||
|
||||
<details>
|
||||
<summary>
|
||||
GitHub Webhook triggers: <a href="https://github.com/Significant-Gravitas/AutoGPT/blob/master/autogpt_platform/backend/backend/blocks/github/triggers.py"><code>blocks/github/triggers.py</code></a>
|
||||
</summary>
|
||||
|
||||
```python title="backend/blocks/github/triggers.py"
|
||||
--8<-- "autogpt_platform/backend/backend/blocks/github/triggers.py:GithubTriggerExample"
|
||||
```
|
||||
</details>
|
||||
|
||||
<details>
|
||||
<summary>
|
||||
GitHub Webhooks Manager: <a href="https://github.com/Significant-Gravitas/AutoGPT/blob/master/autogpt_platform/backend/backend/integrations/webhooks/github.py"><code>integrations/webhooks/github.py</code></a>
|
||||
</summary>
|
||||
|
||||
```python title="backend/integrations/webhooks/github.py"
|
||||
--8<-- "autogpt_platform/backend/backend/integrations/webhooks/github.py:GithubWebhooksManager"
|
||||
```
|
||||
</details>
|
||||
|
||||
## Key Points to Remember
|
||||
|
||||
- **Unique ID**: Give your block a unique ID in the **init** method.
|
||||
- **Input and Output Schemas**: Define clear input and output schemas.
|
||||
- **Error Handling**: Implement error handling in the `run` method.
|
||||
- **Output Results**: Use `yield` to output results in the `run` method.
|
||||
- **Testing**: Provide test input and output in the **init** method for automatic testing.
|
||||
|
||||
## Understanding the Testing Process
|
||||
|
||||
The testing of blocks is handled by `test_block.py`, which does the following:
|
||||
|
||||
1. It calls the block with the provided `test_input`.
|
||||
If the block has a `credentials` field, `test_credentials` is passed in as well.
|
||||
2. If a `test_mock` is provided, it temporarily replaces the specified methods with the mock functions.
|
||||
3. It then asserts that the output matches the `test_output`.
|
||||
|
||||
For the WikipediaSummaryBlock:
|
||||
|
||||
- The test will call the block with the topic "Artificial Intelligence".
|
||||
- Instead of making a real API call, it will use the mock function, which returns `{"extract": "summary content"}`.
|
||||
- It will then check if the output key is "summary" and its value is a string.
|
||||
|
||||
This approach allows us to test the block's logic comprehensively without relying on external services, while also accommodating non-deterministic outputs.
|
||||
|
||||
## Security Best Practices for SSRF Prevention
|
||||
|
||||
When creating blocks that handle external URL inputs or make network requests, it's crucial to use the platform's built-in SSRF protection mechanisms. The `backend.util.request` module provides a secure `Requests` wrapper class that should be used for all HTTP requests.
|
||||
|
||||
### Using the Secure Requests Wrapper
|
||||
|
||||
```python
|
||||
from backend.util.request import requests
|
||||
|
||||
class MyNetworkBlock(Block):
|
||||
def run(self, input_data: Input, **kwargs) -> BlockOutput:
|
||||
try:
|
||||
# The requests wrapper automatically validates URLs and blocks dangerous requests
|
||||
response = requests.get(input_data.url)
|
||||
yield "result", response.text
|
||||
except ValueError as e:
|
||||
# URL validation failed
|
||||
raise RuntimeError(f"Invalid URL provided: {e}")
|
||||
except requests.exceptions.RequestException as e:
|
||||
# Request failed
|
||||
raise RuntimeError(f"Request failed: {e}")
|
||||
```
|
||||
|
||||
The `Requests` wrapper provides these security features:
|
||||
|
||||
1. **URL Validation**:
|
||||
- Blocks requests to private IP ranges (RFC 1918)
|
||||
- Validates URL format and protocol
|
||||
- Resolves DNS and checks IP addresses
|
||||
- Supports whitelisting trusted origins
|
||||
|
||||
2. **Secure Defaults**:
|
||||
- Disables redirects by default
|
||||
- Raises exceptions for non-200 status codes
|
||||
- Supports custom headers and validators
|
||||
|
||||
3. **Protected IP Ranges**:
|
||||
The wrapper denies requests to these networks:
|
||||
|
||||
```python title="backend/util/request.py"
|
||||
--8<-- "autogpt_platform/backend/backend/util/request.py:BLOCKED_IP_NETWORKS"
|
||||
```
|
||||
|
||||
### Custom Request Configuration
|
||||
|
||||
If you need to customize the request behavior:
|
||||
|
||||
```python
|
||||
from backend.util.request import Requests
|
||||
|
||||
# Create a custom requests instance with specific trusted origins
|
||||
custom_requests = Requests(
|
||||
trusted_origins=["api.trusted-service.com"],
|
||||
raise_for_status=True,
|
||||
extra_headers={"User-Agent": "MyBlock/1.0"}
|
||||
)
|
||||
```
|
||||
|
||||
## Tips for Effective Block Testing
|
||||
|
||||
1. **Provide realistic test_input**: Ensure your test input covers typical use cases.
|
||||
|
||||
2. **Define appropriate test_output**:
|
||||
|
||||
- For deterministic outputs, use specific expected values.
|
||||
- For non-deterministic outputs or when only the type matters, use Python types (e.g., `str`, `int`, `dict`).
|
||||
- You can mix specific values and types, e.g., `("key1", str), ("key2", 42)`.
|
||||
|
||||
3. **Use test_mock for network calls**: This prevents tests from failing due to network issues or API changes.
|
||||
|
||||
4. **Consider omitting test_mock for blocks without external dependencies**: If your block doesn't make network calls or use external resources, you might not need a mock.
|
||||
|
||||
5. **Consider edge cases**: Include tests for potential error conditions in your `run` method.
|
||||
|
||||
6. **Update tests when changing block behavior**: If you modify your block, ensure the tests are updated accordingly.
|
||||
|
||||
By following these steps, you can create new blocks that extend the functionality of the AutoGPT Agent Server.
|
||||
|
||||
## Blocks we want to see
|
||||
|
||||
Below is a list of blocks that we would like to see implemented in the AutoGPT Agent Server. If you're interested in contributing, feel free to pick one of these blocks or chose your own.
|
||||
|
||||
If you would like to implement one of these blocks, open a pull request and we will start the review process.
|
||||
|
||||
### Consumer Services/Platforms
|
||||
|
||||
- Google sheets - [~~Read/Append~~](https://github.com/Significant-Gravitas/AutoGPT/pull/8236)
|
||||
- Email - Read/Send with [~~Gmail~~](https://github.com/Significant-Gravitas/AutoGPT/pull/8236), Outlook, Yahoo, Proton, etc
|
||||
- Calendar - Read/Write with Google Calendar, Outlook Calendar, etc
|
||||
- Home Assistant - Call Service, Get Status
|
||||
- Dominos - Order Pizza, Track Order
|
||||
- Uber - Book Ride, Track Ride
|
||||
- Notion - Create/Read Page, Create/Append/Read DB
|
||||
- Google drive - read/write/overwrite file/folder
|
||||
|
||||
### Social Media
|
||||
|
||||
- Twitter - Post, Reply, Get Replies, Get Comments, Get Followers, Get Following, Get Tweets, Get Mentions
|
||||
- Instagram - Post, Reply, Get Comments, Get Followers, Get Following, Get Posts, Get Mentions, Get Trending Posts
|
||||
- TikTok - Post, Reply, Get Comments, Get Followers, Get Following, Get Videos, Get Mentions, Get Trending Videos
|
||||
- LinkedIn - Post, Reply, Get Comments, Get Followers, Get Following, Get Posts, Get Mentions, Get Trending Posts
|
||||
- YouTube - Transcribe Videos/Shorts, Post Videos/Shorts, Read/Reply/React to Comments, Update Thumbnails, Update Description, Update Tags, Update Titles, Get Views, Get Likes, Get Dislikes, Get Subscribers, Get Comments, Get Shares, Get Watch Time, Get Revenue, Get Trending Videos, Get Top Videos, Get Top Channels
|
||||
- Reddit - Post, Reply, Get Comments, Get Followers, Get Following, Get Posts, Get Mentions, Get Trending Posts
|
||||
- Treatwell (and related Platforms) - Book, Cancel, Review, Get Recommendations
|
||||
- Substack - Read/Subscribe/Unsubscribe, Post/Reply, Get Recommendations
|
||||
- Discord - Read/Post/Reply, Moderation actions
|
||||
- GoodReads - Read/Post/Reply, Get Recommendations
|
||||
|
||||
### E-commerce
|
||||
|
||||
- Airbnb - Book, Cancel, Review, Get Recommendations
|
||||
- Amazon - Order, Track Order, Return, Review, Get Recommendations
|
||||
- eBay - Order, Track Order, Return, Review, Get Recommendations
|
||||
- Upwork - Post Jobs, Hire Freelancer, Review Freelancer, Fire Freelancer
|
||||
|
||||
### Business Tools
|
||||
|
||||
- External Agents - Call other agents similar to AutoGPT
|
||||
- Trello - Create/Read/Update/Delete Cards, Lists, Boards
|
||||
- Jira - Create/Read/Update/Delete Issues, Projects, Boards
|
||||
- Linear - Create/Read/Update/Delete Issues, Projects, Boards
|
||||
- Excel - Read/Write/Update/Delete Rows, Columns, Sheets
|
||||
- Slack - Read/Post/Reply to Messages, Create Channels, Invite Users
|
||||
- ERPNext - Create/Read/Update/Delete Invoices, Orders, Customers, Products
|
||||
- Salesforce - Create/Read/Update/Delete Leads, Opportunities, Accounts
|
||||
- HubSpot - Create/Read/Update/Delete Contacts, Deals, Companies
|
||||
- Zendesk - Create/Read/Update/Delete Tickets, Users, Organizations
|
||||
- Odoo - Create/Read/Update/Delete Sales Orders, Invoices, Customers
|
||||
- Shopify - Create/Read/Update/Delete Products, Orders, Customers
|
||||
- WooCommerce - Create/Read/Update/Delete Products, Orders, Customers
|
||||
- Squarespace - Create/Read/Update/Delete Pages, Products, Orders
|
||||
|
||||
## Agent Templates we want to see
|
||||
|
||||
### Data/Information
|
||||
|
||||
- Summarize top news of today, of this week, this month via Apple News or other large media outlets BBC, TechCrunch, hackernews, etc
|
||||
- Create, read, and summarize substack newsletters or any newsletters (blog writer vs blog reader)
|
||||
- Get/read/summarize the most viral Twitter, Instagram, TikTok (general social media accounts) of the day, week, month
|
||||
- Get/Read any LinkedIn posts or profile that mention AI Agents
|
||||
- Read/Summarize discord (might not be able to do this because you need access)
|
||||
- Read / Get most read books in a given month, year, etc from GoodReads or Amazon Books, etc
|
||||
- Get dates for specific shows across all streaming services
|
||||
- Suggest/Recommend/Get most watched shows in a given month, year, etc across all streaming platforms
|
||||
- Data analysis from xlsx data set
|
||||
- Gather via Excel or Google Sheets data > Sample the data randomly (sample block takes top X, bottom X, randomly, etc) > pass that to LLM Block to generate a script for analysis of the full data > Python block to run the script> making a loop back through LLM Fix Block on error > create chart/visualization (potentially in the code block?) > show the image as output (this may require frontend changes to show)
|
||||
- Tiktok video search and download
|
||||
|
||||
### Marketing
|
||||
|
||||
- Portfolio site design and enhancements
|