Commit Graph

5345 Commits (785a40ff9defd01be0b57fc797ec940627f00c46)

Author SHA1 Message Date
Krzysztof Czerwinski 4e02f7ddb5
feat(forge): Add `mount` method to `FileStorage` & execute code in mounted workspace (#7115)
* Add `FileStorage.mount()` method, which mounts (part of) the workspace to a local path
  * Add `watchdog` library to watch file changes in mount
* Amend `CodeExecutorComponent`
  * Amend `execute_python_file` to execute Python files in a workspace mount
  * Amend `execute_python_code` to create temporary .py file in workspace instead of as a local file
  * Add support for `Path` argument to `filename` parameter on `execute_python_file`

* Fix `test_execute_python_code` (by making it async)
2024-05-24 21:34:22 +02:00
Reinier van der Leer edcbbbce25
feat(forge/llm): Add `GroqProvider` (#7130)
* Add `GroqProvider` in `forge.llm.providers.groq`
  * Add to `llm.providers.multi`
  * Add `groq` dependency (v0.8.0)

* Update AutoGPT docs & config template
  * Update .env.template
  * Update docs
2024-05-24 16:34:51 +02:00
Krzysztof Czerwinski cdae98d36b
fix(ci): Fix cli and CI (#7166)
- Add a special case for cli to handle autogpt and forge agent
- Remove forge agent from smoke test ci
2024-05-22 17:18:00 +01:00
Reinier van der Leer 5292736779
fix(agent): Unbreak docker builds after repo restructure (#7164)
- Move `autogpt/Dockerfile` to `Dockerfile.autogpt`
  - Write new selective `.dockerignore` (in repo root) to keep build context clean
  - Amend `autogpt/docker-compose.yml` and all `autogpt-docker-*.yml` workflows accordingly

- Include `forge/` in docker build context so it can be used as a path dependency

- Include `frontend/` in docker builds
2024-05-22 18:11:16 +02:00
Reinier van der Leer e16d58af0c
mark docs/_javascript/** as `linguist-vendored` 2024-05-22 16:44:14 +02:00
Reinier van der Leer f80bc0a523
fix marking frontend builds as `linguist-generated` to exclude from language stats 2024-05-22 16:38:56 +02:00
Swifty a5ee640935
feat(rnd): Add template of the next gen autogpt project (#7162)
* feat(rnd): Add template of the next gen autogpt project

* fix(rnd): fix typo

* fix(rnd): typo

* Added multi-processor arch

* feat(rnd) add bi-direction communication

* Updated project structure
2024-05-22 14:36:38 +02:00
Krzysztof Czerwinski 4c325724ec
refactor(autogpt, forge): Remove `autogpts` directory (#7163)
- Moved `autogpt` and `forge` to project root
- Removed `autogpts` directory
- Moved and renamed submodule `autogpts/autogpt/tests/vcr_cassettes` to `autogpt/tests/vcr_cassettes`
- When using CLI agents will be created in `agents` directory (instead of `autogpts`)
- Renamed relevant docs, code and config references from `autogpts/[forge|autogpt]` to `[forge|autogpt]` and from `*../../*` to `*../*`
- Updated `CODEOWNERS`, GitHub Actions and Docker `*.yml` configs
- Updated symbolic links in `docs`
2024-05-22 13:08:54 +01:00
Krzysztof Czerwinski 3475aaf384
refactor(agent): Remove unused `autogpt` code (#7112)
Remove unused `autogpt` code and reorganize its file structure.

* Moved:
  * `autogpt/agent_manager/agent_manager.py` to `autogpt/agents/agent_manager.py`, so the dir `agent_manager` was removed
  * `dump_prompt` from `autogpt.core.runner.client_lib.logging.helpers` to `forge/llm/prompting/utils.py`
  * `coroutine` decorator from `autogpt.core.runner.client_lib.utils` to `autogpt/app/utils.py`
* Removed within `autogpt`:
  * Memory-related code from multiple files (not used), including `memory/*`
  * Memory-related config entries/env vars: `memory_backend`, `memory_index`, `redis_host`, `redis_port`, `redis_password`, `wipe_redis_on_start`
  * `core` files, from failed re-arch:
    * `*.md` docs
    * `core/ability/*`
    * `core/agent/*`
    * `core/memory/*`
    * `core/planning/*`
    * `core/plugin/*`
    * `core/workspace/*`
    * `core/runner/*` (`dump_prompt` and `coroutine` were moved)
  * Related tests
* Updated relevant docs
2024-05-22 09:43:15 +01:00
Krzysztof Czerwinski bcc5282aba
refactor(forge): Clean `forge` (#7117)
Remove unused `forge` code and improve structure of `forge`.

* Put all Agent Protocol stuff together in `forge.agent_protocol`
  * ... including `forge.agent_protocol.database` (was `forge.db`)
* Remove duplicate/unused parts from `forge`
  * `forge.actions`, containing old commands; replaced by `forge.components` from `autogpt`
  * `forge/agent.py` (the old one, `ForgeAgent`)
  * `forge/app.py`, which was used to serve and run the `ForgeAgent`
  * `forge/db.py` (`ForgeDatabase`), which was used for `ForgeAgent`
  * `forge/llm.py`, which has been replaced by new `forge.llm` module which was ported from `autogpt.core.resource.model_providers`
  * `forge.memory`, which is not in use and not being maintained
  * `forge.sdk`, much of which was moved into other modules and the rest is deprecated
  * `AccessDeniedError`: unused
  * `forge_log.py`: replaced with `logging`
  * `validate_yaml_file`: not needed
  * `ai_settings_file` and associated loading logic and env var `AI_SETTINGS_FILE`: unused
  * `prompt_settings_file` and associated loading logic and env var `PROMPT_SETTINGS_FILE`: default directives are now provided by the `SystemComponent`
    * `request_user_double_check`, which was only used in `AIDirectives.load`
  * `TypingConsoleHandler`: not used
2024-05-21 19:18:47 +01:00
Swifty 2cca4fa47f
clean(benchmark): Remove Depreciated Challenges (#7144)
* Remove depreciated challanges

* Update license and pyproject.toml
2024-05-20 15:01:36 +02:00
Krzysztof Czerwinski e8d7dfa386
refactor(agent, forge): Move library code from `autogpt` to `forge` (#7106)
Moved from `autogpt` to `forge`:
- `autogpt.config`          -> `forge.config`
- `autogpt.processing`      -> `forge.content_processing`
- `autogpt.file_storage`    -> `forge.file_storage`
- `autogpt.logs`            -> `forge.logging`
- `autogpt.speech`          -> `forge.speech`
- `autogpt.agents.(base|components|protocols)`  -> `forge.agent.*`
- `autogpt.command_decorator`                   -> `forge.command.decorator`
- `autogpt.models.(command|command_parameter)`  -> `forge.command.(command|parameter)`
- `autogpt.(commands|components|features)`      -> `forge.components`
- `autogpt.core.utils.json_utils`           -> `forge.json.parsing`
- `autogpt.prompts.utils`                   -> `forge.llm.prompting.utils`
- `autogpt.core.prompting.(base|schema|utils)`    -> `forge.llm.prompting.*`
- `autogpt.core.resource.model_providers`   -> `forge.llm.providers`
- `autogpt.llm.providers.openai` + `autogpt.core.resource.model_providers.utils`
                                            -> `forge.llm.providers.utils`
- `autogpt.models.action_history:Action*`   -> `forge.models.action`
- `autogpt.core.configuration.schema`       -> `forge.models.config`
- `autogpt.core.utils.json_schema`          -> `forge.models.json_schema`
- `autogpt.core.resource.schema`            -> `forge.models.providers`
- `autogpt.models.utils`                    -> `forge.models.utils`
- `forge.sdk.(errors|utils)` + `autogpt.utils.(exceptions|file_operations_utils|validators)`
                        -> `forge.utils.(exceptions|file_operations|url_validator)`
- `autogpt.utils.utils` -> `forge.utils.const` + `forge.utils.yaml_validator`

Moved within `forge`:
- forge/prompts/* -> forge/llm/prompting/*

The rest are mostly import updates, and some sporadic removals and necessary updates (for example to fix circular deps):
- Changed `CommandOutput = Any` to remove coupling with `ContextItem` (no longer needed)
- Removed unused `Singleton` class
- Reluctantly moved `speech` to forge due to coupling (tts needs to be changed into component)
- Moved `function_specs_from_commands` and `core/resource/model_providers` to `llm/providers` (resources were a `core` thing and are no longer relevant)
- Keep tests in `autogpt` to reduce changes in this PR
- Removed unused memory-related code from tests
- Removed duplicated classes: `FancyConsoleFormatter`, `BelowLevelFilter`
- `prompt_settings.yaml` is in both `autogpt` and `forge` because for some reason doesn't work when placed in just one dir (need to be taken care of)
- Removed `config` param from `clean_input`, it wasn't used and caused circular dependency
- Renamed `BaseAgentActionProposal` to `ActionProposal`
- Updated `pyproject.toml` in `forge` and `autogpt`
- Moved `Action*` models from `forge/components/action_history/model.py` to `forge/models/action.py` as those are relevant to the entire agent and not just `EventHistoryComponent` + to reduce coupling
- Renamed `DEFAULT_ASK_COMMAND` to `ASK_COMMAND` and `DEFAULT_FINISH_COMMAND` to `FINISH_COMMAND`
- Renamed `AutoGptFormatter` to `ForgeFormatter` and moved to `forge`

Includes changes from PR https://github.com/Significant-Gravitas/AutoGPT/pull/7148
---------

Co-authored-by: Reinier van der Leer <pwuts@agpt.co>
2024-05-16 00:37:53 +02:00
Zamil Majdy 4f81246fd4
Fix poetry install issue on ARM64 & python 3.12 (#7145) 2024-05-14 09:10:55 -05:00
SwiftyOS 4fe62b8063 new frontend build as ci is broke 2024-05-11 09:22:59 +02:00
SwiftyOS b3967fd597 remove leaderboard 2024-05-11 09:15:09 +02:00
SwiftyOS 1f05881283 fix: typo 2024-05-11 08:45:51 +02:00
SwiftyOS a9afb3cbff removed git requirement from cli 2024-05-11 08:41:52 +02:00
Reinier van der Leer c562b3b6a3
unbreak `./run agent create`
"If we had done this in Swift it would've never happened" ~Craig Swift

                ____
              / . .\
              \  ---<
               \  /
       ________/ /
    -=:___________/
2024-05-10 12:53:57 +02:00
Reinier van der Leer b0cbf711dc
feat(agent): Persist `AgentContext` in `Agent.state` (#7125)
Persist the agent's `AgentContext` so that it works in rehydrated agent instances. This makes context usable in the `AgentProtocolServer`, where the agent instance is loaded and destroyed for every step.

- Make `AgentContext` a Pydantic model
- Add `context` parameter to `ContextComponent.__init__` so we can pass in an existing instance
- Add `context: AgentContext` to `AgentSettings` so it is persisted
- Add `type` attribute to `ContextItem` implementations as a discriminator
- Rename `ContextItem` base class to `BaseContextItem` and make new `ContextItem` type alias (union of the implementation types)
2024-05-10 09:30:12 +02:00
Reinier van der Leer 7e02cfdc9f
fix(agent): Fix type propagation of `Command` and `@command` when used on methods (#7124) 2024-05-09 11:39:09 +02:00
Swifty 34fdbaa26b
Remove arena (#7134)
* remove arena

* refactor: Remove Arena intake workflow

* Remove all mention of the arena

* remove evo.ninja
2024-05-09 11:36:40 +02:00
Swifty 818d391284
Remove arena submission from cli (#7137) 2024-05-09 11:27:16 +02:00
Reinier van der Leer 08c32a7a12
lint: Fix linting errors in git_log_to_release_notes.py 2024-05-07 18:53:19 +02:00
Reinier van der Leer 56104bd047
feat(agent/core): Allow `list[ChatMessage]` in `dump_prompt` 2024-05-07 16:43:28 +02:00
Reinier van der Leer 2ef5cd7d4c
fix(agent): Swap target files and symlinks of component documentation to make package buildable
Documentation files were in docs/content/AutoGPT/components, symlinks in autogpts/autogpt/autogpt/(agents|commands).
Chef doesn't allow symlinks that point to locations outside of package dir.
Replacing the documentation files with symlinks, and symlinks with the actual documentation files, should fix this.
2024-05-07 13:44:31 +02:00
Reinier van der Leer 74b3aae5c6
fix(agent/docs): Fix symlinks to component-based agent docs 2024-05-07 13:35:58 +02:00
Reinier van der Leer e9b3b5090c
lint(agent): Add `flake8` to pre-commit checks 2024-05-07 13:30:10 +02:00
Reinier van der Leer 9bac6f4ce2
feat(agent/scripts): Add git_log_to_release_notes.py
This script asks the user to choose two git refs, and then writes release notes for the diff between those two refs.
2024-05-04 20:55:42 +02:00
Reinier van der Leer 39c46ef6be
feat(agent/core): Add Anthropic Claude 3 support (#7085)
- feat(agent/core): Add `AnthropicProvider`
  - Add `ANTHROPIC_API_KEY` to .env.template and docs

  Notable differences in logic compared to `OpenAIProvider`:
  - Merges subsequent user messages in `AnthropicProvider._get_chat_completion_args`
  - Merges and extracts all system messages into `system` parameter in `AnthropicProvider._get_chat_completion_args`
  - Supports prefill; merges prefill content (if any) into generated response

- Prompt changes to improve compatibility with `AnthropicProvider`
  Anthropic has a slightly different API compared to OpenAI, and has much stricter input validation. E.g. Anthropic only supports a single `system` prompt, where OpenAI allows multiple `system` messages. Anthropic also forbids sequences of multiple `user` or `assistant` messages and requires that messages alternate between roles.
  - Move response format instruction from separate message into main system prompt
  - Fix clock message format
  - Add pre-fill to `OneShot` generated prompt

- refactor(agent/core): Tweak `model_providers.schema`
  - Simplify `ModelProviderUsage`
     - Remove attribute `total_tokens` as it is always equal to `prompt_tokens + completion_tokens`
     - Modify signature of `update_usage(..)`; no longer requires a full `ModelResponse` object as input
  - Improve `ModelProviderBudget`
     - Change type of attribute `usage` to `defaultdict[str, ModelProviderUsage]` -> allow per-model usage tracking
     - Modify signature of `update_usage_and_cost(..)`; no longer requires a full `ModelResponse` object as input
     - Allow `ModelProviderBudget` zero-argument instantiation
  - Fix type of `AssistantChatMessage.role` to match `ChatMessage.role` (str -> `ChatMessage.Role`)
  - Add shared attributes and constructor to `ModelProvider` base class
  - Add `max_output_tokens` parameter to `create_chat_completion` interface
  - Add pre-filling as a global feature
    - Add `prefill_response` field to `ChatPrompt` model
    - Add `prefill_response` parameter to `create_chat_completion` interface
  - Add `ChatModelProvider.get_available_models()` and remove `ApiManager`
  - Remove unused `OpenAIChatParser` typedef in openai.py
  - Remove redundant `budget` attribute definition on `OpenAISettings`
  - Remove unnecessary `usage` in `OpenAIProvider` > `default_settings` > `budget`

- feat(agent): Allow use of any available LLM provider through `MultiProvider`
  - Add `MultiProvider` (`model_providers.multi`)
  - Replace all references to / uses of `OpenAIProvider` with `MultiProvider`
  - Change type of `Config.smart_llm` and `Config.fast_llm` from `str` to `ModelName`

- feat(agent/core): Validate function call arguments in `create_chat_completion`
    - Add `validate_call` method to `CompletionModelFunction` in `model_providers.schema`
    - Add `validate_tool_calls` utility function in `model_providers.utils`
    - Add tool call validation step to `create_chat_completion` in `OpenAIProvider` and `AnthropicProvider`
    - Remove (now redundant) command argument validation logic in agent.py and models/command.py

- refactor(agent): Rename `get_openai_command_specs` to `function_specs_from_commands`
2024-05-04 20:33:25 +02:00
Nicholas Tindle 78d83bb3ce
Create .pr_agent.toml 2024-05-04 09:38:37 -05:00
Reinier van der Leer d57ccf7ec9
fix(agent): Fix `open_file` and `open_folder` commands
They weren't ported properly to the new component-based architecture: the `@sanitize_path` decorator was removed, causing path handling issues.
2024-05-02 02:41:03 +02:00
Reinier van der Leer ada2e19829
refactor(agent)!: Use Pydantic models for `Agent` process output (#7116)
* Introduce `BaseAgentActionProposal`, `OneShotAgentActionProposal`, and `AssistantThoughts` models to replace `ThoughtProcessResponse`, `DEFAULT_RESPONSE_SCHEMA`
* Refactor and clean up code because now we don't need to do as much type checking everywhere
* Tweak `OneShot` response format instruction

Granular:

* `autogpt.agents.prompt_strategies.one_shot`
  * Replace ThoughtProcessResponse`, `DEFAULT_RESPONSE_SCHEMA` and parsing logic by `AssistantThoughts` and `OneShotAgentActionProposal`
  * (TANGENTIAL) Move response format instruction into main system prompt message
  * (TANGENTIAL) Adjust response format instruction

* `autogpt.agents.base`
  * Add `BaseAgentActionProposal` base model -> replace `ThoughtProcessOutput`
  * Change signature of `execute` method to accept `BaseAgentActionProposal` instead of separate `command_name` and `command_args`
  * Add `do_not_execute(proposal, feedback)` abstract method, replacing `execute("human_feedback", ..., feedback)`

* Move `history` definition from `BaseAgentSettings` to `AgentSettings` (the only place where it's used anyway)

* `autogpt.models`
  * Add `.utils` > `ModelWithSummary` base model
  * Make the models in `.action_history` (`Episode`, `EpisodicActionHistory`) generic with a type parameter for the type of `Episode.action`

* `autogpt.core.resource.model_providers.schema`
  * Add `__str__` to `AssistantFunctionCall` which pretty-prints the function call

All other changes are a direct result of the changes above.

## BREAKING CHANGE:
* Due to the change in `autogpt.models.action_history`, the application after this change will be unable to load/resume agents from before this change and vice versa.
* The `additional_output` field in the response of `execute_step` has changed slightly:
  * Type of `.thoughts.plan` has changed from `str` to `list[str]`
  * `.command` -> `.use_tool`
  * `.command.args` -> `.use_tool.arguments`
2024-05-02 00:43:11 +02:00
Reinier van der Leer a7c7a5e18b
fix(agent): Fix `execute_python_file` on local storage
It's still broken for remote/cloud storage.
2024-04-30 15:26:41 +02:00
Reinier van der Leer 180de0c9a9
feat(agent/core): Support referenced types in `JSONSchema.from_dict` 2024-04-30 12:23:15 +02:00
Reinier van der Leer 8f0d5c73b3
fix(agent/core): Format parse errors for log statement in `OpenAIProvider.create_chat_completion` 2024-04-30 11:59:34 +02:00
王苏云 3b00e8229c
Fix ImportError for validate_yaml_file function (#7110)
* Fix ImportError for validate_yaml_file function

* Fix ImportError for validate_yaml_file function

---------

Co-authored-by: suyun <sylearn@foxmail.com>
Co-authored-by: Nicholas Tindle <nicholas.tindle@agpt.co>
2024-04-29 10:41:30 -05:00
Krzysztof Czerwinski e97726cde3
fix(autogpt): Revert line in `poetry.lock` (#7113)
Revert line in `poetry.lock` to from before https://github.com/Significant-Gravitas/AutoGPT/pull/7097
2024-04-29 17:37:20 +02:00
Krzysztof Czerwinski d38e8b8f6c
clean(autogpt): Remove old plugin system (#7097)
### Background

Follow up after merging https://github.com/Significant-Gravitas/AutoGPT/pull/7054, old plugins will no longer be used.

### Changes 🏗️

- Removed all dead code needed to load and use plugins.
- Removed `auto-gpt-plugin-template` dependency
- Removed `rev=` from `autogpt-forge` dependency (the set `rev` had incompatible `duckduckgo-search` versions)
- Kept `--install-plugin-deps` CLI option and dead code associated (may be needed for new plugins)
2024-04-28 21:10:53 +02:00
Reinier van der Leer 0014e2ac14
fix(agent): Update .env.template to match changes in 370615e 2024-04-26 19:25:33 +02:00
Reinier van der Leer 370615e5e4
feat(agent): Add support for new `gpt-4-turbo` model and set as default `SMART_LLM` 2024-04-26 19:15:00 +02:00
Reinier van der Leer f93c743d03
fix(agent): Fix `OneShotAgentPromptStrategy` parser when using functions/tools API
Also:
- Improve error message when the LLM doesn't call any tools
2024-04-24 18:59:13 +02:00
Reinier van der Leer 6add645597
fix(agent): Expand failure check in `json_loads(..)`
Not only check if the resulting object is `demjson3.undefined`, but also `demjson3.syntax_error`.
2024-04-24 18:57:50 +02:00
Reinier van der Leer bdda3a6698
fix(agent): Omit `EventHistory` progress message if empty
Also add a heading to the progress section
2024-04-24 18:56:43 +02:00
Reinier van der Leer 126aacb2e3
feat(agent/cli): Speed up loading of saved agents
O(n) to O(1) by removing individual `.exists(dir / "state.json")` calls and using `.list_files()` instead of `.list_folders()`
2024-04-24 18:54:24 +02:00
Reinier van der Leer 1afc8e40df
chore(agent): Update `duckduckgo-search` to v5.3.0 2024-04-24 17:57:32 +02:00
Reinier van der Leer 9543e5d6ac
fix(agent): Fix crash when `LOG_FORMAT=structured_google_cloud`
Another piece of fallout from cf00c33 - fix(agent): Fix debug logging & amend configure_logging for easier use
2024-04-24 13:56:35 +02:00
Nicholas Tindle 5e89b8c6d1
Add all the new component docs to the site and do a tidy up of docs (#7098)
* feat: add all the new component docs to the site

* fix(docs): relative links and markdown warnings

* feat(docs): How to contribute to the docs as a docs section

* fix(docs): missed docs page for developer setup

* fix(docs): re-add configurations options

* fix(docs): bad link to components fixed

* fix(docs): bad link to components fixed

* ref(docs): reorder some items to make more sense

* fix(docs): bad indentation and duplicate block

* fix(docs): warning about out of date markdown extension

* fix(docs): broken links fixed

* fix(docs): markdown formatter complaints
2024-04-23 08:49:07 -05:00
Nicholas Tindle fd3f8fa5fc
fix(agent/setup): Fix installing ONNXRuntime on macOS on some architectures (#7022)
Co-authored-by: Reinier van der Leer <pwuts@agpt.co>
2024-04-23 12:35:56 +02:00
Fullstop000 86bdbb82b1
fix(agent): Support OpenAI Project API keys (#7099)
Amend regex expression in config.py that OpenAI API keys are validated against

Signed-off-by: Fullstop000 <fullstop1005@gmail.com>
2024-04-23 12:29:12 +02:00
Reinier van der Leer 898317c16c
fix(agent): Full fix for CLI breakage introduced in cf00c33 2024-04-22 23:54:08 +02:00